Re: Getting started with lein-cljsbuild

2012-04-19 Thread Evan Mezeske
That's great news that you got it to work.  I can't make any sense of the 
stack trace you're seeing with "lein deps", though, unfortunately.

Other than installation, does the plugin seem to work (e.g. "lein cljsbuild 
once", etc)?  I haven't tested it under Windows myself, and people have had 
trouble with it in the past (albeit with older versions of the plugin).

-Evan

On Wednesday, April 18, 2012 10:32:11 PM UTC-7, puzzler wrote:
>
> I was able to get the plugin working by typing the following at the 
> command-line (rather than using lein deps):
> C:\temp\cljstest>lein plugin install lein-cljsbuild 0.1.8
>
>

-- 
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: Getting started with lein-cljsbuild

2012-04-19 Thread Mark Engelberg
Yes, I've only tested "lein cljsbuild once", but it worked just fine once I
figured out the alternative way to get the plugin installed.

On Thu, Apr 19, 2012 at 12:03 AM, Evan Mezeske  wrote:

> That's great news that you got it to work.  I can't make any sense of the
> stack trace you're seeing with "lein deps", though, unfortunately.
>
> Other than installation, does the plugin seem to work (e.g. "lein
> cljsbuild once", etc)?  I haven't tested it under Windows myself, and
> people have had trouble with it in the past (albeit with older versions of
> the plugin).
>
> -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

ClojureCLR on .net compact?

2012-04-19 Thread David Jagoe
Hi all,

Does anyone know whether I can run ClojureCLR on .net compact?
Specifically I would need to run it on Windows CE. Currently the
application is written in C# which works ok, but I need to rewrite it
and I'm deciding between C#, F# and ClojureCLR.

Thanks,
David

-- 
David Jagoe

davidja...@gmail.com
+447535268218

-- 
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: Getting started with lein-cljsbuild

2012-04-19 Thread Mark Engelberg
Unfortunately, "lein trampoline cljsbuild repl-rhino" (and all the
trampoline tasks)
generates the same error that I got when I tried to run lein deps.



On Thu, Apr 19, 2012 at 12:18 AM, Mark Engelberg
wrote:

> Yes, I've only tested "lein cljsbuild once", but it worked just fine once
> I figured out the alternative way to get the plugin installed.
>
>
> On Thu, Apr 19, 2012 at 12:03 AM, Evan Mezeske  wrote:
>
>> That's great news that you got it to work.  I can't make any sense of the
>> stack trace you're seeing with "lein deps", though, unfortunately.
>>
>> Other than installation, does the plugin seem to work (e.g. "lein
>> cljsbuild once", etc)?  I haven't tested it under Windows myself, and
>> people have had trouble with it in the past (albeit with older versions of
>> the plugin).
>>
>> -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

Re: a library I'm working on for generating PDFs from Clojure

2012-04-19 Thread David Jagoe
Hi Dmitri,

This is great, thanks!

I have a system where I need to render web reports to nicely formatted
PDFs. Currently I maintain separate HTML and TeX templates for this
purpose (in a Python system) but wanted to have a system that allows
me to write hiccup once and have it output HTML & PDF reports. I see
that you've used the hiccup syntax but obviously your "tags" are
different because screen and print media have different nature. I
suppose it would be possible for me to write HTML-hiccup and have a
translator that writes pdf-hiccup subset that contains the same
content. Or maybe the other way around - write pdf-hiccup and
translate to html-hiccup. Do you have an idea of which would be
better? I.e. which has richer semantics that could be dropped during
translation?


Thanks!
David

2012/4/19 Vinzent :
> Thank you, I was looking for something exactly like that! I'll give it a
> try.
>
> четверг, 19 апреля 2012 г., 7:34:10 UTC+6 пользователь Dmitri написал:
>>
>> I poked around and noticed that there aren't any libraries for
>> creating PDFs, and as I needed to make one for work I decided to open
>> source it. I tried to follow Hiccup syntax as I find it to be nice and
>> flexible.
>>
>> https://github.com/yogthos/clj-pdf
>>
>> The library piggy backs on iText 2.1.7 (the last LGPL release) and
>> JFreeChart, it's able to generate documents with text formatting,
>> lists, tables, and charts.
>>
>> I've also made a proof of concept service which accepts JSON formatted
>> text and serves up PDFs that's built on top of it.
>>
>> https://github.com/yogthos/instant-pdf
>>
>> Feedback and suggestions are welcome.
>
> --
> 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



-- 
David Jagoe

davidja...@gmail.com
+447535268218

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


Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
I'm trying to get some Clojure code to compile to javascript.

So I've got a clojurescript repl up and running, and I was hoping it would
be a straightforward iterative process of:
Compile code.
Test code.
Get detailed bug (or at least a line number) if I used a feature not
available in clojurescript (e.g., letfn).
Change code.
Repeat.

Unfortunately, it seems that all I get when code doesn't work under
clojurescript is stuff like this:
org.mozilla.javascript.EcmaError: TypeError: Cannot call method "call" of
undefined (#52)
at :52 (anonymous)
at :52

I've got nothing to work with, other than this generic report that
(presumably because the compilation failed), the function remains undefined.

So what's the trick for converting code and/or for getting some kind of
meaningful error message in clojurescript?

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: Getting started with lein-cljsbuild

2012-04-19 Thread Chris Perkins
On Thursday, April 19, 2012 3:03:53 AM UTC-4, Evan Mezeske wrote:
>
> That's great news that you got it to work.  I can't make any sense of the 
> stack trace you're seeing with "lein deps", though, unfortunately.
>
> Other than installation, does the plugin seem to work (e.g. "lein 
> cljsbuild once", etc)?  I haven't tested it under Windows myself, and 
> people have had trouble with it in the past (albeit with older versions of 
> the plugin).
>
>>
>> On Windows,  "Could not find the main class: and." invariably means that 
a classpath was not quoted somewhere - the "and" being from "Documents and 
Settings".

eg: java -cp C:\Documents and Settings\username\.lein\plugins... etc

- 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

Re: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
clojurescript is still pretty young. Error reporting is not where I expect 
most people would like to see it. This is a problem for all languages 
complied to js at the moment.

That said - you can get used to the situation pretty quickly, with a little 
patience and the occasional challenge.

If you compile with pretty printing or simple optimisations - the code is 
relatively readable. At least enough to reference back to your source.

If I have errors, I use the stacktrace which you can access easily in 
chrome for example to get my bearing and figure out what is going on.

As I say, not Ideal - but you do get used to it pretty fast.

I also use logging to trace activity if necessary.

The above error is probably where you have used a variable which is 
undefined as a function.

Cheers

Dave





On Thursday, 19 April 2012 19:55:40 UTC+10, puzzler wrote:
>
> I'm trying to get some Clojure code to compile to javascript.
>
> So I've got a clojurescript repl up and running, and I was hoping it would 
> be a straightforward iterative process of:
> Compile code.
> Test code.
> Get detailed bug (or at least a line number) if I used a feature not 
> available in clojurescript (e.g., letfn).
> Change code.
> Repeat.
>
> Unfortunately, it seems that all I get when code doesn't work under 
> clojurescript is stuff like this:
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method "call" of 
> undefined (#52)
> at :52 (anonymous)
> at :52
>
> I've got nothing to work with, other than this generic report that 
> (presumably because the compilation failed), the function remains undefined.
>
> So what's the trick for converting code and/or for getting some kind of 
> meaningful error message in clojurescript?
>
> 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: a library I'm working on for generating PDFs from Clojure

2012-04-19 Thread Dmitri
It should be pretty easy to map some basic Hiccup tags to this,
headings, paragraphs, lists, and tables, etc. I suspect it's probably
easier to go the hiccup->pdf route, as you could simply ignore the
html tags that aren't applicable.


On Apr 19, 4:45 am, David Jagoe  wrote:
> Hi Dmitri,
>
> This is great, thanks!
>
> I have a system where I need to render web reports to nicely formatted
> PDFs. Currently I maintain separate HTML and TeX templates for this
> purpose (in a Python system) but wanted to have a system that allows
> me to write hiccup once and have it output HTML & PDF reports. I see
> that you've used the hiccup syntax but obviously your "tags" are
> different because screen and print media have different nature. I
> suppose it would be possible for me to write HTML-hiccup and have a
> translator that writes pdf-hiccup subset that contains the same
> content. Or maybe the other way around - write pdf-hiccup and
> translate to html-hiccup. Do you have an idea of which would be
> better? I.e. which has richer semantics that could be dropped during
> translation?
>
> Thanks!
> David
>
> 2012/4/19 Vinzent :
>
>
>
>
>
>
>
>
>
> > Thank you, I was looking for something exactly like that! I'll give it a
> > try.
>
> > ÞÅÔ×ÅÒÇ, 19 ÁÐÒÅÌÑ 2012šÇ., 7:34:10 UTC+6 ÐÏÌØÚÏ×ÁÔÅÌØ Dmitri ÎÁÐÉÓÁÌ:
>
> >> I poked around and noticed that there aren't any libraries for
> >> creating PDFs, and as I needed to make one for work I decided to open
> >> source it. I tried to follow Hiccup syntax as I find it to be nice and
> >> flexible.
>
> >>https://github.com/yogthos/clj-pdf
>
> >> The library piggy backs on iText 2.1.7 (the last LGPL release) and
> >> JFreeChart, it's able to generate documents with text formatting,
> >> lists, tables, and charts.
>
> >> I've also made a proof of concept service which accepts JSON formatted
> >> text and serves up PDFs that's built on top of it.
>
> >>https://github.com/yogthos/instant-pdf
>
> >> Feedback and suggestions are welcome.
>
> > --
> > 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
>
> --
> David Jagoe
>
> davidja...@gmail.com
> +447535268218

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
Additionally, if you are using the repl to experiment, you may benefit from 
defining and testing each bit as you go.

On Thursday, 19 April 2012 21:59:03 UTC+10, Dave Sann wrote:
>
> clojurescript is still pretty young. Error reporting is not where I expect 
> most people would like to see it. This is a problem for all languages 
> complied to js at the moment.
>
> That said - you can get used to the situation pretty quickly, with a 
> little patience and the occasional challenge.
>
> If you compile with pretty printing or simple optimisations - the code is 
> relatively readable. At least enough to reference back to your source.
>
> If I have errors, I use the stacktrace which you can access easily in 
> chrome for example to get my bearing and figure out what is going on.
>
> As I say, not Ideal - but you do get used to it pretty fast.
>
> I also use logging to trace activity if necessary.
>
> The above error is probably where you have used a variable which is 
> undefined as a function.
>
> Cheers
>
> Dave
>
>
>
>
>
> On Thursday, 19 April 2012 19:55:40 UTC+10, puzzler wrote:
>>
>> I'm trying to get some Clojure code to compile to javascript.
>>
>> So I've got a clojurescript repl up and running, and I was hoping it 
>> would be a straightforward iterative process of:
>> Compile code.
>> Test code.
>> Get detailed bug (or at least a line number) if I used a feature not 
>> available in clojurescript (e.g., letfn).
>> Change code.
>> Repeat.
>>
>> Unfortunately, it seems that all I get when code doesn't work under 
>> clojurescript is stuff like this:
>> org.mozilla.javascript.EcmaError: TypeError: Cannot call method "call" of 
>> undefined (#52)
>> at :52 (anonymous)
>> at :52
>>
>> I've got nothing to work with, other than this generic report that 
>> (presumably because the compilation failed), the function remains undefined.
>>
>> So what's the trick for converting code and/or for getting some kind of 
>> meaningful error message in clojurescript?
>>
>> 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

[ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
Eastwood[1] is a Clojure lint tool which uses the analyze[2] library to 
inspect
namespaces and report possible problems. Currently it should work
with projects running Clojure 1.3.0 and newer.

Currently eastwood warns when it finds 
- deprecated java instance methods, static fields, static methods and 
constructors
- deprecated clojure vars
- unused function arguments
- unused private vars
- reflection
- naked (:use ...)
- misplaced docstrings
- keyword typos

I appreciate bug reports and feature requests and I also hope you find it 
useful!

Jonas

[1] https://github.com/jonase/eastwood
[2] https://github.com/frenchy64/analyze

-- 
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] Eastwood - A Clojure lint tool

2012-04-19 Thread Stefan Kamphausen

inc for the 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: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Ambrose Bonnaire-Sergeant
Did I do something wrong?

ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install
jonase/eastwood 0.0.1

ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein version
Leiningen 1.7.1 on Java 1.6.0_23 OpenJDK Client VM
ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein eastwood
Exception in thread "main" java.io.FileNotFoundException: Could not locate
leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:
 (eastwood.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.load(Compiler.java:5857)
at clojure.lang.RT.loadResourceScript(RT.java:340)
at clojure.lang.RT.loadResourceScript(RT.java:331)
at clojure.lang.RT.load(RT.java:409)
at clojure.lang.RT.load(RT.java:381)
at clojure.core$load$fn__4519.invoke(core.clj:4915)
at clojure.core$load.doInvoke(core.clj:4914)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:4729)
at clojure.core$load_lib.doInvoke(core.clj:4766)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$load_libs.doInvoke(core.clj:4800)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$require.doInvoke(core.clj:4881)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at leiningen.core$resolve_task.invoke(core.clj:208)
at leiningen.core$apply_task.invoke(core.clj:258)
at leiningen.core$_main.doInvoke(core.clj:329)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval42.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate
leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:
at clojure.lang.RT.load(RT.java:412)
at clojure.lang.RT.load(RT.java:381)
at clojure.core$load$fn__4519.invoke(core.clj:4915)
at clojure.core$load.doInvoke(core.clj:4914)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:4729)
at clojure.core$load_lib.doInvoke(core.clj:4766)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$load_libs.doInvoke(core.clj:4800)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:544)
at clojure.core$use.doInvoke(core.clj:4892)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at
leiningen.eastwood$eval68$loading__4414__auto69.invoke(eastwood.clj:1)
at leiningen.eastwood$eval68.invoke(eastwood.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 39 more

On Thu, Apr 19, 2012 at 9:04 PM, Jonas  wrote:

> Eastwood[1] is a Clojure lint tool which uses the analyze[2] library to
> inspect
> namespaces and report possible problems. Currently it should work
> with projects running Clojure 1.3.0 and newer.
>
> Currently eastwood warns when it finds
> - deprecated java instance methods, static fields, static methods and
> constructors
> - deprecated clojure vars
> - unused function arguments
> - unused private vars
> - reflection
> - naked (:use ...)
> - misplaced docstrings
> - keyword typos
>
> I appreciate bug reports and feature requests and I also hope you find it
> useful!
>
> Jonas
>
> [1] https://github.com/jonase/eastwood
> [2] https://github.com/frenchy64/analyze
>
> --
> 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: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Baishampayan Ghose
On Thu, Apr 19, 2012 at 6:34 PM, Jonas  wrote:
> Eastwood[1] is a Clojure lint tool which uses the analyze[2] library to
> inspect
> namespaces and report possible problems. Currently it should work
> with projects running Clojure 1.3.0 and newer.
>
> Currently eastwood warns when it finds
> - deprecated java instance methods, static fields, static methods and
> constructors
> - deprecated clojure vars
> - unused function arguments
> - unused private vars
> - reflection
> - naked (:use ...)
> - misplaced docstrings
> - keyword typos
>
> I appreciate bug reports and feature requests and I also hope you find it
> useful!

This is simply awesome! Will try it out and let you know.

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

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


Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Baishampayan Ghose
I got exactly the same error.

Regards,
BG

On Thu, Apr 19, 2012 at 6:54 PM, Ambrose Bonnaire-Sergeant
 wrote:
> Did I do something wrong?
>
> ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install
> jonase/eastwood 0.0.1
> 
> ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein version
> Leiningen 1.7.1 on Java 1.6.0_23 OpenJDK Client VM
> ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein eastwood
> Exception in thread "main" java.io.FileNotFoundException: Could not locate
> leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:
>  (eastwood.clj:1)
> at clojure.lang.Compiler.eval(Compiler.java:5440)
> at clojure.lang.Compiler.eval(Compiler.java:5415)
> at clojure.lang.Compiler.load(Compiler.java:5857)
> at clojure.lang.RT.loadResourceScript(RT.java:340)
> at clojure.lang.RT.loadResourceScript(RT.java:331)
> at clojure.lang.RT.load(RT.java:409)
> at clojure.lang.RT.load(RT.java:381)
> at clojure.core$load$fn__4519.invoke(core.clj:4915)
> at clojure.core$load.doInvoke(core.clj:4914)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:4729)
> at clojure.core$load_lib.doInvoke(core.clj:4766)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invoke(core.clj:542)
> at clojure.core$load_libs.doInvoke(core.clj:4800)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.core$apply.invoke(core.clj:542)
> at clojure.core$require.doInvoke(core.clj:4881)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at leiningen.core$resolve_task.invoke(core.clj:208)
> at leiningen.core$apply_task.invoke(core.clj:258)
> at leiningen.core$_main.doInvoke(core.clj:329)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$_main.invoke(core.clj:332)
> at user$eval42.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:5424)
> at clojure.lang.Compiler.eval(Compiler.java:5391)
> at clojure.core$eval.invoke(core.clj:2382)
> at clojure.main$eval_opt.invoke(main.clj:235)
> at clojure.main$initialize.invoke(main.clj:254)
> at clojure.main$script_opt.invoke(main.clj:270)
> at clojure.main$main.doInvoke(main.clj:354)
> at clojure.lang.RestFn.invoke(RestFn.java:457)
> at clojure.lang.Var.invoke(Var.java:377)
> at clojure.lang.AFn.applyToHelper(AFn.java:172)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.main.main(main.java:37)
> Caused by: java.io.FileNotFoundException: Could not locate
> leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:
> at clojure.lang.RT.load(RT.java:412)
> at clojure.lang.RT.load(RT.java:381)
> at clojure.core$load$fn__4519.invoke(core.clj:4915)
> at clojure.core$load.doInvoke(core.clj:4914)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:4729)
> at clojure.core$load_lib.doInvoke(core.clj:4766)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invoke(core.clj:542)
> at clojure.core$load_libs.doInvoke(core.clj:4800)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.core$apply.invoke(core.clj:544)
> at clojure.core$use.doInvoke(core.clj:4892)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at
> leiningen.eastwood$eval68$loading__4414__auto69.invoke(eastwood.clj:1)
> at leiningen.eastwood$eval68.invoke(eastwood.clj:1)
> at clojure.lang.Compiler.eval(Compiler.java:5424)
> ... 39 more
>
> On Thu, Apr 19, 2012 at 9:04 PM, Jonas  wrote:
>>
>> Eastwood[1] is a Clojure lint tool which uses the analyze[2] library to
>> inspect
>> namespaces and report possible problems. Currently it should work
>> with projects running Clojure 1.3.0 and newer.
>>
>> Currently eastwood warns when it finds
>> - deprecated java instance methods, static fields, static methods and
>> constructors
>> - deprecated clojure vars
>> - unused function arguments
>> - unused private vars
>> - reflection
>> - naked (:use ...)
>> - misplaced docstrings
>> - keyword typos
>>
>> I appreciate bug reports and feature requests and I also hope you find it
>> useful!
>>
>> Jonas
>>
>> [1] https://github.com/jonase/eastwood
>> [2] https://github.com/frenchy64/analyze
>>
>> --
>> 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 

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jay Fields
same outcome for me.

On Thu, Apr 19, 2012 at 9:24 AM, Ambrose Bonnaire-Sergeant
 wrote:
> Did I do something wrong?
>
> ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install
> jonase/eastwood 0.0.1
> 
> ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein version
> Leiningen 1.7.1 on Java 1.6.0_23 OpenJDK Client VM
> ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein eastwood
> Exception in thread "main" java.io.FileNotFoundException: Could not locate
> leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:
>  (eastwood.clj:1)
> at clojure.lang.Compiler.eval(Compiler.java:5440)
> at clojure.lang.Compiler.eval(Compiler.java:5415)
> at clojure.lang.Compiler.load(Compiler.java:5857)
> at clojure.lang.RT.loadResourceScript(RT.java:340)
> at clojure.lang.RT.loadResourceScript(RT.java:331)
> at clojure.lang.RT.load(RT.java:409)
> at clojure.lang.RT.load(RT.java:381)
> at clojure.core$load$fn__4519.invoke(core.clj:4915)
> at clojure.core$load.doInvoke(core.clj:4914)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:4729)
> at clojure.core$load_lib.doInvoke(core.clj:4766)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invoke(core.clj:542)
> at clojure.core$load_libs.doInvoke(core.clj:4800)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.core$apply.invoke(core.clj:542)
> at clojure.core$require.doInvoke(core.clj:4881)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at leiningen.core$resolve_task.invoke(core.clj:208)
> at leiningen.core$apply_task.invoke(core.clj:258)
> at leiningen.core$_main.doInvoke(core.clj:329)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$_main.invoke(core.clj:332)
> at user$eval42.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:5424)
> at clojure.lang.Compiler.eval(Compiler.java:5391)
> at clojure.core$eval.invoke(core.clj:2382)
> at clojure.main$eval_opt.invoke(main.clj:235)
> at clojure.main$initialize.invoke(main.clj:254)
> at clojure.main$script_opt.invoke(main.clj:270)
> at clojure.main$main.doInvoke(main.clj:354)
> at clojure.lang.RestFn.invoke(RestFn.java:457)
> at clojure.lang.Var.invoke(Var.java:377)
> at clojure.lang.AFn.applyToHelper(AFn.java:172)
> at clojure.lang.Var.applyTo(Var.java:482)
> at clojure.main.main(main.java:37)
> Caused by: java.io.FileNotFoundException: Could not locate
> leiningen/core/eval__init.class or leiningen/core/eval.clj on classpath:
> at clojure.lang.RT.load(RT.java:412)
> at clojure.lang.RT.load(RT.java:381)
> at clojure.core$load$fn__4519.invoke(core.clj:4915)
> at clojure.core$load.doInvoke(core.clj:4914)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at clojure.core$load_one.invoke(core.clj:4729)
> at clojure.core$load_lib.doInvoke(core.clj:4766)
> at clojure.lang.RestFn.applyTo(RestFn.java:142)
> at clojure.core$apply.invoke(core.clj:542)
> at clojure.core$load_libs.doInvoke(core.clj:4800)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.core$apply.invoke(core.clj:544)
> at clojure.core$use.doInvoke(core.clj:4892)
> at clojure.lang.RestFn.invoke(RestFn.java:408)
> at
> leiningen.eastwood$eval68$loading__4414__auto69.invoke(eastwood.clj:1)
> at leiningen.eastwood$eval68.invoke(eastwood.clj:1)
> at clojure.lang.Compiler.eval(Compiler.java:5424)
> ... 39 more
>
> On Thu, Apr 19, 2012 at 9:04 PM, Jonas  wrote:
>>
>> Eastwood[1] is a Clojure lint tool which uses the analyze[2] library to
>> inspect
>> namespaces and report possible problems. Currently it should work
>> with projects running Clojure 1.3.0 and newer.
>>
>> Currently eastwood warns when it finds
>> - deprecated java instance methods, static fields, static methods and
>> constructors
>> - deprecated clojure vars
>> - unused function arguments
>> - unused private vars
>> - reflection
>> - naked (:use ...)
>> - misplaced docstrings
>> - keyword typos
>>
>> I appreciate bug reports and feature requests and I also hope you find it
>> useful!
>>
>> Jonas
>>
>> [1] https://github.com/jonase/eastwood
>> [2] https://github.com/frenchy64/analyze
>>
>> --
>> 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

Re: [ANN] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas


On Thursday, April 19, 2012 4:24:16 PM UTC+3, Ambrose Bonnaire-Sergeant 
wrote:
>
> Did I do something wrong?
>

Sorry, I only tested in with lein2. I'll try to make it work with both in 
the next release.
 

-- 
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: ClojureCLR on .net compact?

2012-04-19 Thread dmiller
I believe that Reflection.Emit is not available in .Net Compact Framework. 
 This is essential for the ClojureCLR.  This also prevents DLR-based 
languages such as IronPython from running on .Net CF.

-David


On Thursday, April 19, 2012 3:11:02 AM UTC-5, David Jagoe wrote:
>
> Hi all,
>
> Does anyone know whether I can run ClojureCLR on .net compact?
> Specifically I would need to run it on Windows CE. Currently the
> application is written in C# which works ok, but I need to rewrite it
> and I'm deciding between C#, F# and ClojureCLR.
>
> Thanks,
> David
>
> -- 
> David Jagoe
>
> davidja...@gmail.com
> +447535268218
>
>

-- 
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: ClojureCLR on .net compact?

2012-04-19 Thread David Jagoe
Ok, thanks David.

On 19 April 2012 15:53, dmiller  wrote:
> I believe that Reflection.Emit is not available in .Net Compact Framework.
>  This is essential for the ClojureCLR.  This also prevents DLR-based
> languages such as IronPython from running on .Net CF.
>
> -David
>
>
> On Thursday, April 19, 2012 3:11:02 AM UTC-5, David Jagoe wrote:
>>
>> Hi all,
>>
>> Does anyone know whether I can run ClojureCLR on .net compact?
>> Specifically I would need to run it on Windows CE. Currently the
>> application is written in C# which works ok, but I need to rewrite it
>> and I'm deciding between C#, F# and ClojureCLR.
>>
>> Thanks,
>> David
>>
>> --
>> David Jagoe
>>
>> davidja...@gmail.com
>> +447535268218
>
> --
> 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



-- 
David Jagoe

davidja...@gmail.com
+447535268218

-- 
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: ClojureCLR on .net compact?

2012-04-19 Thread Timothy Baldridge
If you AOT compile the ClojureCLR code, will it still depend on Reflection.Emit?

Timothy

On Thu, Apr 19, 2012 at 11:10 AM, David Jagoe  wrote:
> Ok, thanks David.
>
> On 19 April 2012 15:53, dmiller  wrote:
>> I believe that Reflection.Emit is not available in .Net Compact Framework.
>>  This is essential for the ClojureCLR.  This also prevents DLR-based
>> languages such as IronPython from running on .Net CF.
>>
>> -David
>>
>>
>> On Thursday, April 19, 2012 3:11:02 AM UTC-5, David Jagoe wrote:
>>>
>>> Hi all,
>>>
>>> Does anyone know whether I can run ClojureCLR on .net compact?
>>> Specifically I would need to run it on Windows CE. Currently the
>>> application is written in C# which works ok, but I need to rewrite it
>>> and I'm deciding between C#, F# and ClojureCLR.
>>>
>>> Thanks,
>>> David
>>>
>>> --
>>> David Jagoe
>>>
>>> davidja...@gmail.com
>>> +447535268218
>>
>> --
>> 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
>
>
>
> --
> David Jagoe
>
> davidja...@gmail.com
> +447535268218
>
> --
> 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



-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:59 AM, Dave Sann  wrote:

> If I have errors, I use the stacktrace which you can access easily in
> chrome for example to get my bearing and figure out what is going on.
>

Can you elaborate on this?  Right now, I'm using a rhino repl as per the
getting started instructions.  What makes the stacktrace different or
easier to access in Chrome?

Usual Clojure techniques do not seem to apply:
ClojureScript:test.solve> (.printStackTrace *e)
"Error evaluating:" (.printStackTrace *e) :as
"test.solve._STAR_e.printStackTrace();\r\n"
org.mozilla.javascript.EcmaError: TypeError: Cannot call method
"printStackTrace" of undefined (#66)
at :66 (anonymous)
at :66

Most of the messages I see are equally terse.  I've only seen a full
stacktrace a couple of times so far (for example, if I type (nil 2) into
the repl, I get a full stack trace).

I can imagine this would be a lot easier if I were building up the code
incrementally.  But for porting a large body of code which works just fine
in Clojure and then doesn't work in Clojurescript, it's very hard to
pinpoint why it is not working without some kind of useful information
about what isn't working.  I do find the Javascript relatively readable,
and even line numbers that point at that would help.

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
If you are running in a browser - the console log will show a stacktrace 
that you can use.
As you are using Rhino, sorry I don't use this. Others may be able to help.

(I think that *e and .printStackTrace are clojure repl and jvm interop 
respectively - not available in cljs)

If you are porting large sections of clojure code - I think that you will 
have a hard time without building up in relatively manageable bits.

The error that you showed originally does not look like a compile error - 
but an execution error. I may be wrong.

Cheers

D

-- 
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] Eastwood - A Clojure lint tool

2012-04-19 Thread Jonas
I released 0.0.2 to clojars. It should now (hopefully) be possible to use 
eastwood with lein1. Note that eastwood will only work with projects that 
use Clojure version 1.3 and newer. This means that if you want to lint for 
example a leiningen plugin project you better use lein2 because lein1 runs 
on Clojure 1.2.1.

On Thursday, April 19, 2012 4:30:19 PM UTC+3, Jonas wrote:
>
>
>
> On Thursday, April 19, 2012 4:24:16 PM UTC+3, Ambrose Bonnaire-Sergeant 
> wrote:
>>
>> Did I do something wrong?
>>
>
> Sorry, I only tested in with lein2. I'll try to make it work with both in 
> the next release.
>  
>

-- 
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] Eastwood - A Clojure lint tool

