Re: No longer able to write a UUID to Postgres with ClojureQL

2011-12-06 Thread Herwig Hochleitner
2011/12/6 Sean Corfield :
> If it helps someone debug this for Don (since he and I discussed this 
> off-list):
>
> The stack trace from ClojureQL originates in its function to return
> generated keys and it's calling .getInt on the (generated) key which
> fails because it's a UUID.
>
> So the question is probably: why is ClojureQL assuming all generated
> keys are integers?

It shouldn't, and doesn't now:
https://github.com/LauJensen/clojureql/commit/f7ffe88b166e6f60eccb3b4f46b7db5d69dbcc64
Thanks for tracing this and taking the time to post it.

> As for what might have changed in Don's setup, I wondered if the :uid
> column definition had been changed to indicate (to ClojureQL) that it
> is a potentially generated key?

CQL doesn't distinguish generated and non-generated. It just exposes
the notion, JDBC provides of that.

> (is there a ClojureQL mailing list?)

Not that I'm aware of, currently.

kind regards
-- 
__
Herwig Hochleitner

-- 
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: on lisp and scheme macros

2011-12-06 Thread Tassilo Horn
"Jose A. Ortega Ruiz"  writes:

Hi Jose,

>> I think that Common Lisp macros are, strictly speaking, more powerful
>> than Scheme macros, but I don't have a citation.
>
> That's only true for syntax-rules macros.  syntax-case macros, which
> most schemes provide and are required by R6RS, are, strictly speaking,
> more powerful than CL macros.

I don't know scheme macros, so could you please explain why they are
more powerful?  What can you do with a syntax-case macro what you cannot
do with a Common Lisp (or Clojure) macro?

Wikipedia lists syntax-case as hygienic macro system, which would make
it less powerful than CL macros, because if that was true, you could not
write anaphoric macros with it.

Bye,
Tassilo

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


Surprising behavior with clojure.core/int (and probably other primitive integer functions)

2011-12-06 Thread Cedric Greevey
user=> (binding [*unchecked-math* true] (map int [33 77 0x]))
#

The cause of this:

(defn int
  "Coerce to int"
  {
   :inline (fn  [x] `(. clojure.lang.RT (~(if *unchecked-math*
'uncheckedIntCast 'intCast) ~x)))
   :added "1.0"}
  [x] (. clojure.lang.RT (intCast x)))

The inline and non-inline version don't coincide -- the non-inline version
lacks the check for *unchecked-math*.

On top of that, the inline version sort-of doesn't work anyway --
specifically, it doesn't work if you do "the obvious":

user=> (binding [*unchecked-math* true] (int 0x))
#
user=> (defn foo [] (binding [*unchecked-math* true] (int 0x)))
#'user/foo
user=> (foo)
#

The problem there is apparently that it checks *unchecked-math* at
macroexpansion time, and of course binding it at runtime to do some
unchecked math therefore binds it too late to influence the int function.

If this is intentional, to avoid expensive runtime checks of dynamic Vars,
then there are two additional problems.

First, there's the apparent lack of an unchecked-int function, or similar,
that either is unchecked or checks *unchecked-math* at runtime, for those
who want dynamic behavior even if there's a cost.

Without this, there's no way to get unchecked int casts in map and other
HOFs short of ugly hacks like #(int %) or
#(clojure.lang.RT/uncheckedIntCast %).

Another use case would be when using ints not for speed but because you
want a 32-bit wraparound integer for some other purpose, such as talking to
I/O devices or legacy file formats that want such things, or to implement
certain algorithms that rely heavily on wraparound and bit arithmetic in a
relatively speed-insensitive context, likely where I/O is the bottleneck.

Furthermore, though (do (set! *unchecked-math* true) (println (int
0x)) (set! *unchecked-math* false)) works, it is ugly as sin and
set! is (usually) evil.

-- 
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: Ending or closing malformed line in REPL

2011-12-06 Thread Stuart Sierra
The built-in Clojure REPL is bare-bones to minimize external dependencies. 
Maybe some day we can have alternate distributions with more full-featured 
REPLs. For now, it's easier to use a development environment: Emacs + 
inferior-lisp or SLIME, Counterclockwise + Eclipse, Clooj, LaClojure + 
IntelliJ, ...

-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: Surprising behavior with clojure.core/int (and probably other primitive integer functions)

2011-12-06 Thread David Nolen
*unchecked-math* is a compiler flag.

On Tue, Dec 6, 2011 at 7:00 AM, Cedric Greevey  wrote:

> user=> (binding [*unchecked-math* true] (map int [33 77 0x]))
> # of range for int: 4294967295>
>
> The cause of this:
>
> (defn int
>   "Coerce to int"
>   {
>:inline (fn  [x] `(. clojure.lang.RT (~(if *unchecked-math*
> 'uncheckedIntCast 'intCast) ~x)))
>:added "1.0"}
>   [x] (. clojure.lang.RT (intCast x)))
>
> The inline and non-inline version don't coincide -- the non-inline version
> lacks the check for *unchecked-math*.
>
> On top of that, the inline version sort-of doesn't work anyway --
> specifically, it doesn't work if you do "the obvious":
>
> user=> (binding [*unchecked-math* true] (int 0x))
> # of range for int: 4294967295>
> user=> (defn foo [] (binding [*unchecked-math* true] (int 0x)))
> #'user/foo
> user=> (foo)
> # of range for int: 4294967295>
>
> The problem there is apparently that it checks *unchecked-math* at
> macroexpansion time, and of course binding it at runtime to do some
> unchecked math therefore binds it too late to influence the int function.
>
> If this is intentional, to avoid expensive runtime checks of dynamic Vars,
> then there are two additional problems.
>
> First, there's the apparent lack of an unchecked-int function, or similar,
> that either is unchecked or checks *unchecked-math* at runtime, for those
> who want dynamic behavior even if there's a cost.
>
> Without this, there's no way to get unchecked int casts in map and other
> HOFs short of ugly hacks like #(int %) or
> #(clojure.lang.RT/uncheckedIntCast %).
>
> Another use case would be when using ints not for speed but because you
> want a 32-bit wraparound integer for some other purpose, such as talking to
> I/O devices or legacy file formats that want such things, or to implement
> certain algorithms that rely heavily on wraparound and bit arithmetic in a
> relatively speed-insensitive context, likely where I/O is the bottleneck.
>
> Furthermore, though (do (set! *unchecked-math* true) (println (int
> 0x)) (set! *unchecked-math* false)) works, it is ugly as sin and
> set! is (usually) evil.
>
>  --
> 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: Surprising behavior with clojure.core/int (and probably other primitive integer functions)

