Re: Clojurescript question

2012-11-17 Thread Paul Gearon
Since HelloWorld worked for me, I tried to output the command line 
arguments as a string. Consequently, the program now looks like:

(ns cljshello.core
  (:require [cljs.nodejs :as nj]))

(defn -main [& argv]
(println (str "Hello, World!" (.-argv nj/process) "\n")))

(set! *main-cli-fn* -main)

Again, I am able to compile with either leiningen or the command line with 
the same result. This time, I'm getting:

/Users/pag/src/test/clj/cljshello/pp.js:350
cljs.core.apply=function(){var a=null,b=function(a,b){var 
c=a.cljs$lang$maxFix
 ^
TypeError: Cannot read property 'cljs$lang$maxFixedArity' of null
at cljs.core.apply.b (/Users/pag/src/test/clj/cljshello/pp.js:350:62)
at cljs.core.apply.a (/Users/pag/src/test/clj/cljshello/pp.js:354:118)
at Object. (/Users/pag/src/test/clj/cljshello/pp.js:926:421)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Since I should already have argv being passed in, I changed the expression 
to use it directly, instead of using (.-argv nj/process), however, this 
changed nothing.

Happy to try any suggestions you may have for me.

Paul

-- 
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: Clojurescript question

2012-11-17 Thread Paul Gearon

On Saturday, 17 November 2012 19:52:39 UTC-5, David Nolen wrote:
>
> What is the error under simple optimizations? Errors under advanced 
> optimizations are not particularly informative :)


Good point, sorry.

Every minor change, is leading to significant differences, so I'm trying to 
strip it right back at the moment. Ideally I want to compile using 
Leiningen, but that's not consistent with the command line (I learned 
tonight that there is a difference in versions there, but that Leiningen 
should work).