2012-04-19 Thread Ambrose Bonnaire-Sergeant
Still not working with lein1.

ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein plugin install
jonase/eastwood 0.0.2
[INFO] Unable to find resource 'jonase:eastwood:jar:0.0.2' in repository
central (http://repo1.maven.org/maven2)
Copying 4 files to /tmp/lein-cc995082-fa11-4245-8f7a-88d6c5aa738d/lib
Including eastwood-0.0.2.jar
Including java.classpath-0.1.1.jar
Including google-diff-match-patch-0.1.jar
Including analyze-0.1.6.jar
Including tools.namespace-0.1.2.jar
Created jonase-eastwood-0.0.2.jar
ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein version
Leiningen 1.7.1 on Java 1.6.0_23 OpenJDK Client VM
ambrose@ambrose-VirtualBox:~/Projects/typed-clojure$ lein eastwood
That's not a task. Use "lein help" to list all tasks.

On Fri, Apr 20, 2012 at 1:25 AM, Jonas  wrote:

> I released 0.0.2 to clojars. It should now (hopefully) be possible to use
> eastwood with lein1. Note that eastwood will only work with projects that
> use Clojure version 1.3 and newer. This means that if you want to lint for
> example a leiningen plugin project you better use lein2 because lein1 runs
> on Clojure 1.2.1.
>
>
> On Thursday, April 19, 2012 4:30:19 PM UTC+3, Jonas wrote:
>>
>>
>>
>> On Thursday, April 19, 2012 4:24:16 PM UTC+3, Ambrose Bonnaire-Sergeant
>> wrote:
>>>
>>> Did I do something wrong?
>>>
>>
>> Sorry, I only tested in with lein2. I'll try to make it work with both in
>> the next release.
>>
>>
>  --
> 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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 10:01 AM, Dave Sann  wrote:

> The error that you showed originally does not look like a compile error -
> but an execution error. I may be wrong.
>

Agreed.  The error happens only when I execute the code, not when I compile
it.  Since the code works fine in Clojure, my best guess right now is that
I must be using some core Clojure function that isn't implemented in
Clojurescript.  According to the docs, "most" but not all of the collection
functions are implemented, for example.  So what kind of error would one
expect to get if you try to use one of the non-implemented functions?
Would it look like the error I'm getting?

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
How are you compiling the code?

David

On Thu, Apr 19, 2012 at 5:55 AM, Mark Engelberg wrote:

> I'm trying to get some Clojure code to compile to javascript.
>
> So I've got a clojurescript repl up and running, and I was hoping it would
> be a straightforward iterative process of:
> Compile code.
> Test code.
> Get detailed bug (or at least a line number) if I used a feature not
> available in clojurescript (e.g., letfn).
> Change code.
> Repeat.
>
> Unfortunately, it seems that all I get when code doesn't work under
> clojurescript is stuff like this:
> org.mozilla.javascript.EcmaError: TypeError: Cannot call method "call" of
> undefined (#52)
> at :52 (anonymous)
> at :52
>
> I've got nothing to work with, other than this generic report that
> (presumably because the compilation failed), the function remains undefined.
>
> So what's the trick for converting code and/or for getting some kind of
> meaningful error message in clojurescript?
>
> 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

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 10:56 AM, David Nolen wrote:

> How are you compiling the code?
>
> David
>
>
In the REPL, using (ns test (:require [namespace-of-file-I-want-to-compile
:as s]))
and then invoking the functions using (s/function item).

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
How are you starting the REPL? What version of ClojureScript? Are you using
lein-cljsbuild?

On Thu, Apr 19, 2012 at 2:09 PM, Mark Engelberg wrote:

> On Thu, Apr 19, 2012 at 10:56 AM, David Nolen wrote:
>
>> How are you compiling the code?
>>
>> David
>>
>>
> In the REPL, using (ns test (:require [namespace-of-file-I-want-to-compile
> :as s]))
> and then invoking the functions using (s/function item).
>
> --
> 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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
lein-cljsbuild's trampoline tasks for starting REPLs are not working for me
(I reported this in another thread).  Seems to be a problem with lein's
batch file for Windows not properly handling spaces in directories that
relate to plugins.

So I do lein repl (I've configured the project file with additional
classpaths that point into the clojurescript libs and src directories).

Then, I do:
(require '[cljs.repl :as repl])
(require '[cljs.repl.rhino :as rhino]) ;; require the rhino implementation
of IJavaScriptEnv
(def env (rhino/repl-env)) ;; create a new environment
(repl/repl env) ;; start the REPL

The clojurescript is freshly cloned from git as of last night, using:

git clone git://github.com/clojure/clojurescript.git



On Thu, Apr 19, 2012 at 11:13 AM, David Nolen wrote:

> How are you starting the REPL? What version of ClojureScript? Are you
> using lein-cljsbuild?
>
>

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
Then you need construct your REPL with:

(repl/repl env :warn-on-undeclared true)

David

On Thu, Apr 19, 2012 at 2:27 PM, Mark Engelberg wrote:

> lein-cljsbuild's trampoline tasks for starting REPLs are not working for
> me (I reported this in another thread).  Seems to be a problem with lein's
> batch file for Windows not properly handling spaces in directories that
> relate to plugins.
>
> So I do lein repl (I've configured the project file with additional
> classpaths that point into the clojurescript libs and src directories).
>
> Then, I do:
> (require '[cljs.repl :as repl])
> (require '[cljs.repl.rhino :as rhino]) ;; require the rhino implementation
> of IJavaScriptEnv
> (def env (rhino/repl-env)) ;; create a new environment
> (repl/repl env) ;; start the REPL
>
> The clojurescript is freshly cloned from git as of last night, using:
>
> git clone git://github.com/clojure/clojurescript.git
>
>
>
> On Thu, Apr 19, 2012 at 11:13 AM, David Nolen wrote:
>
>> How are you starting the REPL? What version of ClojureScript? Are you
>> using lein-cljsbuild?
>>
>>  --
> 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

Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Ambrose Bonnaire-Sergeant
Hi,

I've been doing some thinking about the treatment of nil in a
statically typed version of Clojure.

It occurs to me that nil is significantly different to Java's null
reference, which
is almost a Bottom type.

Java's null is a subtype of any reference type.
Clojure's nil is just nil, subtype to nothing except itself.

To accomodate this, nil should be implicitly added to the result
type of any interaction with Java via interop.

(Union syntax: (U x0 .. xn) is the union of types x0..nx)

 :- 

(Integer. 1) :- (U java.lang.Integer nil)
(.getClass 1) :- (U java.lang.Class nil)
(class 1) :- java.lang.Class

So the equivalent type of java.lang.Object (in Java-land) is
(U java.lang.Object nil) (in Clojure-land).

The exception to the implicit nil rule would be when a the result of an
interop
expression is a primitive value. A Java primitive cannot be null.

(. Integer MAXVALUE) :- int

Hopefully I expressed my thoughts clearly. Does this strategy seem
correct? Are there any other uses of null that I should be handling?

Thanks,
Ambrose

-- 
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: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Cedric Greevey
On Thu, Apr 19, 2012 at 2:46 PM, Ambrose Bonnaire-Sergeant
 wrote:
> Hi,
>
> I've been doing some thinking about the treatment of nil in a
> statically typed version of Clojure.
>
> It occurs to me that nil is significantly different to Java's null
> reference, which
> is almost a Bottom type.
>
> Java's null is a subtype of any reference type.
> Clojure's nil is just nil, subtype to nothing except itself.
>
> To accomodate this, nil should be implicitly added to the result
> type of any interaction with Java via interop.
>
> (Union syntax: (U x0 .. xn) is the union of types x0..nx)
>
>  :- 
>
> (Integer. 1) :- (U java.lang.Integer nil)

Constructor calls can never evaluate to null.

> (.getClass 1) :- (U java.lang.Class nil)

I'm pretty sure the Object#getClass method can never return null either.

On the other hand,

(.get a-java-util-map foo) :- (U java.lang.Object nil)

:)

-- 
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: ClojureCLR on .net compact?

2012-04-19 Thread dmiller
On Thursday, April 19, 2012 11:20:05 AM UTC-5, tbc++ wrote:
>
> If you AOT compile the ClojureCLR code, will it still depend on 
> Reflection.Emit?
>
> Timothy
>

Yes, it will still depend on Reflection.Emit.  If you eval, you need it. 
 Also, any place where ClojureJVM does runtime reflection, ClojureCLR uses 
dynamic DLR expressions to take advantage of polymorphic inline caching. 
 (The DLR is also used to do method resolution, much more compilicated for 
the CLR.)  Dynamic DLR expressions do on-the-fly code gen using 
Reflection.Emit.

(There are hints that Mono.Cecil can be to provide Reflection.Emit 
capabilities for the DLR on .Net CF, but I'm not going there anytime soon.)

-David

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
OK, this was very helpful advice.  Using these warnings I was able to
identify several problems:
Clojurescript didn't like my use of defstruct
Clojurescript didn't like my throwing of a RuntimeException
Clojurescript doesn't understand the format function  (is there a
substitute in Clojurescript-land?)

I eliminated these issues and now my code is compiling with no warnings.
The code still works in Clojure, so I know I have introduced no new bugs.

Unfortunately, it still doesn't work in Clojurescript.  I'm still getting
the same cryptic error message about not being able to call the method
"call" of undefined.

Any other suggestions?

Thanks,

Mark

On Thu, Apr 19, 2012 at 11:32 AM, David Nolen wrote:

> Then you need construct your REPL with:
>
> (repl/repl env :warn-on-undeclared true)
>
> David
>
> On Thu, Apr 19, 2012 at 2:27 PM, Mark Engelberg 
> wrote:
>
>> lein-cljsbuild's trampoline tasks for starting REPLs are not working for
>> me (I reported this in another thread).  Seems to be a problem with lein's
>> batch file for Windows not properly handling spaces in directories that
>> relate to plugins.
>>
>> So I do lein repl (I've configured the project file with additional
>> classpaths that point into the clojurescript libs and src directories).
>>
>> Then, I do:
>> (require '[cljs.repl :as repl])
>> (require '[cljs.repl.rhino :as rhino]) ;; require the rhino
>> implementation of IJavaScriptEnv
>> (def env (rhino/repl-env)) ;; create a new environment
>> (repl/repl env) ;; start the REPL
>>
>> The clojurescript is freshly cloned from git as of last night, using:
>>
>> git clone git://github.com/clojure/clojurescript.git
>>
>>
>>
>> On Thu, Apr 19, 2012 at 11:13 AM, David Nolen wrote:
>>
>>> How are you starting the REPL? What version of ClojureScript? Are you
>>> using lein-cljsbuild?
>>>
>>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

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

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread James Reeves
On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant
 wrote:
> I've been doing some thinking about the treatment of nil in a
> statically typed version of Clojure.

Statically typed in what way? Java's type system doesn't seem
particularly suited to a functional programming language like Clojure.

- 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: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
yes. 

because this would be interpreted as a function/var that was expected to be 
defined in the current namespace - you will see this in generated code. 
my.namespace.function_I_thought_was_in_core

David's :warn-on-undefined should pick this up for code compiled via the 
repl.

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
I've found that by completely exiting and restarting the REPL, it is
working now.  Woo hoo!

Way, way, way slower though.  16 seconds to produce an answer that takes 6
milliseconds in Java.

I have a suspicion that part of the time difference may have something to
do with Clojurescript's treatment of laziness.  My code heavily relies on
the laziness of Clojure sequences, and if Clojurescript is trying to
evaluate too much, that could explain a lot.

Are there any laziness gotchas I need to be aware of in Clojurescript?

-- 
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: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Ambrose Bonnaire-Sergeant
I am working on an optional type system for Clojure. It looks more like
Scala's type system, ie. working on top of existing Java types.

I'm inspired by Typed Racket, which include recursive types, unions,
singleton types, the ability to type complex variable arity functions, and
other cool stuff.

I'm also eager to steal bounded polymorphism from Scala.

This discussion is oriented towards typing interop calls, which are just
normal Java Classes/primitives.

Thanks,
Ambrose

On Fri, Apr 20, 2012 at 7:06 AM, James Reeves wrote:

> On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant
>  wrote:
> > I've been doing some thinking about the treatment of nil in a
> > statically typed version of Clojure.
>
> Statically typed in what way? Java's type system doesn't seem
> particularly suited to a functional programming language like Clojure.
>
> - 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
>

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Evan Mezeske
Is the 16 seconds figure from running your code in Rhino?  From what I've 
heard, the V8 engine is much, much faster (like, order(s) of magnitude) 
than Rhino.

I'm not really sure what the best way to interactively run code on V8 is. 
 You could compile with node.js as the platform, and I think David Nolen 
has a partially working version of a node.js. REPL working:


https://github.com/swannodette/clojurescript/blob/node-repl/script/node-repl

Hopefully someone else on the list knows more about using V8 for this kind 
of thing.

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Kevin Lynagh
Mark,

There's a format-like function in the Closure library.
Add to your namespace

(:require [goog.string :as gstring]
[goog.string.format :as gformat])

and call it like

(gstring/format "%02.0f" (inc 8)) ;;or whatever.

On Apr 19, 4:46 pm, Evan Mezeske  wrote:
> Is the 16 seconds figure from running your code in Rhino?  From what I've
> heard, the V8 engine is much, much faster (like, order(s) of magnitude)
> than Rhino.
>
> I'm not really sure what the best way to interactively run code on V8 is.
>  You could compile with node.js as the platform, and I think David Nolen
> has a partially working version of a node.js. REPL working:
>
> https://github.com/swannodette/clojurescript/blob/node-repl/script/no...
>
> Hopefully someone else on the list knows more about using V8 for this kind
> of thing.

-- 
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: cljsbuild and checkouts?

2012-04-19 Thread Dave Sann
I finally started take take a look at this.

Apologies are due - it does work. I had errors in my tests.

I have a question though. 

Ideally, I don't really want to have .crossover. or .generic. in my 
namespaces.

Is it possible to put crossover/generic files in a completely separate src 
directory? 

If not - how hard do you think this would be?

Cheers

Dave


On Saturday, 7 April 2012 13:39:10 UTC+10, Dave Sann wrote:
>
> I'll take a look
>
> On Thursday, 5 April 2012 16:34:34 UTC+10, Evan Mezeske wrote:
>>
>> I haven't used checkout dependencies with lein-cljsbuild myself, but my 
>> understanding is that lein will put the "checkouts" directory earlier in 
>> the classpath than other dependencies, so things in there will be found 
>> first.  The clojurescript compiler runs inside an "eval-in-project" in 
>> Leiningen.  I would have assumed that the checkout dependencies would be 
>> available "in-project", but your testing would seem to indicate that 
>> they're not.
>>
>> Feel free to open a lein-cljsbuild case for this; I'll be able to help 
>> investigate in a few days. Of course, if you track down the problem and fix 
>> it, I'd happily accept a pull request!  :)
>>
>> -Evan
>>
>> On Wednesday, April 4, 2012 8:59:35 PM UTC-7, Dave Sann wrote:
>>>
>>> Correction - the code does not compile in simple mode and above because 
>>> the checkouts do not appear to be found.
>>>
>>> On Thursday, 5 April 2012 13:31:51 UTC+10, Dave Sann wrote:

 Can anyone confirm whether lein cljsbuild can support use of the 
 "checkouts" directory?

 I have tried this with a simple test. The code compiles without error 
 but the checkouts dependencies are not included.

 I know that you can jar the cljs files but it is good to be able to 
 work without doing this for small edits.

 I currently use a modified version of cljs-watch that does this - but I 
 would like to switch to a more "standard" build path

 If not supported I will add this as an enhancement request.

 Cheers

 Dave



-- 
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: cljsbuild and checkouts?

2012-04-19 Thread Evan Mezeske
Yeah, you should be able to avoid having a .crossover or .generic or 
whatever in your namespaces; those are just examples based on my personal 
way of organizing things.

You can put the crossover files wherever you want, as long as they're in 
the classpath (even in a JAR).  They don't need to be named specially, or 
anything like that.  So if you specified :crossovers [a.b.c], the plugin 
will look throughout the classpath for a/b/c.clj, and will use it as a 
crossover.

On Thursday, April 19, 2012 5:17:51 PM UTC-7, Dave Sann wrote:
>
> I finally started take take a look at this.
>
> Apologies are due - it does work. I had errors in my tests.
>
> I have a question though. 
>
> Ideally, I don't really want to have .crossover. or .generic. in my 
> namespaces.
>
> Is it possible to put crossover/generic files in a completely separate src 
> directory? 
>
> If not - how hard do you think this would be?
>
> Cheers
>
> Dave
>
>
> On Saturday, 7 April 2012 13:39:10 UTC+10, Dave Sann wrote:
>>
>> I'll take a look
>>
>> On Thursday, 5 April 2012 16:34:34 UTC+10, Evan Mezeske wrote:
>>>
>>> I haven't used checkout dependencies with lein-cljsbuild myself, but my 
>>> understanding is that lein will put the "checkouts" directory earlier in 
>>> the classpath than other dependencies, so things in there will be found 
>>> first.  The clojurescript compiler runs inside an "eval-in-project" in 
>>> Leiningen.  I would have assumed that the checkout dependencies would be 
>>> available "in-project", but your testing would seem to indicate that 
>>> they're not.
>>>
>>> Feel free to open a lein-cljsbuild case for this; I'll be able to help 
>>> investigate in a few days. Of course, if you track down the problem and fix 
>>> it, I'd happily accept a pull request!  :)
>>>
>>> -Evan
>>>
>>> On Wednesday, April 4, 2012 8:59:35 PM UTC-7, Dave Sann wrote:

 Correction - the code does not compile in simple mode and above because 
 the checkouts do not appear to be found.

 On Thursday, 5 April 2012 13:31:51 UTC+10, Dave Sann wrote:
>
> Can anyone confirm whether lein cljsbuild can support use of the 
> "checkouts" directory?
>
> I have tried this with a simple test. The code compiles without error 
> but the checkouts dependencies are not included.
>
> I know that you can jar the cljs files but it is good to be able to 
> work without doing this for small edits.
>
> I currently use a modified version of cljs-watch that does this - but 
> I would like to switch to a more "standard" build path
>
> If not supported I will add this as an enhancement request.
>
> Cheers
>
> Dave
>
>

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:46 PM, Evan Mezeske  wrote:

> Is the 16 seconds figure from running your code in Rhino?
>

Yes, Rhino.  I'm also not doing any optimizations, although my
understanding is that advanced optimizations is more about pruning code and
reducing file size than reducing execution time, 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: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Alan Malloy
On Apr 19, 4:06 pm, James Reeves  wrote:
> On 19 April 2012 19:46, Ambrose Bonnaire-Sergeant
>
>  wrote:
> > I've been doing some thinking about the treatment of nil in a
> > statically typed version of Clojure.
>
> Statically typed in what way? Java's type system doesn't seem
> particularly suited to a functional programming language like Clojure.
>
> - James

There's nothing about functional programming that precludes static
typing. Haskell, say, does a lovely job of static typing without
making you pound out a bunch of "keyboard typing" for every function
like Java would.

For example, the type signature for foldl (Haskell's reduce) is:
(a -> b -> a) -> a -> [b] -> a

"Reduce takes:
  - A function taking an A and a B and returning an A
  - An A to start with
  - A list of Bs
And returns an A".

This is sufficiently general for all applications of reduce, and if
you don't feel like typing it out the compiler can infer it for you
from the source.

-- 
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: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 4:38 PM, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> I am working on an optional type system for Clojure. It looks more like
> Scala's type system, ie. working on top of existing Java types.
>
>
I saw Gilad Bracha speak a couple weeks ago about the design of Dart.
Dart's optional type system is based around the philosophy that annotating
code with types should never cause your code to not compile or in any way
behave differently than it would in dynamic typing mode.  Adding types just
causes the compiler to emit warnings if things don't match up right.  In a
sense, it's a "type assertion" system.

Seems like this would be a good system to draw inspiration from, and would
fit nicely with Clojure's philosophy.

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
Rhino is slow. If you want to see performance anywhere near the JVM you to
have to use a modern JavaScript engine - JavaScriptCore, SpiderMonkey, or
Google V8.

David

On Thu, Apr 19, 2012 at 7:31 PM, Mark Engelberg wrote:

> I've found that by completely exiting and restarting the REPL, it is
> working now.  Woo hoo!
>
> Way, way, way slower though.  16 seconds to produce an answer that takes 6
> milliseconds in Java.
>
> I have a suspicion that part of the time difference may have something to
> do with Clojurescript's treatment of laziness.  My code heavily relies on
> the laziness of Clojure sequences, and if Clojurescript is trying to
> evaluate too much, that could explain a lot.
>
> Are there any laziness gotchas I need to be aware of in Clojurescript?
>
>  --
> 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: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
On Thu, Apr 19, 2012 at 8:43 PM, Mark Engelberg wrote:

> On Thu, Apr 19, 2012 at 4:46 PM, Evan Mezeske  wrote:
>
>> Is the 16 seconds figure from running your code in Rhino?
>>
>
> Yes, Rhino.  I'm also not doing any optimizations, although my
> understanding is that advanced optimizations is more about pruning code and
> reducing file size than reducing execution time, right?
>

Advanced optimizations improve execution on many JS engines. Also many CLJS
specific performance optimizations don't kick in unless you're doing
advanced compilation.

David

-- 
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: cljsbuild and checkouts?

2012-04-19 Thread Dave Sann
Great.

Do I need to be explicit in naming crossover files.

what If I have for example

crossover/a/b/x.clj
crossover/a/y.clj

can I do [crossover] and get all of these?

my test says 
 - yes in the main project - but only to the level immediately below. i.e 
picking up crossover/*.clj
 - no in checkouts - I have to be explicit here.


D


On Friday, 20 April 2012 10:23:48 UTC+10, Evan Mezeske wrote:
>
> Yeah, you should be able to avoid having a .crossover or .generic or 
> whatever in your namespaces; those are just examples based on my personal 
> way of organizing things.
>
> You can put the crossover files wherever you want, as long as they're in 
> the classpath (even in a JAR).  They don't need to be named specially, or 
> anything like that.  So if you specified :crossovers [a.b.c], the plugin 
> will look throughout the classpath for a/b/c.clj, and will use it as a 
> crossover.
>
> On Thursday, April 19, 2012 5:17:51 PM UTC-7, Dave Sann wrote:
>>
>> I finally started take take a look at this.
>>
>> Apologies are due - it does work. I had errors in my tests.
>>
>> I have a question though. 
>>
>> Ideally, I don't really want to have .crossover. or .generic. in my 
>> namespaces.
>>
>> Is it possible to put crossover/generic files in a completely separate 
>> src directory? 
>>
>> If not - how hard do you think this would be?
>>
>> Cheers
>>
>> Dave
>>
>>
>> On Saturday, 7 April 2012 13:39:10 UTC+10, Dave Sann wrote:
>>>
>>> I'll take a look
>>>
>>> On Thursday, 5 April 2012 16:34:34 UTC+10, Evan Mezeske wrote:

 I haven't used checkout dependencies with lein-cljsbuild myself, but my 
 understanding is that lein will put the "checkouts" directory earlier in 
 the classpath than other dependencies, so things in there will be found 
 first.  The clojurescript compiler runs inside an "eval-in-project" in 
 Leiningen.  I would have assumed that the checkout dependencies would be 
 available "in-project", but your testing would seem to indicate that 
 they're not.

 Feel free to open a lein-cljsbuild case for this; I'll be able to help 
 investigate in a few days. Of course, if you track down the problem and 
 fix 
 it, I'd happily accept a pull request!  :)

 -Evan

 On Wednesday, April 4, 2012 8:59:35 PM UTC-7, Dave Sann wrote:
>
> Correction - the code does not compile in simple mode and above 
> because the checkouts do not appear to be found.
>
> On Thursday, 5 April 2012 13:31:51 UTC+10, Dave Sann wrote:
>>
>> Can anyone confirm whether lein cljsbuild can support use of the 
>> "checkouts" directory?
>>
>> I have tried this with a simple test. The code compiles without error 
>> but the checkouts dependencies are not included.
>>
>> I know that you can jar the cljs files but it is good to be able to 
>> work without doing this for small edits.
>>
>> I currently use a modified version of cljs-watch that does this - but 
>> I would like to switch to a more "standard" build path
>>
>> If not supported I will add this as an enhancement request.
>>
>> Cheers
>>
>> Dave
>>
>>

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Mark Engelberg
OK, I ran the same test directly in the browser with optimizations.  I
wasn't doing it in a REPL, so I couldn't use the time function, but Firefox
appeared to take about 2 seconds, and Chrome was definitely under a
second.  So yes, there does seem to be a world of difference from Rhino.

I'm still seeing extraordinarily slow times on problems where more laziness
is involved.  It really seems that Clojurescript is evaluating more of the
lazy structure than it needs to.  Any idea why that might be?

-- 
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: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Ambrose Bonnaire-Sergeant
This is basically my approach. I'm performing static analysis a la carte.
Right now I have a "check-namespace" function that performs type checking
transitively for a given namespace. You could imagine performing this at
the REPL, lein plugin, or via an editor shortcut.

And adding types has zero effect on the resulting code, aside from having
to `require` the type system library. Ideally, you would only add top level
annotations as separate forms.

(+T add-two [Number -> Number])
(defn add-two [n]
  (+ 2 n))

I could imagine the results of type checking could offer suggestions for
type hinting, and an editor could automatically fill in the types.

Thanks,
Ambrose

On Fri, Apr 20, 2012 at 8:48 AM, Mark Engelberg wrote:

> On Thu, Apr 19, 2012 at 4:38 PM, Ambrose Bonnaire-Sergeant <
> abonnaireserge...@gmail.com> wrote:
>
>> I am working on an optional type system for Clojure. It looks more like
>> Scala's type system, ie. working on top of existing Java types.
>>
>>
> I saw Gilad Bracha speak a couple weeks ago about the design of Dart.
> Dart's optional type system is based around the philosophy that annotating
> code with types should never cause your code to not compile or in any way
> behave differently than it would in dynamic typing mode.  Adding types just
> causes the compiler to emit warnings if things don't match up right.  In a
> sense, it's a "type assertion" system.
>
> Seems like this would be a good system to draw inspiration from, and would
> fit nicely with Clojure's philosophy.
>
> --
> 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: cljsbuild and checkouts?

2012-04-19 Thread Evan Mezeske
Your testing revealed accurate information.  The general rule is that if a 
namespace is from one of the cljsbuild :source-path entries, it will be 
followed recursively.  Unfortunately, for namespaces coming out of the 
classpath, it's not always possible to recurse (e.g. there's no way to list 
a directory in a JAR).  So, since checkouts are just part of the classpath, 
they will have to be specified as crossovers in fine detail.  :(

On Thursday, April 19, 2012 6:16:40 PM UTC-7, Dave Sann wrote:
>
> Great.
>
> Do I need to be explicit in naming crossover files.
>
> what If I have for example
>
> crossover/a/b/x.clj
> crossover/a/y.clj
>
> can I do [crossover] and get all of these?
>
> my test says 
>  - yes in the main project - but only to the level immediately below. i.e 
> picking up crossover/*.clj
>  - no in checkouts - I have to be explicit here.
>
>
> D
>
>
> On Friday, 20 April 2012 10:23:48 UTC+10, Evan Mezeske wrote:
>>
>> Yeah, you should be able to avoid having a .crossover or .generic or 
>> whatever in your namespaces; those are just examples based on my personal 
>> way of organizing things.
>>
>> You can put the crossover files wherever you want, as long as they're in 
>> the classpath (even in a JAR).  They don't need to be named specially, or 
>> anything like that.  So if you specified :crossovers [a.b.c], the plugin 
>> will look throughout the classpath for a/b/c.clj, and will use it as a 
>> crossover.
>>
>> On Thursday, April 19, 2012 5:17:51 PM UTC-7, Dave Sann wrote:
>>>
>>> I finally started take take a look at this.
>>>
>>> Apologies are due - it does work. I had errors in my tests.
>>>
>>> I have a question though. 
>>>
>>> Ideally, I don't really want to have .crossover. or .generic. in my 
>>> namespaces.
>>>
>>> Is it possible to put crossover/generic files in a completely separate 
>>> src directory? 
>>>
>>> If not - how hard do you think this would be?
>>>
>>> Cheers
>>>
>>> Dave
>>>
>>>
>>> On Saturday, 7 April 2012 13:39:10 UTC+10, Dave Sann wrote:

 I'll take a look

 On Thursday, 5 April 2012 16:34:34 UTC+10, Evan Mezeske wrote:
>
> I haven't used checkout dependencies with lein-cljsbuild myself, but 
> my understanding is that lein will put the "checkouts" directory earlier 
> in 
> the classpath than other dependencies, so things in there will be found 
> first.  The clojurescript compiler runs inside an "eval-in-project" in 
> Leiningen.  I would have assumed that the checkout dependencies would be 
> available "in-project", but your testing would seem to indicate that 
> they're not.
>
> Feel free to open a lein-cljsbuild case for this; I'll be able to help 
> investigate in a few days. Of course, if you track down the problem and 
> fix 
> it, I'd happily accept a pull request!  :)
>
> -Evan
>
> On Wednesday, April 4, 2012 8:59:35 PM UTC-7, Dave Sann wrote:
>>
>> Correction - the code does not compile in simple mode and above 
>> because the checkouts do not appear to be found.
>>
>> On Thursday, 5 April 2012 13:31:51 UTC+10, Dave Sann wrote:
>>>
>>> Can anyone confirm whether lein cljsbuild can support use of the 
>>> "checkouts" directory?
>>>
>>> I have tried this with a simple test. The code compiles without 
>>> error but the checkouts dependencies are not included.
>>>
>>> I know that you can jar the cljs files but it is good to be able to 
>>> work without doing this for small edits.
>>>
>>> I currently use a modified version of cljs-watch that does this - 
>>> but I would like to switch to a more "standard" build path
>>>
>>> If not supported I will add this as an enhancement request.
>>>
>>> Cheers
>>>
>>> Dave
>>>
>>>

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread Dave Sann
(binding [*print-fn* #(.log js/console)] (time ...))

works in the browser

On Friday, 20 April 2012 11:25:31 UTC+10, puzzler wrote:
>
> OK, I ran the same test directly in the browser with optimizations.  I 
> wasn't doing it in a REPL, so I couldn't use the time function, but Firefox 
> appeared to take about 2 seconds, and Chrome was definitely under a 
> second.  So yes, there does seem to be a world of difference from Rhino.
>
> I'm still seeing extraordinarily slow times on problems where more 
> laziness is involved.  It really seems that Clojurescript is evaluating 
> more of the lazy structure than it needs to.  Any idea why that might be?
>
>

-- 
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: Converting clojure code to clojurescript

2012-04-19 Thread David Nolen
On Thu, Apr 19, 2012 at 9:25 PM, Mark Engelberg wrote:

> OK, I ran the same test directly in the browser with optimizations.  I
> wasn't doing it in a REPL, so I couldn't use the time function, but Firefox
> appeared to take about 2 seconds, and Chrome was definitely under a
> second.  So yes, there does seem to be a world of difference from Rhino.
>
> I'm still seeing extraordinarily slow times on problems where more
> laziness is involved.  It really seems that Clojurescript is evaluating
> more of the lazy structure than it needs to.  Any idea why that might be?


Browsers have decent profiling tools. Use them and let us know what's slow.

There are many, many areas of ClojureScript that need performance work.

David

-- 
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: Friend: an extensible authentication and authorization library for Clojure Ring webapps and services

2012-04-19 Thread Gert Verhoog
That looks promising, good work!

I read through the docs and browsed the sources, and (admittedly without trying 
to code an example myself) it's not immediately obvious to me how Friend would 
handle the following use case:

Given:
- three users: alice, bob, and admin. Alice and Bob have a "user" role, and 
admin is "admin"
- "edit user account" routes, such as
  (GET  "/user/:id/edit" [id] (show-edit-form))
  (POST "/user/:id"  [id & params] (update-user))

How would I use Friend to ensure that these resources can only be accessed if:
 - you have the "admin" role, OR
 - you are a user AND your id matches the id in the url?


cheers,
gert




On 12/04/2012, at 2:34 AM, Chas Emerick wrote:

> For your consideration, a new library:
> 
> I’m hoping this can eventually be a warden/spring-security/everyauth 
> /omniauth for Clojure; that is, a common abstraction for authentication and 
> authorization mechanisms.  Clojure has been around long enough that adding 
> pedestrian things like form and HTTP Basic and $AUTH_METHOD_HERE to a Ring 
> application should be easy.  Right now, it’s not: either you’re pasting 
> together a bunch of different libraries that don’t necessarily compose well 
> together, or you get drawn into shaving the authentication and authorization 
> yaks for the fifth time in your life so you can sleep well at night.
> 
> Hopefully Friend will make this a solved problem, or at least push things in 
> that direction.
> 
> Read more here: http://wp.me/p10OJi-d6
> 
> Cheers,
> 
> - Chas
> 
> --
> http://cemerick.com
> [Clojure Programming from O'Reilly](http://www.clojurebook.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


Term rewriting systems implemented in Clojure

2012-04-19 Thread Matthew Rocklin
Hello, 

<< As a disclaimer I know very little about this topic or about Clojure; 
please be kind. >>

Background:
I'm interested in implementing a small term rewriting system for a specific 
application. I'm willing to spend some time learning a new language/system 
in order to do this cleanly. I'm currently playing with the Maude system 
but am finding it restrictive. I've heard good things about Clojure's 
core.logic module and thought it might be a good case of a domain specific 
sublanguage contained within a general purpose language. 

Question:
Are there examples of term rewriting systems written in Clojure? If not, 
how difficult would this be? Are there suggested ideas or directions on 
implementation? I suspect that core.logic's unification system can be 
leveraged to perform much of the work. 

Best,
-Matthew Rocklin 

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

question about a macro

2012-04-19 Thread Thomas
Hi,

I'd like to write a macro which transforms

(my-macro SomeClass. a b [x y] c [e f])

into

(SomeClass. a b x y c e f)

(the order of collections and single values in the arguments should be
arbitrary)

The closest I came was

(defmacro my-macro [func & args]
  `(~func ~@(flatten args)))

This works for simple cases like

(my-macro SomeClass. 1 2 [3 4] 5)

but clearly breaks when I do

(def a [1 2])
(def b [3 4])
(my-macro SomeClass. a b)

since

(macroexpand-1 '(my-macro SomeClass. a b))
=> (SomeClass. a b)

"flatten" seems the wrong way to do that. But I somehow need to
evaluate the forms in the args before the unqoute splice happens.
How would I do that?

An alternative would be to generate forms like

(apply #(SomeClass. %1 %2 %3 %4 %5) (concat [1] [2] [3 4] [5]))

but I don't have an idea how to do that plus it has one additional (un-
necessary?) level of indirection

Any hints would be greatly appreciated.

- 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


question about a macro

2012-04-19 Thread thomas kalbe

Hi,

I'd like to write a macro which transforms

(my-macro SomeClass. a b [x y] c [e f])

into

(SomeClass. a b x y c e f)

(the order of collections and single values in the arguments should be 
arbitrary)


The closest I came was

(defmacro my-macro [func & args]
  `(~func ~@(flatten args)))

This works for simple cases like

(my-macro SomeClass. 1 2 [3 4] 5)

but clearly breaks when I do

(def a [1 2])
(def b [3 4])
(my-macro SomeClass. a b) :

(macroexpand-1 '(my-macro SomeClass. a b))
=> (SomeClass. a b)

"flatten" seems the wrong way to do that. But I somehow need to evaluate 
the forms in the args before the unqoute splice happens.

How would I do that?
Any ideas would be greatly appreciated.

- 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


Newbie question about rebinding local variables

2012-04-19 Thread Craig Ching
Ok, I've read that what I want to do is a no no.  But this is the sort of 
thing I did in Scheme about 20 years ago (and because of that I'm probably 
misremembering ;-)).

Basically I'm learning clojure and thought I'd write a tic tac toe game. 
 But not any tic tac toe, I want to write one where I can have multiple 
games going simultaneously.  Something like:

(def g1 (new-game))
(def g2 (new-game))

(g1 :x 0)
(g1 :print)
(g2 :x 5)
(g2 :print)

So the schemer in me (and probably the imperative programmer as well) 
thought I could return a clojure that encapsulates the board value, 
something like this:

(defn new-game []

  (let [board (into [] (repeat 9 nil))]

(fn [n i]

  (cond

(= n :x)(set! board (assoc board i 'x))

(= n :o)(set! board (assoc board i 'o))

(= n :print) (println board)

Of course I get an error saying I can't bind to the non-mutable board.

I'm really new to Clojure, so apologies if this is really basic for this 
list.  Can I do what I want or can someone point me in the right direction? 
 I've seen some other tic tac toe implementations on github, but they use 
recur to track state and I was hoping there was a cleaner idiomatic way 
than that.

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

New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-19 Thread David Greenberg
Paredit mode is a structural editor for Clojure code in Vim. It allows
you to edit your code while keeping parenthesis matched, and providing
shortcuts to manipulate (), {}, [], and "" easily. Use :help paredit
for details.

I just implemented support for VimClojure repls and {} syntax. Please
report any bugs to me. Don't forget to use Pathogen!

https://github.com/dgrnbrg/paredit-vim

https://github.com/tpope/vim-pathogen

-- 
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: Term rewriting systems implemented in Clojure

2012-04-19 Thread David Nolen
What don't you like about Maude?

On Wed, Apr 18, 2012 at 10:05 PM, Matthew Rocklin wrote:

> Hello,
>
> << As a disclaimer I know very little about this topic or about Clojure;
> please be kind. >>
>
> Background:
> I'm interested in implementing a small term rewriting system for a
> specific application. I'm willing to spend some time learning a new
> language/system in order to do this cleanly. I'm currently playing with the
> Maude system but am finding it restrictive. I've heard good things about
> Clojure's core.logic module and thought it might be a good case of a domain
> specific sublanguage contained within a general purpose language.
>
> Question:
> Are there examples of term rewriting systems written in Clojure? If not,
> how difficult would this be? Are there suggested ideas or directions on
> implementation? I suspect that core.logic's unification system can be
> leveraged to perform much of the work.
>
> Best,
> -Matthew Rocklin 
>
> --
> 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: Newbie question about rebinding local variables

2012-04-19 Thread Armando Blancas
You could keep the board in an atom so it can mutate; then try to find 
maybe two good places for mutation to happen, your move and the program's. 
With the rest being functional you'll avoid the problems of global state 
while not being forced to fit your logic into a loop of some re-binding 
that simulates mutation.

On Thursday, April 19, 2012 3:21:56 PM UTC-7, Craig Ching wrote:
>
> Ok, I've read that what I want to do is a no no.  But this is the sort of 
> thing I did in Scheme about 20 years ago (and because of that I'm probably 
> misremembering ;-)).
>
> Basically I'm learning clojure and thought I'd write a tic tac toe game. 
>  But not any tic tac toe, I want to write one where I can have multiple 
> games going simultaneously.  Something like:
>
> (def g1 (new-game))
> (def g2 (new-game))
>
> (g1 :x 0)
> (g1 :print)
> (g2 :x 5)
> (g2 :print)
>
> So the schemer in me (and probably the imperative programmer as well) 
> thought I could return a clojure that encapsulates the board value, 
> something like this:
>
> (defn new-game []
>
>   (let [board (into [] (repeat 9 nil))]
>
> (fn [n i]
>
>   (cond
>
> (= n :x)(set! board (assoc board i 'x))
>
> (= n :o)(set! board (assoc board i 'o))
>
> (= n :print) (println board)
>
> Of course I get an error saying I can't bind to the non-mutable board.
>
> I'm really new to Clojure, so apologies if this is really basic for this 
> list.  Can I do what I want or can someone point me in the right direction? 
>  I've seen some other tic tac toe implementations on github, but they use 
> recur to track state and I was hoping there was a cleaner idiomatic way 
> than that.
>
> 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: Newbie question about rebinding local variables

2012-04-19 Thread gaz jones
to answer your question directly, you would need to do something like
this to make it work the way your example is set up:

(defn new-game []
  (let [board (atom (into [] (repeat 9 nil)))]
(fn [n & [i]]
  (cond
   (= n :x) (swap! board assoc i 'x)
   (= n :o) (swap! board assoc i 'o)
   (= n :print) (println @board)

(def g1 (new-game))

(g1 :x 0)
(g1 :print)

On Thu, Apr 19, 2012 at 9:58 PM, Armando Blancas  wrote:
> You could keep the board in an atom so it can mutate; then try to find maybe
> two good places for mutation to happen, your move and the program's. With
> the rest being functional you'll avoid the problems of global state while
> not being forced to fit your logic into a loop of some re-binding that
> simulates mutation.
>
>
> On Thursday, April 19, 2012 3:21:56 PM UTC-7, Craig Ching wrote:
>>
>> Ok, I've read that what I want to do is a no no.  But this is the sort of
>> thing I did in Scheme about 20 years ago (and because of that I'm probably
>> misremembering ;-)).
>>
>> Basically I'm learning clojure and thought I'd write a tic tac toe game.
>>  But not any tic tac toe, I want to write one where I can have multiple
>> games going simultaneously.  Something like:
>>
>> (def g1 (new-game))
>> (def g2 (new-game))
>>
>> (g1 :x 0)
>> (g1 :print)
>> (g2 :x 5)
>> (g2 :print)
>>
>> So the schemer in me (and probably the imperative programmer as well)
>> thought I could return a clojure that encapsulates the board value,
>> something like this:
>>
>> (defn new-game []
>>
>>   (let [board (into [] (repeat 9 nil))]
>>
>>     (fn [n i]
>>
>>       (cond
>>
>>         (= n :x)(set! board (assoc board i 'x))
>>
>>         (= n :o)(set! board (assoc board i 'o))
>>
>>         (= n :print) (println board)
>>
>>
>> Of course I get an error saying I can't bind to the non-mutable board.
>>
>> I'm really new to Clojure, so apologies if this is really basic for this
>> list.  Can I do what I want or can someone point me in the right direction?
>>  I've seen some other tic tac toe implementations on github, but they use
>> recur to track state and I was hoping there was a cleaner idiomatic way than
>> that.
>>
>> 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

-- 
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: question about a macro

2012-04-19 Thread Armando Blancas
Flatten isn't the problem. You can't put together a special form with 
apply. Try taking the class name as a symbol or string and use reflection.

On Wednesday, April 18, 2012 1:57:27 PM UTC-7, Thomas wrote:
>
> Hi,
>
> I'd like to write a macro which transforms
>
> (my-macro SomeClass. a b [x y] c [e f])
>
> into
>
> (SomeClass. a b x y c e f)
>
> (the order of collections and single values in the arguments should be 
> arbitrary)
>
> The closest I came was
>
> (defmacro my-macro [func & args]
>`(~func ~@(flatten args)))
>
> This works for simple cases like
>
> (my-macro SomeClass. 1 2 [3 4] 5)
>
> but clearly breaks when I do
>
> (def a [1 2])
> (def b [3 4])
> (my-macro SomeClass. a b) :
>
> (macroexpand-1 '(my-macro SomeClass. a b))
> => (SomeClass. a b)
>
> "flatten" seems the wrong way to do that. But I somehow need to evaluate 
> the forms in the args before the unqoute splice happens.
> How would I do that?
> Any ideas would be greatly appreciated.
>
> - 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

Inconsistency of dissoc on maps vs records?

2012-04-19 Thread Matthew Phillips
I've always liked the way assoc and dissoc return the original map instance 
when there's no change to be made. But this is not apparently true of 
records. e.g.:

> (def m {:a 1})
> (identical? m (dissoc m :x))
; true

> (def r <>)
> (identical? r (dissoc r :x))
; false

Does anyone know if there's a good reason for this?

Cheers,

Matthew.

-- 
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: Inconsistency of dissoc on maps vs records?

2012-04-19 Thread David Jagoe
On 20 April 2012 07:08, Matthew Phillips  wrote:

> I've always liked the way assoc and dissoc return the original map
> instance when there's no change to be made. But this is not apparently
> true of records. e.g.:


Out of curiosity, why is this useful to you?

I would imagine that the fact that it works like that for maps at the
moment is an implementation detail that you shouldn't rely upon.

dissoc[iate]. Returns a new map of the same (hashed/sorted) type,
that does not contain a mapping for key(s).

-- 
David Jagoe

davidja...@gmail.com
+447535268218

-- 
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: Inconsistency of dissoc on maps vs records?

2012-04-19 Thread Mark Engelberg
On Thu, Apr 19, 2012 at 11:31 PM, David Jagoe  wrote:

>
> Out of curiosity, why is this useful to you?
>

It certainly has performance benefits.

When things are tested for equality (e.g., to test against keys in a hash
map), identical things are the fastest to recognize as equal.  Also, saves
on memory consumption and thus garbage collection.

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