2011-12-06 Thread Stuart Sierra
As David mentioned, *unchecked-math* is documented as a compile-time flag.

The coercion functions are a bit muddled by the changes to primitive math 
in 1.3. In Clojure 1.2, you could get primitive int inside loop/recur by 
calling `int` in the loop initialization. You can still do that in 1.3, but 
coercions inside loops are used less often because functions can now have 
primitive arguments. Primitive function args are restricted to longs and 
doubles, so the default numeric types in 1.3 are 
java.lang.Long/java.lang.Double, and that's what the Reader returns for 
numeric literals:

user=> (class (read-string "0x"))
java.lang.Long

Clojure won't ever give you a primitive 32-bit int outside of loop/recur, 
which is a frequent subject of confusion. Even if you coerce to `int`, the 
result is boxed as a java.lang.Long:

user=> (class (int 32))
java.lang.Long

If you need an unchecked 32-bit trucate operation, you can use the 
java.lang.Number.intValue() method:

user=> (map #(.intValue %) [33 77 0x])
(33 77 -1)

But even then, you're still getting java.lang.Longs back:

user=> (class (.intValue 0x))
java.lang.Long

Hope this helps,
-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: Ending or closing malformed line in REPL

2011-12-06 Thread jlhouchin
On 12/6/2011 12:23 AM, Laurent PETIT wrote:
> 2011/12/6 jlhouchin:
>> On 12/5/2011 7:19 PM, Stephen Compall wrote:
>>> On Mon, 2011-12-05 at 09:51 -0800, jlhouchin wrote:
 When I entered the closing " and then closing
 paren. I was fine.
>>>
>>> You may also try backspace; unusually for a REPL, that works.
>>
>> I tried that. But as I was on a new line after hitting the enter/
>> return key. It wouldn't go back to the previous line.  I would have
>> loved that it did. That the backspace could backspace over newlines.
>> That would be sweet.
>>
>> Now, I do not know if there are any difference in repls or if there is
>> only one repl. I was using the default 1.3 repl.
>
> There are also REPLs embedded in all the major editors / IDEs. As a
> shameless plug, I'd say that the namespace of Counterclockwise, a
> Clojure Feature for Eclipse, does the job quite well (input history,
> syntax coloration, code completion, hyperlinks, non-blocking sends,
> multiline input area with auto-indentation, namespace browser with
> search box&  documentation on mouse over / go to source on mouse
> double click, etc.)
>
> If you're interested, go to its "Getting Started page" :
> http://dev.clojure.org/display/doc/Getting+Started+with+Eclipse+and+Counterclockwise
>
> If you do not know / like Eclipse, then just start again from this
> general starting page to see what best suits your needs:
> http://dev.clojure.org/display/doc/Getting+Started

Hello Laurent, and also Petr from his post. Thank you for your
replies.

I have already selected Counterclockwise to use for editing. I am a
longtime Smalltalker, so I like rich environments. But I have yet to
learn how to use it much.

I have not seen how to simply open a REPL like I would use to go
through the books examples. When I go through the menus, I see a
Connect to REPL option. But I have no REPLs to connect to. I did not
know how to connect or use a REPL within ccw.

So, upon the writing of this email I went to search the ccw group
archives. I had already joined a week or so ago. I found how to open a
REPL.

It took me a moment to learn how to execute a statement which was
entered. Then I happened upon ctrl-enter.

This biggest issue I see in this context, is that the REPL is tied to
the editor. Yes, I can detach the REPL, but it is still a part of the
editor. I can't have the pdf of my book side by side with the REPL. As
soon as I click on the REPL, the entire editor comes to the top,
putting my book behind. Making it impossible to see the code I am
attempting to enter.

Is there a way to run this REPL completely independent of the editor?

Also, I do not see any way to go back in history with this REPL as I
can with the other.

Thanks for your suggestion. I look forward to learning ccw better.

Jimmie

-- 
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: Ending or closing malformed line in REPL

2011-12-06 Thread jlhouchin
On Dec 6, 10:04 am, Stuart Sierra  wrote:
> The built-in Clojure REPL is bare-bones to minimize external dependencies.
> Maybe some day we can have alternate distributions with more full-featured
> REPLs. For now, it's easier to use a development environment: Emacs +
> inferior-lisp or SLIME, Counterclockwise + Eclipse, Clooj, LaClojure +
> IntelliJ, ...
>
> -S

Yes, I understand. It isn't a problem. I was following the
instructions of the book which uses the default REPL.

For a minimal REPL, it really isn't that bad. I have seen worse.
And I was the creator of the problem I was having.

I am enjoying learning Clojure. It is nice.

Thanks.

Jimmie

-- 
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: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-06 Thread Andrew
I get the same thing on Windows XP with Leiningen 1.6.2 on Java 1.7.0 Java 
HotSpot(TM) Client VM

   - copied tools.jar manually to my lib/ just to see if it would work
   - it did, and still gave a warning about tools.jar
   - tried the test drive and when I type v I get this: *clojure\set.clj - 
   source not found.*
  - tried both clojure 1.2.0 and 1.3.0-alpha5
  - with clojure-source version corresponding to the version of clojure 
  each time
   
Here's my project.clj file: 

(defproject foo "0.0.0-SNAPSHOT"
  :description "project foo"
  :dependencies [[org.clojure/clojure "1.3.0-alpha5"]
 [seesaw "1.2.2"]]
  :dev-dependencies [[swank-clojure "1.4.0-SNAPSHOT"]
 [clojure-source "1.3.0-alpha5"]]
  :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n"]
  :checksum-deps true)

lib/ contains this:

clojure-1.3.0-alpha5.jar
dev/
filters-2.0.235.jar
forms-1.2.1.jar
j18n-1.0.0.jar
miglayout-3.7.4.jar
seesaw-1.2.2.jar
swing-worker-1.1.jar
swingx-1.6.1.jar
tools.jar

and lib/dev/ contains this:

cdt-1.2.6.2-20111019.122151-1.jar
clojure-1.2.1.jar
clojure-source-1.3.0-alpha5.jar
debug-repl-0.3.1.jar
swank-clojure-1.4.0-20111019.122151-12.jar


I should be able to see the source of set.clj, 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

Re: Ending or closing malformed line in REPL

2011-12-06 Thread Laurent PETIT
2011/12/6 jlhouchin :
> On 12/6/2011 12:23 AM, Laurent PETIT wrote:
>> 2011/12/6 jlhouchin:
>>> On 12/5/2011 7:19 PM, Stephen Compall wrote:
 On Mon, 2011-12-05 at 09:51 -0800, jlhouchin wrote:
> When I entered the closing " and then closing
> paren. I was fine.

 You may also try backspace; unusually for a REPL, that works.
>>>
>>> I tried that. But as I was on a new line after hitting the enter/
>>> return key. It wouldn't go back to the previous line.  I would have
>>> loved that it did. That the backspace could backspace over newlines.
>>> That would be sweet.
>>>
>>> Now, I do not know if there are any difference in repls or if there is
>>> only one repl. I was using the default 1.3 repl.
>>
>> There are also REPLs embedded in all the major editors / IDEs. As a
>> shameless plug, I'd say that the namespace of Counterclockwise, a
>> Clojure Feature for Eclipse, does the job quite well (input history,
>> syntax coloration, code completion, hyperlinks, non-blocking sends,
>> multiline input area with auto-indentation, namespace browser with
>> search box&  documentation on mouse over / go to source on mouse
>> double click, etc.)
>>
>> If you're interested, go to its "Getting Started page" :
>> http://dev.clojure.org/display/doc/Getting+Started+with+Eclipse+and+Counterclockwise
>>
>> If you do not know / like Eclipse, then just start again from this
>> general starting page to see what best suits your needs:
>> http://dev.clojure.org/display/doc/Getting+Started
>
> Hello Laurent, and also Petr from his post. Thank you for your
> replies.
>
> I have already selected Counterclockwise to use for editing. I am a
> longtime Smalltalker, so I like rich environments. But I have yet to
> learn how to use it much.
>
> I have not seen how to simply open a REPL like I would use to go
> through the books examples. When I go through the menus, I see a
> Connect to REPL option. But I have no REPLs to connect to. I did not
> know how to connect or use a REPL within ccw.
>
> So, upon the writing of this email I went to search the ccw group
> archives. I had already joined a week or so ago. I found how to open a
> REPL.
>
> It took me a moment to learn how to execute a statement which was
> entered. Then I happened upon ctrl-enter.
>
> This biggest issue I see in this context, is that the REPL is tied to
> the editor. Yes, I can detach the REPL, but it is still a part of the
> editor. I can't have the pdf of my book side by side with the REPL. As
> soon as I click on the REPL, the entire editor comes to the top,
> putting my book behind. Making it impossible to see the code I am
> attempting to enter.
>
> Is there a way to run this REPL completely independent of the editor?

Hello Jimmie,

Sorry for the inconvenience on the undocumented "Ctrl+Enter". That's
something I'm working on and will be fixed in the next release.

> Also, I do not see any way to go back in history with this REPL as I
> can with the other.

Yes, currently, a REPL in CCW will be tied to a project, which will
provide the "classpath context" for the REPL, among other things.

Then, once the REPL is started, you can maximize it via Ctrl+M (on
Windows/Linux).

Hope that helps,

-- Laurent

>
> Thanks for your suggestion. I look forward to learning ccw better.
>
> Jimmie
>
> --
> 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


Type hints for ^map migrating from 1.2 to 1.3

2011-12-06 Thread Eric in San Diego
I'm migrating some code from 1.2 to 1.3, and one of the things I've
encountered is that it no longer accepts ^map as a type hint.  It's
happy if I use ^clojure.lang.PersistentArrayMap, but that's quite a
mouthful.

Is there a more compact abbreviation I can use? Where are such things
documented?

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: on lisp and scheme macros

2011-12-06 Thread Stephen Compall
On Tue, 2011-12-06 at 16:09 +0100, Tassilo Horn wrote:
> Wikipedia lists syntax-case as hygienic macro system, which would make
> it less powerful than CL macros, because if that was true, you could not
> write anaphoric macros with it.

You can write anaphora with syntax-case.  In fact, defmacro itself can
be defined as a simple syntax-case macro.

-- 
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: Type hints for ^map migrating from 1.2 to 1.3

2011-12-06 Thread Phil Hagelberg
On Tue, Dec 6, 2011 at 9:31 AM, Eric in San Diego  wrote:
> I'm migrating some code from 1.2 to 1.3, and one of the things I've
> encountered is that it no longer accepts ^map as a type hint.  It's
> happy if I use ^clojure.lang.PersistentArrayMap, but that's quite a
> mouthful.

It's my understanding that ^map was never supported, but that Clojure
1.2 would silently accept type hints to non-existent classes, while
Clojure 1.3 does not. You probably want to hint it as an
IPersistentMap.

-Phil

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


Re: [ANN] dj-peg released 0.1.0

2011-12-06 Thread Brent Millare
I've added a little overview in the code, hopefully this should make things 
clearer. Also I made parse, the main invocation point, extensible to users 
of the library.

-- 
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: Type hints for ^map migrating from 1.2 to 1.3

2011-12-06 Thread Meikel Brandmeyer
Hi,

Am 06.12.2011 um 18:31 schrieb Eric in San Diego:

> I'm migrating some code from 1.2 to 1.3, and one of the things I've
> encountered is that it no longer accepts ^map as a type hint.  It's
> happy if I use ^clojure.lang.PersistentArrayMap, but that's quite a
> mouthful.
> 
> Is there a more compact abbreviation I can use? Where are such things
> documented?

Heretic question: why would you ever need a type hint on IPersistentMap?

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: ANN: Clarity 0.5.1 - New GUI library

2011-12-06 Thread Stathis Sideris
Hello Dave,

> I'll clarify some of Stathis' remarks about Seesaw below. Obviously,
> I'm a little biased, but Clarity looks cool and I plan on "borrowing"
> some of its features for Seesaw in the next release or two :)  I think
> it's great to have multiple projects like this to inspire each other
> and keep everyone honest. Keep up the nice work!