Looking in some of the Clojurescript code I saw the comment that the call 
to cljs.core/*main-cli-fn* always happens for node.js, so I've gone back to 
using it. Now my file looks like:

(ns cljshello.core)
(defn -main [& argv]
(println "Hello, World!\n"))
(set! *main-cli-fn* -main)

I'm using a project of:

(defproject cljshello "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME";
  :license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.0-alpha7"]
 [org.clojure/clojurescript "0.0-1535"]]
  :plugins [[lein-cljsbuild "0.2.9"]]
  :hooks [leiningen.cljsbuild]

  :cljsbuild {
:builds [{
  :source-path "src"
  :compiler { :output-to "pp.js"
  :target :nodejs
  :pretty-print true }}]})

Using "lein compile" on this I get a stack trace starting with:

Reloading Clojure file "/cljshello/core.clj" failed.
clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable 
to resolve symbol: *main-cli-fn* in this context, 
compiling:(cljshello/core.clj:7:1)

. though, in the process of writing this email I tried changing the 
:source-path to the specific file I am compiling and the compile finished 
without warning. Am I correct in guessing that I'm supposed to describe a 
build for each file?

All the same, whether I get a warning or not I still get a pp.js file. 
Running this file under either conditions (error in compilation or not) 
gives me:

/Users/pag/src/test/clj/cljshello/pp.js:493
goog.string.Unicode = {NBSP:"\u00a0"};
^
TypeError: Cannot set property 'Unicode' of undefined
at Object. (/Users/pag/src/test/clj/cljshello/pp.js:493:21)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)


However, the same file is now compiling with the cli compiler, so I'll try 
to work with it for the moment.

Paul

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

Re: Clojure to Haskell Compiler

2012-11-17 Thread James Rothering
I'm sorry, I never heard of this. How would you compile Clojure to Haskell?

On Sat, Nov 17, 2012 at 10:31 AM, Ahmed Shafeeq Bin Mohd Shariff <
sepultura.tri...@gmail.com> wrote:

> Hi guys,
>
> I've been frustrated with Clojure's slow speed on the JVM. I've been
> thinking of how it can be compiled to native and I feel that compiling
> Clojure to Haskell and then using ghc to convert this to native would be a
> good idea since Haskell has a large set of good libraries. What do you guys
> think? Would this be a fruitful endeavor for me to embark on?
>
> --
> 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




-- 
Regards,

James Rothering

(Msg) 206-888-1776

-- 
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: Clojurescript question

2012-11-17 Thread David Nolen
What is the error under simple optimizations? Errors under advanced
optimizations are not particularly informative :)

Thanks

On Saturday, November 17, 2012, Paul Gearon wrote:

> Looking at the Clojurescript page on Github I can't find the appropriate
> place to ask about potential bugs unless it's here. Can anyone help
> please? (David?)
>
> Meanwhile, in case it's the correct place, I've tried the following as a
> simple test to run on Node.js:
>
> ---
> (ns jpp.core)
> (defn -main [& args]
>   (.log js/console "Hello, World!\n"))
> (set! *main-cli-fn* -main)
> ---
>
> This works OK.
>
> However, the following will not work (though variations on this have been
> seen to work):
>
> ---
> (ns jpp.core)
> (defn -main []
>   (.log js/console "Hello, World!\n"))
> (-main)
> ---
>
> The output in this case is as follows:
>
> Hello, World!
>
>
> /Users/pag/src/test/clj/jpp/pp.js:72
> ments supported on functions"))}var Vd,Wd=j;function Xd(a,b){var
> c=a.q;if(a.m)
> ^
> TypeError: Cannot read property 'q' of null
> at Function.Xd [as b] (/Users/pag/src/test/clj/jpp/pp.js:72:280)
> at Object. (/Users/pag/src/test/clj/jpp/pp.js:157:244)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
> at Module.load (module.js:356:32)
> at Function.Module._load (module.js:312:12)
> at Module.runMain (module.js:492:10)
> at process.startup.processNextTick.process._tickCallback
> (node.js:244:9)
>
>
> Interestingly, it's printed the correct output, but fails after. Also, do
> I mention in the same place that I get a different set of errors when I try
> to use the lein-cljsbuild plugin?
>
> Regards,
> Paul Gearon
>
> --
> 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 '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  'clojure%2bunsubscr...@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: Request for a hint

2012-11-17 Thread Russell Whitaker
On Sat, Nov 17, 2012 at 3:11 PM, Charlie Griefer
wrote:

> For the record, I point out that its not a "bug" specifically because
> you will see this many many many many times throughout the book. In
> fact, pretty much any time a new function or form is introduced.
>
> (function-name argument-1 argument-2 ... argument-n)
>
> This is not real code meant to be pasted into the REPL and evaluated,
> but rather a high level example of how a particular function works.
>
> Hope that helps :)
>
>
I wouldn't lay money on a bet that it does.

R


> On Sat, Nov 17, 2012 at 5:46 PM, Charlie Griefer
>  wrote:
> > On Sat, Nov 17, 2012 at 5:32 PM, Milen Ivanov 
> wrote:
> >> Dear Mr. Chose,
> >>
> >> Thank you for your help!
> >>
> >> So, the "bug" is then in the book. Fine.
> >
> > There's no "bug" in the book.
> >
> > You copied sample code that's meant to show the syntax of using conj
> > directly into the repo, using undeclared values.
> >
> > (conj coll item) is not meant to run on its own. It's demonstrating
> > that the function conj takes a collection and an item, and returns a
> > new collection with the item added on.
> >
> > So as BG pointed out, you can do:
> >
> > (conj [1 2 3] 4), in which [1 2 3] is a collection (vector) and 4 is
> > the item to be conj'd, which returns a new vector [1 2 3 4].
> > (conj '(1 2 3) 4), in which '(1 2 3) is a collection (list) and 4 is
> > the item to be conj'd, which returns a new list (4 1 2 3)
> >
> > If you want to do (conj coll item) you need to define coll and item,
> > which BG did as:
> >
> > (def coll [1 2 3 4 5])
> > (def item 6)
> >
> > Now that "coll" and "item" exist, you can do (conj coll item), which
> > is the same as doing (conj [1 2 3 4 5] 6).
> >
> > But you cannot simply do (conj coll item), and this is not a "bug" in
> > the book, but rather a description of how conj works.
> >
> > --
> > Charlie Griefer
> > http://charlie.griefer.com/
> >
> > I have failed as much as I have succeeded. But I love my life. I love
> > my wife. And I wish you my kind of success.
>
>
>
> --
> Charlie Griefer
> http://charlie.griefer.com/
>
> I have failed as much as I have succeeded. But I love my life. I love
> my wife. And I wish you my kind of success.
>
> --
> 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
>



-- 
Russell Whitaker
http://twitter.com/OrthoNormalRuss / http://orthonormalruss.blogspot.com/
http://www.linkedin.com/pub/russell-whitaker/0/b86/329

-- 
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: Request for a hint

2012-11-17 Thread Charlie Griefer
For the record, I point out that its not a "bug" specifically because
you will see this many many many many times throughout the book. In
fact, pretty much any time a new function or form is introduced.

(function-name argument-1 argument-2 ... argument-n)

This is not real code meant to be pasted into the REPL and evaluated,
but rather a high level example of how a particular function works.

Hope that helps :)

On Sat, Nov 17, 2012 at 5:46 PM, Charlie Griefer
 wrote:
> On Sat, Nov 17, 2012 at 5:32 PM, Milen Ivanov  wrote:
>> Dear Mr. Chose,
>>
>> Thank you for your help!
>>
>> So, the "bug" is then in the book. Fine.
>
> There's no "bug" in the book.
>
> You copied sample code that's meant to show the syntax of using conj
> directly into the repo, using undeclared values.
>
> (conj coll item) is not meant to run on its own. It's demonstrating
> that the function conj takes a collection and an item, and returns a
> new collection with the item added on.
>
> So as BG pointed out, you can do:
>
> (conj [1 2 3] 4), in which [1 2 3] is a collection (vector) and 4 is
> the item to be conj'd, which returns a new vector [1 2 3 4].
> (conj '(1 2 3) 4), in which '(1 2 3) is a collection (list) and 4 is
> the item to be conj'd, which returns a new list (4 1 2 3)
>
> If you want to do (conj coll item) you need to define coll and item,
> which BG did as:
>
> (def coll [1 2 3 4 5])
> (def item 6)
>
> Now that "coll" and "item" exist, you can do (conj coll item), which
> is the same as doing (conj [1 2 3 4 5] 6).
>
> But you cannot simply do (conj coll item), and this is not a "bug" in
> the book, but rather a description of how conj works.
>
> --
> Charlie Griefer
> http://charlie.griefer.com/
>
> I have failed as much as I have succeeded. But I love my life. I love
> my wife. And I wish you my kind of success.



-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love
my wife. And I wish you my kind of success.

-- 
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: Request for a hint

2012-11-17 Thread Charlie Griefer
On Sat, Nov 17, 2012 at 5:32 PM, Milen Ivanov  wrote:
> Dear Mr. Chose,
>
> Thank you for your help!
>
> So, the "bug" is then in the book. Fine.

There's no "bug" in the book.

You copied sample code that's meant to show the syntax of using conj
directly into the repo, using undeclared values.

(conj coll item) is not meant to run on its own. It's demonstrating
that the function conj takes a collection and an item, and returns a
new collection with the item added on.

So as BG pointed out, you can do:

(conj [1 2 3] 4), in which [1 2 3] is a collection (vector) and 4 is
the item to be conj'd, which returns a new vector [1 2 3 4].
(conj '(1 2 3) 4), in which '(1 2 3) is a collection (list) and 4 is
the item to be conj'd, which returns a new list (4 1 2 3)

If you want to do (conj coll item) you need to define coll and item,
which BG did as:

(def coll [1 2 3 4 5])
(def item 6)

Now that "coll" and "item" exist, you can do (conj coll item), which
is the same as doing (conj [1 2 3 4 5] 6).

But you cannot simply do (conj coll item), and this is not a "bug" in
the book, but rather a description of how conj works.

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love
my wife. And I wish you my kind of success.

-- 
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: Request for a hint

2012-11-17 Thread Milen Ivanov
Dear Mr. Chose,

Thank you for your help! 

So, the "bug" is then in the book. Fine.

Best Regards,
Milen

On Saturday, November 17, 2012 7:05:12 PM UTC+2, Baishampayan Ghose wrote:
>
> Hi Milen,
>
> The function `conj` "conjoins" an item into a Clojure collection. In your 
> case, you need to define both `coll` and `item` for the example to work.
>
> Consider these examples -
>
> (conj [1 2 3] 4)
> (conj '(1 2 3) 4)
> (conj #{1 2 3} 4)
>
> (def coll [1 2 3 4 5])
> (def item 6)
>
> (conj coll item)
>
> etc.
>
> I hope that helps.
>
> -BG
>
>
>
> On Sat, Nov 17, 2012 at 10:15 AM, Milen Ivanov 
> 
> > wrote:
>
>> Dear All,
>>
>> I am trying to make sense of Closure by reading the book Programming 
>> Closure, 2nd Eddition.
>>
>> I persistently get booed at one of the very first lines of code in the 
>> book:
>>
>> (conj coll item)
>>
>> The listing (rather short) is below.
>>
>> May I please ask you for some hint because beginner's luck seems to have 
>> gone missing in this case.
>>
>> Thanks in advance!
>> Milen
>>
>>
>> milen@linux-oaty:~> cd ~/Dropbox/Clojure/clojure-1.4.0/
>> milen@linux-oaty:~/Dropbox/Clojure/clojure-1.4.0> java -cp 
>> clojure-1.4.0.jar clojure.main
>> Clojure 1.4.0
>> user=> (conj coll item)
>> CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
>> coll in this context, compiling:(NO_SOURCE_PATH:1) 
>> user=> (pst)
>> CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
>> coll in this context, compiling:(NO_SOURCE_PATH:1)
>> clojure.lang.Compiler.analyze (Compiler.java:6281)
>> clojure.lang.Compiler.analyze (Compiler.java:6223)
>> clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3548)
>> clojure.lang.Compiler.analyzeSeq (Compiler.java:6457)
>> clojure.lang.Compiler.analyze (Compiler.java:6262)
>> clojure.lang.Compiler.analyze (Compiler.java:6223)
>> clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5618)
>> clojure.lang.Compiler$FnMethod.parse (Compiler.java:5054)
>> clojure.lang.Compiler$FnExpr.parse (Compiler.java:3674)
>> clojure.lang.Compiler.analyzeSeq (Compiler.java:6453)
>> clojure.lang.Compiler.analyze (Compiler.java:6262)
>> clojure.lang.Compiler.eval (Compiler.java:6508)
>> Caused by:
>> RuntimeException Unable to resolve symbol: coll in this context
>> clojure.lang.Util.runtimeException (Util.java:170)
>> clojure.lang.Compiler.resolveIn (Compiler.java:6766)
>> clojure.lang.Compiler.resolve (Compiler.java:6710)
>> clojure.lang.Compiler.analyzeSymbol (Compiler.java:6671)
>> clojure.lang.Compiler.analyze (Compiler.java:6244)
>> clojure.lang.Compiler.analyze (Compiler.java:6223)
>> nil
>> user=> 
>>  
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@googlegroups.com 
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>
>
> -- 
> 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: Clojure to Haskell Compiler

2012-11-17 Thread Dennis Haupt
why not just use haskell instead? i doubt you can just convert the code

Am 17.11.2012 19:31, schrieb Ahmed Shafeeq Bin Mohd Shariff:
> Hi guys,
> 
> I've been frustrated with Clojure's slow speed on the JVM. I've been
> thinking of how it can be compiled to native and I feel that compiling
> Clojure to Haskell and then using ghc to convert this to native would be
> a good idea since Haskell has a large set of good libraries. What do you
> guys think? Would this be a fruitful endeavor for me to embark on?
> 
> -- 
> 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: CLJS-418: Unspecified dependency on google-closure-library-third-party

2012-11-17 Thread Stuart Sierra
The real question I'm hoping somebody can answer is: what changed to cause 
this? The G.Closure library or ClojureScript?

-S

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

Re: Clojure to Haskell Compiler

2012-11-17 Thread Brandon Bickford
Hey,

By slow speed, do you mean startup/compilation time or execution time
of running programs?  I have noticed that the execution time is
actually pretty good and can be close to Java execution time (if you
think Java execution time is good).

The startup/compilation time really bugs me.  I observed that the
interpreter requires ~1s past the JVM startup time to execute a small
program [1].

It seems like the most bang for your buck would be to try to improve
the JVM implementation since nearly everyone uses that and many people
wish to leverage the Java library ecosystem.

 - Brandon

--
1. http://dpaste.com/832616/


On Sat, Nov 17, 2012 at 10:31 AM, Ahmed Shafeeq Bin Mohd Shariff
 wrote:
> Hi guys,
>
> I've been frustrated with Clojure's slow speed on the JVM. I've been
> thinking of how it can be compiled to native and I feel that compiling
> Clojure to Haskell and then using ghc to convert this to native would be a
> good idea since Haskell has a large set of good libraries. What do you guys
> think? Would this be a fruitful endeavor for me to embark on?
>
> --
> 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: Clojurescript question

2012-11-17 Thread Mimmo Cosenza
I just submitted the first one few hours ago:

here is the page where I found the link to jira

http://clojure.org/contributing


and here is the jira url

http://dev.clojure.org/jira/secure/Dashboard.jspa

mimmo

On Nov 17, 2012, at 8:36 PM, Paul Gearon  wrote:

> Looking at the Clojurescript page on Github I can't find the appropriate 
> place to ask about potential bugs unless it's here. Can anyone help 
> please? (David?)
> 
> Meanwhile, in case it's the correct place, I've tried the following as a 
> simple test to run on Node.js:
> 
> ---
> (ns jpp.core)
> (defn -main [& args]
>   (.log js/console "Hello, World!\n"))
> (set! *main-cli-fn* -main)
> ---
> 
> This works OK.
> 
> However, the following will not work (though variations on this have been 
> seen to work):
> 
> ---
> (ns jpp.core)
> (defn -main []
>   (.log js/console "Hello, World!\n"))
> (-main)
> ---
> 
> The output in this case is as follows:
> 
> Hello, World!
> 
> 
> /Users/pag/src/test/clj/jpp/pp.js:72
> ments supported on functions"))}var Vd,Wd=j;function Xd(a,b){var c=a.q;if(a.m)
> ^
> TypeError: Cannot read property 'q' of null
> at Function.Xd [as b] (/Users/pag/src/test/clj/jpp/pp.js:72:280)
> at Object. (/Users/pag/src/test/clj/jpp/pp.js:157:244)
> at Module._compile (module.js:449:26)
> at Object.Module._extensions..js (module.js:467:10)
> at Module.load (module.js:356:32)
> at Function.Module._load (module.js:312:12)
> at Module.runMain (module.js:492:10)
> at process.startup.processNextTick.process._tickCallback (node.js:244:9)
> 
> 
> Interestingly, it's printed the correct output, but fails after. Also, do I 
> mention in the same place that I get a different set of errors when I try to 
> use the lein-cljsbuild plugin?
> 
> Regards,
> Paul Gearon
> 
> -- 
> 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

Clojurescript question

2012-11-17 Thread Paul Gearon
Looking at the Clojurescript page on Github I can't find the appropriate 
place to ask about potential bugs unless it's here. Can anyone help 
please? (David?)

Meanwhile, in case it's the correct place, I've tried the following as a 
simple test to run on Node.js:

---
(ns jpp.core)
(defn -main [& args]
  (.log js/console "Hello, World!\n"))
(set! *main-cli-fn* -main)
---

This works OK.

However, the following will not work (though variations on this have been 
seen to work):

---
(ns jpp.core)
(defn -main []
  (.log js/console "Hello, World!\n"))
(-main)
---

The output in this case is as follows:

Hello, World!


/Users/pag/src/test/clj/jpp/pp.js:72
ments supported on functions"))}var Vd,Wd=j;function Xd(a,b){var 
c=a.q;if(a.m)
^
TypeError: Cannot read property 'q' of null
at Function.Xd [as b] (/Users/pag/src/test/clj/jpp/pp.js:72:280)
at Object. (/Users/pag/src/test/clj/jpp/pp.js:157:244)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)


Interestingly, it's printed the correct output, but fails after. Also, do I 
mention in the same place that I get a different set of errors when I try 
to use the lein-cljsbuild plugin?

Regards,
Paul Gearon

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

Re: Clojure to Haskell Compiler

2012-11-17 Thread Baishampayan Ghose
Ahmed,

You're grossly underestimating the effort needed to accomplish something
like that.

Why don't you look at your Clojure code and figure out ways of optimizing
that instead?

-BG


On Sat, Nov 17, 2012 at 1:31 PM, Ahmed Shafeeq Bin Mohd Shariff <
sepultura.tri...@gmail.com> wrote:

> Hi guys,
>
> I've been frustrated with Clojure's slow speed on the JVM. I've been
> thinking of how it can be compiled to native and I feel that compiling
> Clojure to Haskell and then using ghc to convert this to native would be a
> good idea since Haskell has a large set of good libraries. What do you guys
> think? Would this be a fruitful endeavor for me to embark on?
>
> --
> 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




-- 
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: Clojure to Haskell Compiler

2012-11-17 Thread Andy Fingerhut
There have been several projects where people have begun developing Clojure to 
C or C++ translations, but I don't know how fleshed out those are.

ClojureC - https://github.com/schani/clojurec

Ferret - http://nakkaya.com/2011/06/29/ferret-an-experimental-clojure-compiler/

These do not have the advantage of a large library with the capabilities of 
Haskell's.

I've not programmed enough in either Python or Haskell to give good advice, but 
my impression from a distance is that Haskell's type system might make it 
difficult for automatically translated Clojure programs to take much advantage 
of Haskell's library, unless you basically created an "Object" type in Haskell 
that could hold objects of any type.  Perhaps clojure-py might be a better fit?

https://github.com/halgari/clojure-py

Anyway, some things you might be interested in looking at.

Andy


On Nov 17, 2012, at 10:31 AM, Ahmed Shafeeq Bin Mohd Shariff wrote:

> Hi guys,
> 
> I've been frustrated with Clojure's slow speed on the JVM. I've been thinking 
> of how it can be compiled to native and I feel that compiling Clojure to 
> Haskell and then using ghc to convert this to native would be a good idea 
> since Haskell has a large set of good libraries. What do you guys think? 
> Would this be a fruitful endeavor for me to embark on?

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


Clojure to Haskell Compiler

2012-11-17 Thread Ahmed Shafeeq Bin Mohd Shariff
Hi guys,

I've been frustrated with Clojure's slow speed on the JVM. I've been 
thinking of how it can be compiled to native and I feel that compiling 
Clojure to Haskell and then using ghc to convert this to native would be a 
good idea since Haskell has a large set of good libraries. What do you guys 
think? Would this be a fruitful endeavor for me to embark on?

-- 
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 large OOP codebase to clojure

2012-11-17 Thread abp
Use abstractions, forget inheritance.
Try modeling what the program does in terms of data conversion.
Then you will only need functions and data.

On Saturday, November 17, 2012 2:40:05 PM UTC+1, Jonathon McKitrick wrote:
>
> One project I've considered porting is highly OO, with a large number of 
> classes and several levels of inheritance.  In Common Lisp, I'd just use 
> CLOS.  What methodology would be good to translate such a project to 
> clojure, while maintaining heavy reuse of inherited behavior and 
> abstraction?

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

syntax for defrecord literals and tagged literals

2012-11-17 Thread Brent Millare
The syntax for defrecord literals and tagged literals is very similar.

user> (defrecord x [y])
user.x
user> #user.x[3]
#user.x{:y 3}
user> #user.x [3]
RuntimeException Unreadable constructor form starting with "#user.x " 
 clojure.lang.Util.runtimeException (Util.java:170)

[3]

Basically the difference is tagged literals have a space between the tag 
and the clojure data.

What are the reasons for this difference? Is there an advantage? To me it 
seems too similar that it could be a source of bugs in code.

My pro/con breakdown:
Pro
-Separate "namespace", we can have tags that have the same name as a 
classname.
Cons
-Source of compile time bugs when only one is defined. Source of runtime 
bugs if both the tag and class exist.
-more work for parsers

-- 
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: Request for a hint

2012-11-17 Thread Baishampayan Ghose
Hi Milen,

The function `conj` "conjoins" an item into a Clojure collection. In your
case, you need to define both `coll` and `item` for the example to work.

Consider these examples -

(conj [1 2 3] 4)
(conj '(1 2 3) 4)
(conj #{1 2 3} 4)

(def coll [1 2 3 4 5])
(def item 6)

(conj coll item)

etc.

I hope that helps.

-BG



On Sat, Nov 17, 2012 at 10:15 AM, Milen Ivanov wrote:

> Dear All,
>
> I am trying to make sense of Closure by reading the book Programming
> Closure, 2nd Eddition.
>
> I persistently get booed at one of the very first lines of code in the
> book:
>
> (conj coll item)
>
> The listing (rather short) is below.
>
> May I please ask you for some hint because beginner's luck seems to have
> gone missing in this case.
>
> Thanks in advance!
> Milen
>
>
> milen@linux-oaty:~> cd ~/Dropbox/Clojure/clojure-1.4.0/
> milen@linux-oaty:~/Dropbox/Clojure/clojure-1.4.0> java -cp
> clojure-1.4.0.jar clojure.main
> Clojure 1.4.0
> user=> (conj coll item)
> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
> coll in this context, compiling:(NO_SOURCE_PATH:1)
> user=> (pst)
> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
> coll in this context, compiling:(NO_SOURCE_PATH:1)
> clojure.lang.Compiler.analyze (Compiler.java:6281)
> clojure.lang.Compiler.analyze (Compiler.java:6223)
> clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3548)
> clojure.lang.Compiler.analyzeSeq (Compiler.java:6457)
> clojure.lang.Compiler.analyze (Compiler.java:6262)
> clojure.lang.Compiler.analyze (Compiler.java:6223)
> clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5618)
> clojure.lang.Compiler$FnMethod.parse (Compiler.java:5054)
> clojure.lang.Compiler$FnExpr.parse (Compiler.java:3674)
> clojure.lang.Compiler.analyzeSeq (Compiler.java:6453)
> clojure.lang.Compiler.analyze (Compiler.java:6262)
> clojure.lang.Compiler.eval (Compiler.java:6508)
> Caused by:
> RuntimeException Unable to resolve symbol: coll in this context
> clojure.lang.Util.runtimeException (Util.java:170)
> clojure.lang.Compiler.resolveIn (Compiler.java:6766)
> clojure.lang.Compiler.resolve (Compiler.java:6710)
> clojure.lang.Compiler.analyzeSymbol (Compiler.java:6671)
> clojure.lang.Compiler.analyze (Compiler.java:6244)
> clojure.lang.Compiler.analyze (Compiler.java:6223)
> nil
> user=>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en




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

Request for a hint

2012-11-17 Thread Milen Ivanov
Dear All,

I am trying to make sense of Closure by reading the book Programming 
Closure, 2nd Eddition.

I persistently get booed at one of the very first lines of code in the book:

(conj coll item)

The listing (rather short) is below.

May I please ask you for some hint because beginner's luck seems to have 
gone missing in this case.

Thanks in advance!
Milen


milen@linux-oaty:~> cd ~/Dropbox/Clojure/clojure-1.4.0/
milen@linux-oaty:~/Dropbox/Clojure/clojure-1.4.0> java -cp 
clojure-1.4.0.jar clojure.main
Clojure 1.4.0
user=> (conj coll item)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
coll in this context, compiling:(NO_SOURCE_PATH:1) 
user=> (pst)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: 
coll in this context, compiling:(NO_SOURCE_PATH:1)
clojure.lang.Compiler.analyze (Compiler.java:6281)
clojure.lang.Compiler.analyze (Compiler.java:6223)
clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3548)
clojure.lang.Compiler.analyzeSeq (Compiler.java:6457)
clojure.lang.Compiler.analyze (Compiler.java:6262)
clojure.lang.Compiler.analyze (Compiler.java:6223)
clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5618)
clojure.lang.Compiler$FnMethod.parse (Compiler.java:5054)
clojure.lang.Compiler$FnExpr.parse (Compiler.java:3674)
clojure.lang.Compiler.analyzeSeq (Compiler.java:6453)
clojure.lang.Compiler.analyze (Compiler.java:6262)
clojure.lang.Compiler.eval (Compiler.java:6508)
Caused by:
RuntimeException Unable to resolve symbol: coll in this context
clojure.lang.Util.runtimeException (Util.java:170)
clojure.lang.Compiler.resolveIn (Compiler.java:6766)
clojure.lang.Compiler.resolve (Compiler.java:6710)
clojure.lang.Compiler.analyzeSymbol (Compiler.java:6671)
clojure.lang.Compiler.analyze (Compiler.java:6244)
clojure.lang.Compiler.analyze (Compiler.java:6223)
nil
user=> 



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

Re: Are agents suitable for c10k concurrency?

2012-11-17 Thread László Török
Hi

I would only add, that with Clojure 1.5 you can supply your own Executor
using (send-via ), the default threadpools are not hard-wired anymore.

See
https://github.com/clojure/clojure/commit/f5f4faf95051f794c9bfa0315e4457b600c84cef#src/jvm/clojure/lang/Agent.javafor
further details.

Las

On Nov 17, 2012 3:24 PM, "Philip Potter"  wrote:
>
> send-off works by submitting a Runnable to a newCachedThreadPool.
>
>
http://stackoverflow.com/questions/11316737/managing-agent-thread-pools-in-clojure
>
> A Runnable sent to a thread pool will have exclusive use of that
> thread until it completes; therefore, greater concurrency can only be
> achieved by more threads, and 10k connections will need 10k threads.
>
> I don't know much about asynchronous IO implementations in Clojure,
> but agents probably aren't what you want.
>
> Phil
>
> On 17 November 2012 13:06, Elliot  wrote:
> > Hi all,
> >
> > I'm writing a c10k-style service, i.e. suppose 10,000 concurrent
> > connections, mostly IO-bound.  Clojure agents with `send-off` are
> > fantastically close to what I want conceptually, but I'm curious about
the
> > implementation details--can anyone confirm, this would end up forking
10,000
> > threads, which would presumably kill the system under context-switching
> > load?
> >
> > From what I understand, Erlang/Go have lightweight "actor" processes
which
> > are not true threads and are designed to have 10,000 of them spawned at
once
> > handling async-IO without problem.  I'd prefer to stick with Clojure if
> > possible but need to be able to handle the connection/IO-load.
> >
> > Anyone know how this works and/or has tried this in a production system?
> >
> > Any thoughts appreciated.  Thanks!
> >
> > - Elliot
> >
> > --
> > 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

ANN: Clojure/West - Portland, OR - Mar 18-20, 2013

2012-11-17 Thread Alex Miller
If you somehow missed the Conj, fear not! You can still attend a Clojure
conference soon!

Clojure/West will take place March 18-20th in the wonderful town of
Portland, Oregon. We will be using the Gerding Theater at the Armory as our
venue. Some portions of the conference will be single track like the conj
and some will be double-track.

Rich Hickey will be there and plans are underway for other great keynote
speakers. If you're interested in speaking, the Call for Presentations is
now open:

http://clojurewest.org/call-for-presentations/

Speakers will receive airfare (stipend if outside US) and hotel
compensation. The call closes on January 4th and I expect to notify
speakers and publish the schedule the following week.

If you have any questions or suggestions, please let me know.

Alex Miller

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

Designing for Simplicity

2012-11-17 Thread Oskar Kvist
Hi!

I have listened to Rich's presentation Simple Made Easy, and he has 
convinced me of the virtures of simplicity. However, I am not so good at 
designing simple stuff myself. Writing things down makes me think more 
clearly, and I was also hoping that you can help me by giving some input 
and critique. One of the tips he gave was just to think about "what, how, 
who, when, where and why", and try to break those aspects apart, so that's 
what I'm gonna try to do.  

Let's start with "what". I want to make a role-playing game. But this post 
is not just for the game I want to make; I want to get better at designing 
simple stuff in general. Throughout this thread, try to think of the game 
as just an example. I care more about the general ideas. Anyhow, let's 
quickly go over some requirements, so that we can come up with 
abstractions.  I want the game to be multiplayer, over a network. A player 
is a character that can fight monsters, pick up things, use things, gain 
experience, etc. Non-player character can be friendly or not, fight, talk, 
etc. There must obviously be a user inferface, with graphics, sound, and an 
input system.  There must be a way to save the players' progress. And, 
let's not forget, there is a world, an environment, in which the game takes 
place. 

Rich said that one should try to come up with abstractions.  "Form 
abstractions from related sets of functions." Ok, let's start with an easy 
one; there must be two functions (impure, but anyway) that can save and 
load a character from some storage on the server. So, we have a storage 
abstractions that can save and load stuff. 

I think that seems like a good abstraction. A storage is not only an 
abstractions, but kind of a major subsystem in the game. But let's take an 
example from Clojure; the seq abstraction. The seq abstraction is a bit 
different, because it is not a subsystem in the same way; seqs are used 
everywhere. So, in a similar vein, should there be abstractions for items, 
like "usable", "breakable", "pickupable"? It sounds nice, because there 
might be many concrete things that share these capabilities. But how would 
it work? It is players that pick things up, the items themselves do not do 
anything when they are being picked up. So maybe pickupable is a useless 
abstraction. Maybe there should be a container abstraction instead. What 
about usable? What happens when a player uses an item? All sorts of things 
could happen; to the player, to the item, or to anything else. The use 
function has to take the whole world as input. Should it be associated with 
the item? Maybe. What if the result of the use depends not only on the item 
but on the user? And maybe several different items should have the same 
effect/action.  Have I complected the action with the item by making the 
item implement usable, i.e. have its own use function? An alternative would 
be to have a table describing what happens when different items are used by 
different users. I guess the important question is: How do I tell if I 
should be introducing an abstraction like "usable"? By introducing an 
abstraction I guess I mean by defining a protocol. Also, instead of 
inventing a container abstraction, I could just put the items (values) in 
data structures. But those are collections---an abstraction that is 
essentially a container. Then I have regular values in regular collections, 
and I have not introduced any abstractions.  Maybe that's OK, but I have 
not really got used to this whole "program to abstractions" thing. 

Another problem is the user interface, i.e. the graphics and sound. The 
graphics subsystem should implement an abstraction, because if I wanted to 
change graphics library or whatever, the rest of the game code should not 
have to care. Do the grahpics and sound subsystems have something in 
common?  Should they share an abstraction? The difference between them is 
that everything needs to be drawn/shown all the time, while sounds are 
played in a more reactive manner, when certain things occur. Rich said that 
we should not complect "what" with "how". But when I start to think about 
an abstraction, I start to think about how these subsystems will work. I 
mean, the answer to "What (and not how) should a graphics subsystem do?" is 
"Show stuff." But how useful is that answer? There is, for example, a 
difference between just drawing static images that do not move, and drawing 
things that move around. Because you can't just draw stuff that move around 
once. Maybe I should think about the graphics that way, that everything is 
just drawn once. Then I could, every frame, just call draw and pretend that 
everything needs to be drawn every frame, instead of be moved in a scene 
graph, which is how 3d engines usually work. But, I still think about the 
"how" part. I'm thinking: "Well, if I get as input to the draw function 
something that is alreay in the scenec graph, then I will just update the 
position instead of adding 

Re: Are agents suitable for c10k concurrency?

2012-11-17 Thread Philip Potter
send-off works by submitting a Runnable to a newCachedThreadPool.

http://stackoverflow.com/questions/11316737/managing-agent-thread-pools-in-clojure

A Runnable sent to a thread pool will have exclusive use of that
thread until it completes; therefore, greater concurrency can only be
achieved by more threads, and 10k connections will need 10k threads.

I don't know much about asynchronous IO implementations in Clojure,
but agents probably aren't what you want.

Phil

On 17 November 2012 13:06, Elliot  wrote:
> Hi all,
>
> I'm writing a c10k-style service, i.e. suppose 10,000 concurrent
> connections, mostly IO-bound.  Clojure agents with `send-off` are
> fantastically close to what I want conceptually, but I'm curious about the
> implementation details--can anyone confirm, this would end up forking 10,000
> threads, which would presumably kill the system under context-switching
> load?
>
> From what I understand, Erlang/Go have lightweight "actor" processes which
> are not true threads and are designed to have 10,000 of them spawned at once
> handling async-IO without problem.  I'd prefer to stick with Clojure if
> possible but need to be able to handle the connection/IO-load.
>
> Anyone know how this works and/or has tried this in a production system?
>
> Any thoughts appreciated.  Thanks!
>
> - Elliot
>
> --
> 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


ClojureCLR: with-open in .NET 3.5 is unable to find .Dispose method on IDisposable

2012-11-17 Thread FC
Hi DavidM and ClojureCLR users,

In ClojureCLR built using .NET 3.5 framework, with-open needs some help 
finding the .Dispose method on IDisposable objects:

It occurs when calling with-open on RegistryKey and System.IO.BinaryWriter 
instances.

Here's the code snippet demonstrating this:

http://pastebin.com/KU3euWwJ

The problem doesn't occur in ClojureCLR built using .NET 4.0 framework.

Does anyone know a workaround?

Or should I file a bug?

Thank you.

-Fiel

-- 
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 large OOP codebase to clojure

2012-11-17 Thread Jonathon McKitrick
One project I've considered porting is highly OO, with a large number of 
classes and several levels of inheritance.  In Common Lisp, I'd just use 
CLOS.  What methodology would be good to translate such a project to 
clojure, while maintaining heavy reuse of inherited behavior and 
abstraction?

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

Are agents suitable for c10k concurrency?

2012-11-17 Thread Elliot


Hi all,

I'm writing a c10k-style service, i.e. suppose 10,000 concurrent 
connections, mostly IO-bound.  Clojure agents with `send-off` are 
fantastically close to what I want conceptually, but I'm curious about the 
implementation details--can anyone confirm, this would end up forking 
10,000 threads, which would presumably kill the system under 
context-switching load? 

>From what I understand, Erlang/Go have lightweight "actor" processes which 
are not true threads and are designed to have 10,000 of them spawned at 
once handling async-IO without problem.  I'd prefer to stick with Clojure 
if possible but need to be able to handle the connection/IO-load.

Anyone know how this works and/or has tried this in a production system?

Any thoughts appreciated.  Thanks!

- Elliot

-- 
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: Coding Standard - ns usage

2012-11-17 Thread Denis Labaye
On Mon, Nov 12, 2012 at 6:37 PM, Sean Corfield wrote:

> On Sun, Nov 11, 2012 at 10:31 PM, Denis Labaye 
> wrote:
> > Most of my Clojure usage is as a scripting language (where other would
> use
> > Python or Ruby).
> > I usually don't plan in advance how my program will be splitted in
> > namespaces :
> > I start from one namespace that does everything, let it grow, and split
> it
> > if it make sense.
>
> Ah, then your use of boilerplate makes sense.
>
> Don't you find the startup time of the JVM to be a disadvantage for
> using Clojure vs Python / Ruby?
>

 or even Bash :)

Yes the JVM startup time makes using the JVM impractical for "little
scripts".
I always have my Clojure "juggernaut project" open all the time , it's a
project with all the dependencies I am using, so when I need to use or
write some new Clojure code I don't have the penality of the JVM startup.

This is definitively not ideal, but it's working. May be improved with
projects that preload a JVM in advance (like Drip), or by using a client -
server model (exposing my "juggernaut project" as a REST API), to be able
to invoke it from the command line (curl, ...).
Or just waiting for project Jigsaw in Java 8 (or 9, or 10, ...?)


> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
>

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