Thanks for your kind words, if you're borrowing I must be doing
something right! I too think that it's really cool to have multiple
projects, and it may help us learn from each other! We do have similar
problems after all.

> Seesaw selectors are basically Enlive selectors [1] ported to Swing.
> So it supports all the usually CSS hierarchical stuff, ids and classes
> (Clarity's categories). It can also select on Java class/sub-class
> relationships. I left it at that since selector+filter seemed a
> reasonable enough way to add custom predicates or whatever if
> necessary.
>
> [1]http://enlive.cgrand.net/syntax.html

OK that looks pretty powerful too, I retract my comments about being
able to do more with Clarity's selectors. :-)

> > The other thing that I think differentiates Clarity is the live
> > preview of layouts using clarity.dev/watch-component.
>
> I think that's very cool too. I approximate that workflow using
> lazytest's watcher to re-run my code when it changes.

I think that's a much better way. Currently, when watching a
component, Clarity bashes the JVM by creating the component every X
seconds (I did say it was an experimental feature!). I'll look into
lazytest's code to see how it detects the code changes. I suppose it
watches for changes in the class files, right?

Stathis

-- 
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: Using Lein with Local Jars on Heroku

2011-12-06 Thread Robert Levy
I was wondering the same thing and I came across your un-answered question
here.  The short answer appears to be
http://devcenter.heroku.com/articles/local-maven-dependencies

I was looking into writing a Clojure web app that I would license to an
acquaintance who is starting a business, and I wanted to see if I could
give him a something that he could deploy to Heroku and manage on his own
without making the source available to him (at first). This is possible to
do by pushing a lein project to heroku that depends on a jar containing the
main application code. (As a side note, I could be wrong but I think lein
has nonconfigurable behavior to include source files in the jar.  So a
minor change to lein might be required for conveniently building jars with
no source.)  Since it would be proprietary at first (I would like to make
it free later) it would make sense for the jar to be local rather than
placing it in the Clojars maven repo.

I thought maybe there would be a command to add a jar to a local
maven repo, but from my brief research into this, it seems that
"unmanaged dependencies" (linked above) is the way to do this.  I haven't
tried this yet, but think the only difference for Clojure projects is
that it shouldn't be necessary to edit the pom, but just add the
dependency as you normally would in project.clj.

Rob

On Aug 6, 3:52 pm, Asim Jalis  wrote:
> I am trying to push a Clojure app on Heroku. I have a local jar file
> that the app needs. How can I get lein to use the local jar?
>
> When I have local jar dependencies on my personal machine I just
> install the jar into the local maven repository on the machine. It's
> not obvious to me how to do this on Heroku. Does anyone have any
> experience with this or ideas on how to solve this?
>
> Thanks.
>
> Asim

-- 
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: Clarity 0.5.1 - New GUI library

2011-12-06 Thread Dave Ray
Stathis,

I use the Lazytest watcher partly out of convenience. I happen to use
Lazytest for testing so it's usually already running anyway. However,
some work has already been done to extract the watch functionality
[1]. It might be fun to combine your viewer with it. Maybe have a
naming convention for the watch entry point of an app or component so
you can use it without editing the file.

[1] 
https://groups.google.com/group/clojure-dev/browse_thread/thread/32ab1a5e7f819196/dde7a347e7f56b0a

Cheers,

Dave

On Tue, Dec 6, 2011 at 1:45 PM, Stathis Sideris  wrote:
> Hello Dave,
>
>> I'll clarify some of Stathis' remarks about Seesaw below. Obviously,
>> I'm a little biased, but Clarity looks cool and I plan on "borrowing"
>> some of its features for Seesaw in the next release or two :)  I think
>> it's great to have multiple projects like this to inspire each other
>> and keep everyone honest. Keep up the nice work!
>
> Thanks for your kind words, if you're borrowing I must be doing
> something right! I too think that it's really cool to have multiple
> projects, and it may help us learn from each other! We do have similar
> problems after all.
>
>> Seesaw selectors are basically Enlive selectors [1] ported to Swing.
>> So it supports all the usually CSS hierarchical stuff, ids and classes
>> (Clarity's categories). It can also select on Java class/sub-class
>> relationships. I left it at that since selector+filter seemed a
>> reasonable enough way to add custom predicates or whatever if
>> necessary.
>>
>> [1]http://enlive.cgrand.net/syntax.html
>
> OK that looks pretty powerful too, I retract my comments about being
> able to do more with Clarity's selectors. :-)
>
>> > The other thing that I think differentiates Clarity is the live
>> > preview of layouts using clarity.dev/watch-component.
>>
>> I think that's very cool too. I approximate that workflow using
>> lazytest's watcher to re-run my code when it changes.
>
> I think that's a much better way. Currently, when watching a
> component, Clarity bashes the JVM by creating the component every X
> seconds (I did say it was an experimental feature!). I'll look into
> lazytest's code to see how it detects the code changes. I suppose it
> watches for changes in the class files, right?
>
> Stathis
>
> --
> 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: No longer able to write a UUID to Postgres with ClojureQL

2011-12-06 Thread Sean Corfield
On Tue, Dec 6, 2011 at 6:12 AM, Herwig Hochleitner
 wrote:
> 2011/12/6 Sean Corfield :
>> So the question is probably: why is ClojureQL assuming all generated
>> keys are integers?
> It shouldn't, and doesn't now:
> https://github.com/LauJensen/clojureql/commit/f7ffe88b166e6f60eccb3b4f46b7db5d69dbcc64
> Thanks for tracing this and taking the time to post it.

That looks like the fix Don needs! Thanx for the swift response.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.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: Using Lein with Local Jars on Heroku

2011-12-06 Thread Phil Hagelberg
On Tue, Dec 6, 2011 at 11:12 AM, Robert Levy  wrote:
> I was wondering the same thing and I came across your un-answered question
> here.  The short answer appears to
> be http://devcenter.heroku.com/articles/local-maven-dependencies
>
> As a side note, I could be wrong but I think lein has
> nonconfigurable behavior to include source files in the jar.

No, you can disable this in project.clj.

> I thought maybe there would be a command to add a jar to a local maven repo,
> but from my brief research into this, it seems that "unmanaged dependencies"
> (linked above) is the way to do this.

There's a plugin, but this is only useful in the context of local
development: https://github.com/kumarshantanu/lein-localrepo

You can certainly store your jars in git, but a better approach is to
keep them in a private Maven repository. This can be done by running
your own server, using a repository service, or uploading jars to S3
in the repository format. I'm working on putting together better
documentation for this.

-Phil

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


Defrecord Composition Problem

2011-12-06 Thread tmountain
Hi, I'm playing around with protocols and records and trying to
implement some ad-hoc type composition. I have a solution that works,
but I want to make it more readable. Specifically, if you look at the
code below, I'd like to come up with a macro or some other solution to
eliminate all the calls to (get-this this). Ideally, I could just say
something like (:id (self)) or something along those lines. The
reasoning for having a get-this method should become evident as your
read the code. It's basically an abstraction for calling derived
behaviors.

(defrecord Entity [id asset location data])
(defrecord Farmer [entity])

(defprotocol Inspectable
  (inspect [_])
  (get-this [_]))

(defprotocol Survive
  (find-food [_]))

(defn base-inspect [this]
  (println "entity" (:id this) "@" (:location (get-this this)) (:data
(get-this this

(def base-behavior {
  :get-this (fn [this] this)
  ;:inspect (fn [this] (println "entity" (:id this) "@" (:location
(get-this this)) (:data (get-this this
  :inspect base-inspect
})

(extend Entity
  Inspectable
  base-behavior)

(def survival-behavior {
  :find-food (fn [this] (println "entity" (:id (get-this this))
"looking for food"))
})

(extend Farmer
  Inspectable
  (merge base-behavior {:get-this (fn [this] (:entity this))})
  Survive survival-behavior)

(def thing (Entity. 1 :foo [0, 0] {}))
(inspect thing)
(def farmer (Farmer. thing))
(find-food farmer)

-- 
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: No longer able to write a UUID to Postgres with ClojureQL

2011-12-06 Thread Don Jackson

On Dec 6, 2011, at 11:23 AM, Sean Corfield wrote:

> On Tue, Dec 6, 2011 at 6:12 AM, Herwig Hochleitner
>  wrote:
>> 2011/12/6 Sean Corfield :
>>> So the question is probably: why is ClojureQL assuming all generated
>>> keys are integers?
>> It shouldn't, and doesn't now:
>> https://github.com/LauJensen/clojureql/commit/f7ffe88b166e6f60eccb3b4f46b7db5d69dbcc64
>> Thanks for tracing this and taking the time to post it.

I have confirmed that this change/commit fixes my/the problem!

Thank you Herwig for the fix, and thank you Sean for narrowing the problem down!



-- 
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: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-06 Thread Sean Corfield
Did you (require 'clojure.set) ? It's not in the instructions for CDT...

On Tue, Dec 6, 2011 at 8:51 AM, Andrew  wrote:
> tried the test drive and when I type v I get this: clojure\set.clj - source
> not found.

-- 
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: Google chart library

2011-12-06 Thread Gary Trakhman
Note, there is a java api to create the DataTable JSON, it follows some 
simple rules.

http://code.google.com/p/google-visualization-java/


-- 
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: Type hints for ^map migrating from 1.2 to 1.3

2011-12-06 Thread Alan Malloy
On Dec 6, 10:31 am, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 06.12.2011 um 18:31 schrieb Eric in San Diego:
>
> > I'm migrating some code from 1.2 to 1.3, and one of the things I've
> > encountered is that it no longer accepts ^map as a type hint.  It's
> > happy if I use ^clojure.lang.PersistentArrayMap, but that's quite a
> > mouthful.
>
> > Is there a more compact abbreviation I can use? Where are such things
> > documented?
>
> Heretic question: why would you ever need a type hint on IPersistentMap?

I mostly agree here - you probably don't want it typehinted. But
perhaps you're implementing a new collection type that uses a map as
part of its backend - you could plausibly want to use hinted interop
rather than going through RT, to maximize performance for your new
primitive.

-- 
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: Using Lein with Local Jars on Heroku

2011-12-06 Thread Matjaz Gregoric
As others have noted, keeping jars together with the source is usually not
the best approach... but sometimes it just might be. For those rare
occasions, the instructions on how to do this with leiningen are here:

http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/

Matjaz

On Sat, Aug 6, 2011 at 10:52 PM, Asim Jalis  wrote:

> I am trying to push a Clojure app on Heroku. I have a local jar file
> that the app needs. How can I get lein to use the local jar?
>
> When I have local jar dependencies on my personal machine I just
> install the jar into the local maven repository on the machine. It's
> not obvious to me how to do this on Heroku. Does anyone have any
> experience with this or ideas on how to solve this?
>
> Thanks.
>
> Asim
>
> --
> 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: Defrecord Composition Problem

2011-12-06 Thread tmountain
Eh, nevermind, I refactored things a bit, and I'm happier now. Sorry
for the noise.

; base 
(defrecord Entity [id asset location data])
(defrecord Farmer [entity])

(defn get-entity-by-key
  ([] (fn [this] (:entity this)))
  ([key] (fn [this] (key this

(defprotocol Inspectable
  (inspect [_])
  (get-entity [_]))

(defn base-inspect [this]
  (let [e (get-entity this)]
(println "entity" (:id this) "@" (:location e) (:data e

(def base-behavior {
  :get-entity (fn [this] this)
  :inspect base-inspect
})

(extend Entity
  Inspectable
  base-behavior)

; survival 
(defprotocol Survive
  (find-food [_]))

(defn base-survive [this]
  (let [e (get-entity this)]
(println "entity" (:id e) "looking for food")))

(def survival-behavior {
  :find-food base-survive
})

; farmer 
(extend Farmer
  Inspectable
  (merge base-behavior {:get-entity (get-entity-by-key)})
  Survive survival-behavior)


On Dec 6, 3:08 pm, tmountain  wrote:
> Hi, I'm playing around with protocols and records and trying to
> implement some ad-hoc type composition. I have a solution that works,
> but I want to make it more readable. Specifically, if you look at the
> code below, I'd like to come up with a macro or some other solution to
> eliminate all the calls to (get-this this). Ideally, I could just say
> something like (:id (self)) or something along those lines. The
> reasoning for having a get-this method should become evident as your
> read the code. It's basically an abstraction for calling derived
> behaviors.
>
> (defrecord Entity [id asset location data])
> (defrecord Farmer [entity])
>
> (defprotocol Inspectable
>   (inspect [_])
>   (get-this [_]))
>
> (defprotocol Survive
>   (find-food [_]))
>
> (defn base-inspect [this]
>   (println "entity" (:id this) "@" (:location (get-this this)) (:data
> (get-this this
>
> (def base-behavior {
>   :get-this (fn [this] this)
>   ;:inspect (fn [this] (println "entity" (:id this) "@" (:location
> (get-this this)) (:data (get-this this
>   :inspect base-inspect
>
> })
>
> (extend Entity
>   Inspectable
>   base-behavior)
>
> (def survival-behavior {
>   :find-food (fn [this] (println "entity" (:id (get-this this))
> "looking for food"))
>
> })
>
> (extend Farmer
>   Inspectable
>   (merge base-behavior {:get-this (fn [this] (:entity this))})
>   Survive survival-behavior)
>
> (def thing (Entity. 1 :foo [0, 0] {}))
> (inspect thing)
> (def farmer (Farmer. thing))
> (find-food farmer)

-- 
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: on lisp and scheme macros

2011-12-06 Thread Tassilo Horn
Stephen Compall  writes:

> On Tue, 2011-12-06 at 16:09 +0100, Tassilo Horn wrote:
>> Wikipedia lists syntax-case as hygienic macro system, which would
>> make it less powerful than CL macros, because if that was true, you
>> could not write anaphoric macros with it.
>
> You can write anaphora with syntax-case.  In fact, defmacro itself can
> be defined as a simple syntax-case macro.

Ok, I see.  I'm still keen to see a simple syntax-case example
demonstrating what you simply cannot do with defmacro.

In the mean-time, I've found some post about Racket's macro
implementation:

  http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html

That says the fundamental difference between defmacro and syntax-case
macros is that the latter

  "instead of dealing with plain symbols, you're dealing with these
  syntax values (called “identifiers” in this case) that are essentially
  a symbol and some opaque information that represents the lexical scope
  for its source."

Do I see it correctly that the following Common Lisp defmacro is broken
because of that missing lexical scope?

--8<---cut here---start->8---
* (defun my-plus (&rest xs)
(apply #'+ xs))
MY-PLUS
* (defmacro foo (&rest xs)
`(my-plus ,@xs))
FOO
* (foo 1 2)
3
* (labels ((my-plus (&rest xs)
 (apply #'- xs)))
(foo 1 2))
-1  ;; Ouch! my-plus should not shadow macro expansion internals!
--8<---cut here---end--->8---

Here, the local function `my-place' captures the global definition of
`my-plus'.  First, I've thought I could easily get rid of that issue by
using my-plus's package qualified name, but I was wrong:

--8<---cut here---start->8---
* (defmacro foo (&rest xs)
`(common-lisp-user::my-plus ,@xs))
FOO
* (labels ((my-plus (&rest xs)
 (apply #'- xs)))
(foo 1 2))
-1
--8<---cut here---end--->8---

Am I doing something wrong, or is there no way to avoid that capture in
CL?  (Possibly, CL explicitly forbids rebinding standard CL function
names for exactly that reason.)

That said, in Clojure the example works fine, because everything inside
the macro expansion is qualified.

--8<---cut here---start->8---
user> (defmacro foo [& exps]
`(+ ~@exps))
#'user/foo
user> (foo 1 2)
3
user> (let [+ #(apply - %&)] (foo 1 2))
3
user> (macroexpand '(foo 1 2))
(clojure.core/+ 1 2)
--8<---cut here---end--->8---

And the other way round, passing functions into macros, works also fine.
For example, here the rebound + shadows clojure.core/+, which is clearly
intended.  (Of course, this works fine in CL, too).

--8<---cut here---start->8---
user> (defmacro bar [x & args] `(~x ~@args))
#'user/bar
user> (let [+ #(apply - %&)] (bar + 1 2))
-1
--8<---cut here---end--->8---

Does that mean that Clojure's defmacro is aware of the lexical scope as
well and is therefore equally powerful as Scheme's syntax-case?

Bye,
Tassilo

-- 
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: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-06 Thread Andrew
user> (require 'clojure.set)
nil
user> (set-bp clojure.set/difference)
nil
nil
user> (clojure.set/difference #{1 2} #{2 3})

CDT buffer appears

CDT BreakpointEvent in thread Swank REPL Thread
>From here you can: e/eval, v/show source, s/step, x/next, o/exit func

Restarts:
 0: [QUIT] Quit to the SLIME top level

Backtrace:
  0: clojure.set$difference.invoke(set.clj:48)
  [No Locals]

If I press v and then go to the *Messageages* buffer, I see this:

Source not found; check @source-path
clojure\set.clj - source not found.

-- 
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: clojuredocs REPL client with off-line mode

2011-12-06 Thread Andy Fingerhut
This is still early, but it might be in a form where someone would like to
use it, and I'd appreciate suggestions on what would make it more useful.

It is a fork of the clojuredocs client created by Lee Hinman, with some
additions so that you can either run it in the default "web mode", where it
retrieves results from clojuredocs.org, or you can run it in "local mode",
where it gets results from a snapshot file on your local drive.  The latter
is motivated by off-line use, e.g. you are doing Clojure coding on your
laptop with no Internet access.  Right now this fork is only available via
github:

http://github.com/jafingerhut/cd-client

(use 'cd-client.core)
(doc cdoc)

The help from (doc cdoc) has some examples of use, and gives the name of
the function to switch to local mode.

cdoc currently shows the Clojure doc string, followed by examples,
see-alsos, and comments from clojuredocs.org.  An example of the output for
(cdoc letfn) is appended below, and shouldn't be surprising if you have
used clojuredocs.org before.

Enhancements I'm still planning to make:

+ Currently Clojure 1.2.0 and its contrib libraries are included when doing
searches.  I want to add a way to restrict shown documentation to the
Clojure version being used by the REPL, perhaps with a way to force
showing/searching of documentation for other Clojure versions.

+ Add a way to make cdoc only print a subset of the documentation sources
that it does now, e.g. only the examples, or only the examples and
comments.  There are already functions for printing individual ones of
those, but their names are longer, and perhaps some people might typically
only want to see some of those, not all.

+ Perhaps add other sources of documentation.  Any suggestions there?

+ Bug: A few symbols don't work with the clojuredocs.org API right now, but
only a few (+, /, ., and ..)  That might require changes to the server to
correct.

Andy



Example output:

user=> (cdoc letfn)
-
clojure.core/letfn
  (letfn [fnspecs*] exprs*)
Special Form
  fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)

  Takes a vector of function specs and a body, and generates a set of
  bindings of functions to their names. All of the names are available
  in all of the definitions of the functions, as well as the body.
== vvv Examples 
  user=> (letfn [(twice [x]
   (* x 2))
 (six-times [y]
   (* (twice y) 3))]
   (println "Twice 15 =" (twice 15))
   (println "Six times 15 =" (six-times 15)))
  Twice 15 = 30
  Six times 15 = 90
  nil

  ;; Unable to resolve symbol: twice in this context
  user=> (twice 4)
  ; Evaluation aborted.

  ;; Unable to resolve symbol: six-times in this context
  user=> (six-times 100)
  ; Evaluation aborted.
== ^^^ Examples 
1 example found for clojure.core/letfn

== vvv See also 
  let
== ^^^ See also 
1 see-also found for clojure.core/letfn

== vvv Comments 
  Using `letfn` allows you to create local functions that reference each
  other whereas `(let myfunc #(...)]...)` wouldn't because it executes its
  bindings serially.
== ^^^ Comments 
1 comment found for clojure.core/letfn
nil
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

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-06 Thread Sean Corfield
I just created a new project, replaced project.clj with yours, ran
lein deps then lein swank and in Emacs M-x slime-connect. Following
your step below I was able to view the source of set.clj (and all the
compiler Java files as I walked back up the stack).

I know that's not much help but it might help someone else figure out
how/why your env might differ and why you didn't get source...?

(looks like you're on Windows from clojure\set.clj so that might be a
clue to a difference)

Sean

On Tue, Dec 6, 2011 at 1:38 PM, Andrew  wrote:
> user> (require 'clojure.set)
> nil
> user> (set-bp clojure.set/difference)
> nil
> nil
> user> (clojure.set/difference #{1 2} #{2 3})
>
> CDT buffer appears
>
>
> CDT BreakpointEvent in thread Swank REPL Thread
> From here you can: e/eval, v/show source, s/step, x/next, o/exit func
>
> Restarts:
>  0: [QUIT] Quit to the SLIME top level
>
> Backtrace:
>   0: clojure.set$difference.invoke(set.clj:48)
>   [No Locals]
>
> If I press v and then go to the *Messageages* buffer, I see this:
>
> Source not found; check @source-path
>
> clojure\set.clj - source not found.

-- 
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: on lisp and scheme macros

2011-12-06 Thread Brian Goslinga
> Does that mean that Clojure's defmacro is aware of the lexical scope as
> well and is therefore equally powerful as Scheme's syntax-case?
>
> Bye,
> Tassilo
In my implementation of syntax-rules/syntax-case, I did essentially
the same thing as syntax-quote (had to reimplement it as there is no
programmatic interface for it as far as I'm aware), and it seemed to
work fine.

Brian

-- 
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: Surprising behavior with clojure.core/int (and probably other primitive integer functions)

2011-12-06 Thread Cedric Greevey
Thanks. I think this is an area where there will hopefully be a bit more
polish in 1.4. Particularly regarding cleanly wrapping code in unchecked
on/off ... though a function that just amounts to #(.intValue ^Number %)
would save everyone writing such closures over and over again when they
need a non-exploding version of (map int foo) ...

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

let-else macro

2011-12-06 Thread Evan Gamble
I noticed in my code that I often nest a let inside an if-let, or vice-
versa, so I wrote a macro let-else that expands into nested lets,
except where there's an :else  after a binding, in which case
that binding expands into an if-let.

E.g.

(let-else
  [foo (f1) :else (e)
   bar (f2)]
  (b1)
  (b2))

expands into

(if-let [foo (f1)]
  (let [bar (f2)]
(b1)
(b2))
  (e))

The jar is at https://clojars.org/org.clojars.egamble/let-else
The code is at https://github.com/egamble/let-else

- Evan

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


Quartz and Clojure

2011-12-06 Thread Jimmy
Hi,
Is there any know Clojure wrapper for the Quartz scheduling service?
thanks,
Jimmy

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


Building Clojure applications w/ Maven

2011-12-06 Thread Riccardo
Hello, I am doing my dissertation project with Clojure and I am using
Maven to build. It works on REPL and it build successfully, but the
JAR file doesn't work, it says: "Java Exception" all the time. Any
suggestion?

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


clojurescript on windows (how create goog.jar)...Noob question

2011-12-06 Thread ron
hi everybody...I'm trying install clojurescript on windows...I'm
follow the steps but I'm not sure with this specific step:

Create a goog.jar file and copy to lib

cd closure\library\closure
jar cf goog.jar goog
copy goog.jar ..\..\..\lib


now..I've downloaded clojure, closure and the closure compiler...and
in any folder I've a path like "closure\library
\closure"...actually..I'vent any .jar except the compiler.jar inside
the compiler-latestfor create this file I think I must be inside a
folder with some .jar...where is this folder?...

I don't know but I feel than these steps are very mechanics and maybe
a script than download all packages or something like this would be
usefull for noobs users.



thanks so much

-- 
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: Building Clojure applications w/ Maven

2011-12-06 Thread Richard Lyman
Can you provide the pom you're using?

By 'build' do you mean AOT?

-Rich



On Tue, Dec 6, 2011 at 3:35 PM, Riccardo  wrote:
> Hello, I am doing my dissertation project with Clojure and I am using
> Maven to build. It works on REPL and it build successfully, but the
> JAR file doesn't work, it says: "Java Exception" all the time. Any
> suggestion?
>
> --
> 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: let-else macro

2011-12-06 Thread Sam Ritchie
I had a pattern that kept popping up in code of:

(let [x (foo)
  y  (bar)]
(when y
   (let [ ]
   )))

that check jarred me, so I put this together:
https://gist.github.com/1347312. On reflection, discomfort with indentation
levels probably isn't near the top of the "to macro or not to macro?"
checklist.

(defmacro let?
[bindings & body]
 (let [[bind [kwd pred & more]] (split-with (complement #{:ensure})
bindings)]
`(let [~@bind]
 ~@(cond (and kwd more) [`(when ~pred (check-let [~@more] ~@body))]
kwd [`(when ~pred ~@body)]
 :else body

(let? [x 100
y 300
 :ensure (pos? y)
z (- y 250)]
 z)

;; expands to

(let [x 100
y 300]
 (when (pos? y)
(let [z (- y 250)]
 z))) ;; => 50

;; and returns 50. The following returns nil:

(let? [x 100

   y 300

   :ensure (neg? y)

   z (- y 250)]
  z) ;; => nil


On Tue, Dec 6, 2011 at 11:51 AM, Evan Gamble  wrote:

> I noticed in my code that I often nest a let inside an if-let, or vice-
> versa, so I wrote a macro let-else that expands into nested lets,
> except where there's an :else  after a binding, in which case
> that binding expands into an if-let.
>
> E.g.
>
> (let-else
>  [foo (f1) :else (e)
>   bar (f2)]
>  (b1)
>  (b2))
>
> expands into
>
> (if-let [foo (f1)]
>  (let [bar (f2)]
>(b1)
>(b2))
>  (e))
>
> The jar is at https://clojars.org/org.clojars.egamble/let-else
> The code is at https://github.com/egamble/let-else
>
> - Evan
>
> --
> 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




-- 
Sam Ritchie, Twitter Inc
703.662.1337
@sritchie09

(Too brief? Here's why! http://emailcharter.org)

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

Re: swank-cdt: Using Slime with the Clojure Debugging Toolkit

2011-12-06 Thread Andrew
Thanks for taking the time Sean! You're right...

   - I'm on Windows XP
   - I had to copy tools.jar to my projects lib manually after lein deps 
   (not sure how to change the classpath)
   - My emacs setup is munged -- I can run M-x eshell but not M-x shell; I 
   have to do lein swank and M-x slime-connect because I can't M-x 
   clojure-jack-in

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

thank you, clojure hackers

2011-12-06 Thread Craig Brozefsky

I'm about to deploy the first version of a tool I wrote in Clojure, and
I wanted to send out a "thank you" to all the Clojure devs, and the
community that produced this environment, including the packages I'm
using, including the following packages: tools.logging, tools.cli,
data.json, clojure-csv, core.logic, ring, compojure, lein, and swank.

You make this old Common Lisp hacker happy.

-- 
Craig Brozefsky 
Premature reification is the root of all evil

-- 
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: thank you, clojure hackers

2011-12-06 Thread Ambrose Bonnaire-Sergeant
What are you making?

Ambrose

On Wed, Dec 7, 2011 at 11:19 AM, Craig Brozefsky  wrote:

>
> I'm about to deploy the first version of a tool I wrote in Clojure, and
> I wanted to send out a "thank you" to all the Clojure devs, and the
> community that produced this environment, including the packages I'm
> using, including the following packages: tools.logging, tools.cli,
> data.json, clojure-csv, core.logic, ring, compojure, lein, and swank.
>
> You make this old Common Lisp hacker happy.
>
> --
> Craig Brozefsky 
> Premature reification is the root of all evil
>
> --
> 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

getting inside another dynamic scope?

2011-12-06 Thread Andrew
Is there a way (without swank-cdt) to get inside some other dynamic scope 
that's blocked in order to evaluate some arbitrary code? Let's say a thread 
has paused waiting for some UI input. Earlier a dynamic var binding 
happened. You know the name of that var ...  you know that thread is 
waiting ... you want to get at the value inside that binding... and either 
swank-cdt doesn't yet work in your environment or you didn't set a 
breakpoint. Is it possible to get at it? Or is that just too shady?

Since I'm not interested in concurrency I could go the ugly way and see 
what happens if I use def instead of binding. Ugly is always at my right 
hand.

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

no :main namespace specified in project.clj

2011-12-06 Thread jayvandal
I tried to run sqlitetest project in lein.I get this error

no :main namespace specified in project.clj
Why would i get an error in  an example?
I first run lein deps.
Then i run lein run
then comes error??

-- 
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: on lisp and scheme macros

2011-12-06 Thread Jose A. Ortega Ruiz

Hi Tassilo,

On Tue, Dec 06 2011, Tassilo Horn wrote:

> "Jose A. Ortega Ruiz"  writes:
>
> Hi Jose,
>
>>> I think that Common Lisp macros are, strictly speaking, more powerful
>>> than Scheme macros, but I don't have a citation.
>>
>> That's only true for syntax-rules macros.  syntax-case macros, which
>> most schemes provide and are required by R6RS, are, strictly speaking,
>> more powerful than CL macros.
>
> I don't know scheme macros, so could you please explain why they are
> more powerful?  What can you do with a syntax-case macro what you cannot
> do with a Common Lisp (or Clojure) macro?

In general, syntax-case lets you manipulate first-class syntax objects,
whereby all kind of neat tricks are possible out of the box.  You gain
in expressivity.  This is a good overview:

  http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html

> Wikipedia lists syntax-case as hygienic macro system, which would make
> it less powerful than CL macros, because if that was true, you could not
> write anaphoric macros with it.

It's hygienic by default, but offers ways of breaking hygiene.  As a
matter of fact, it's possible to define defmacro using syntax-case (see, e.g.,
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2007-March/001195.html),
and then you can use defmacro in Scheme too :)

It's also possible to implement hygiene on top of defmacro (with the
help of CLOS's symbol-macrolet:
http://www.p-cos.net/documents/hygiene.pdf), but it's much more
convoluted (and, IIRC, some of the syntax API is still missing in that
long paper).

Even if you don't buy the expressivity argument, i think we can agree
that syntax-case macros are, at least, as powerful as CL macros.

Cheers,
jao
--
Humans think they are smarter than dolphins because we build cars and
buildings and start wars etc., and all that dolphins do is swim in the
water, eat fish and play around. Dolphins believe that they are
smarter for exactly the same reasons. -Douglas Adams

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


Counterclockwise nREPL multiple commands

2011-12-06 Thread jlhouchin
Hello,

As I work through the Programming Clojure book, I play with the code I
enter into the REPL.
I just want to say that I am infinitely enjoying using the REPL in
Counterclockwise. It does make multi-line code so much nicer.

I entered this.
(defn whole-numbers [] (iterate inc 1))
(take 10 (for [n (whole-numbers) :when (> 100 n)] n))

As expected it outputs the desired results.
This is after my first experiment which ended in putting the REPL into
an infinite loop which required force quitting.

(take 10 (for [n (whole-numbers) :when (> 10 n)] n))

As I had enter the above in a REPL that I had to quit. I tried it
again after entering the successful command at the top. And I wondered
why this one was infinite. Then I noticed that I had a (take 10 ...)
which would never be satisfied and seq which was infinite and never
cease iterating.

So while I was watching the REPL churn up one of my two cores, I had a
thought. I re-entered the successful command again. And the REPL took
it and executed it just fine.

I continued for a while executing both the infinite and finite
versions of the above into the REPL. It just kept on going. It took
all the cpu I could give, but kept going. At some point it ran out of
resources and exited. This was not unexpected by me.

Awesome job guys.

Now that I had my perverse pleasure. Is there a way to force quit a
command/job rather than the REPL?

Thanks again for a totally awesome tool and language.

Jimmie

-- 
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: on lisp and scheme macros

2011-12-06 Thread Tassilo Horn
"Jose A. Ortega Ruiz"  writes:

Hi Jose,

>> I don't know scheme macros, so could you please explain why they are
>> more powerful?  What can you do with a syntax-case macro what you
>> cannot do with a Common Lisp (or Clojure) macro?
>
> In general, syntax-case lets you manipulate first-class syntax
> objects, whereby all kind of neat tricks are possible out of the box.
> You gain in expressivity.  This is a good overview:
>
>   http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html

See my last post. ;-)

> It's also possible to implement hygiene on top of defmacro (with the
> help of CLOS's symbol-macrolet:
> http://www.p-cos.net/documents/hygiene.pdf), but it's much more
> convoluted (and, IIRC, some of the syntax API is still missing in that
> long paper).

Would that solve the issue I've broad up in my last post, where the
`foo' macro expansion uses the local `my-plus' definition instead of the
global one?

If I'm not doing anything wrong there, then that effectively would mean
that you cannot guarantee that a CL macro does what it should as soon as
it uses anything that's not defined in the COMMON-LISP package (because
those things mustn't be rebound).  In that case, I'd even by the
powerfulness argument.

> Even if you don't buy the expressivity argument, i think we can agree
> that syntax-case macros are, at least, as powerful as CL macros.

Sure, I'm not trying to argument in favour of either one.  I'm just
interested in the differences.

Bye,
Tassilo

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