clojurescript 0-.0-2227

2014-05-29 Thread t x
I just upgraded to clojurescript 0.0-2227

I now get the following error.

Anyone else run into this issue?

./lein pdo cljx auto, cljsbuild ao
to
Compiling ClojureScript.
Exception in thread main java.lang.RuntimeException: No such var:
deps/find-classpath-lib, compiling:(cljs/closure.clj:431:20)
at clojure.lang.Compiler.analyze(Compiler.java:6380)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3573)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2677)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6009)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:5973)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2669)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6009)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5139)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3751)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6558)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:529)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler.eval(Compiler.java:6623)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$use.doInvoke(core.clj:5507)
at clojure.lang.RestFn.invoke(RestFn.java:436)
at cljsbuild.compiler$eval9$loading__4910__auto10.invoke(compiler.clj:1)
at cljsbuild.compiler$eval9.invoke(compiler.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)

emacs + assert + syntax highlighting

2014-05-23 Thread t x
Hi,

  In my code, I have many lines like:

  (assert  )
  (assert  )
  (assert  )

  Now, is there a way to have the entire sexp highlighted in light
grey? (Rather than as normal code).

  The logic being assertions are meant more like comments, and when
reading, I'd prefer to not see them as normal code.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojurescript, sourcemaps, and debugging info

2014-05-18 Thread t x
On Sun, May 18, 2014 at 7:25 AM, Timothy Baldridge tbaldri...@gmail.com wrote:
 foo.cljs
 foo/whatever.cljs
 bar.cljs
 bar/stuff.cljs

 yes, do this, it also matches what most of the Clojure community does.



I'm convinced. Using this style now.



 On Sun, May 18, 2014 at 4:16 AM, Thomas Heller th.hel...@gmail.com wrote:

 Don't think plugins can touch the devtools.

 I tend to organize my code that the public interface of foo reside in
 foo.cljs and the implementation details go into foo/something.cljs so in
 your case you'd get

 foo.cljs
 foo/whatever.cljs
 bar.cljs
 bar/stuff.cljs

 Maybe an alternative solution to your problem.



 On Sunday, May 18, 2014 5:06:04 AM UTC+2, t x wrote:

 flat namespace is ugly. Someone please please tell me there is a
 better solution. :-) Is there no 10-line chrome-plugin which solves
 this?

 On Fri, May 16, 2014 at 7:35 AM, t x txre...@gmail.com wrote:
  Bah, I've reverted to a flat namespace, i.e. foo_internal.cljs,
  foo_public.cljs, bar_internal.cljs, bar_public.cljs ... :-)
 
  On Fri, May 16, 2014 at 6:24 AM, Tim Visher tim.v...@gmail.com wrote:
  Seems worth a bug report/feature request to the Chrome Dev Tools team.
 
  On Thu, May 15, 2014 at 11:45 PM, t x txre...@gmail.com wrote:
  Hi,
 
  * background:
 
* I have clojurescript + lein cljsbuild auto working perfectly
  fine.
 
* I have source maps working (when I click on a file in Chrome, it
  jumps me to the corresponding *.cljs file)
 
 
  * problem I am facing:
 
* I like to name my modules:
 
  foo/public.cljs
  foo/other-stuff.cljs
 
  bar/public.cljs
  bar/other-stuff.cljs
 
Now, Chrome + clojurescript (not sure who is at fault) appears to
  display not the _full name_, but only the _last part of the
  pathname_,
  so I get a bunch of lines saying things like:
 
 public.cljs:23
 public.cljs:68
 
and I have no idea whether it's foo/public.cljs or bar/public.cljs
  without clicking on it.
 
 
  * question:
 
Is there anyway to get Chrome / clojurescript to display the full
  name of the *.cljs file rather than just the last part?
 
  Thanks!
 
  --
  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
  ---
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To unsubscribe from this group and stop receiving emails from it,
  send an email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.
 
  --
  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
  ---
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




 --
 “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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from

Re: clojurescript, sourcemaps, and debugging info

2014-05-17 Thread t x
flat namespace is ugly. Someone please please tell me there is a
better solution. :-) Is there no 10-line chrome-plugin which solves
this?

On Fri, May 16, 2014 at 7:35 AM, t x txrev...@gmail.com wrote:
 Bah, I've reverted to a flat namespace, i.e. foo_internal.cljs,
 foo_public.cljs, bar_internal.cljs, bar_public.cljs ... :-)

 On Fri, May 16, 2014 at 6:24 AM, Tim Visher tim.vis...@gmail.com wrote:
 Seems worth a bug report/feature request to the Chrome Dev Tools team.

 On Thu, May 15, 2014 at 11:45 PM, t x txrev...@gmail.com wrote:
 Hi,

 * background:

   * I have clojurescript + lein cljsbuild auto working perfectly fine.

   * I have source maps working (when I click on a file in Chrome, it
 jumps me to the corresponding *.cljs file)


 * problem I am facing:

   * I like to name my modules:

 foo/public.cljs
 foo/other-stuff.cljs

 bar/public.cljs
 bar/other-stuff.cljs

   Now, Chrome + clojurescript (not sure who is at fault) appears to
 display not the _full name_, but only the _last part of the pathname_,
 so I get a bunch of lines saying things like:

public.cljs:23
public.cljs:68

   and I have no idea whether it's foo/public.cljs or bar/public.cljs
 without clicking on it.


 * question:

   Is there anyway to get Chrome / clojurescript to display the full
 name of the *.cljs file rather than just the last part?

 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojurescript, sourcemaps, and debugging info

2014-05-16 Thread t x
Bah, I've reverted to a flat namespace, i.e. foo_internal.cljs,
foo_public.cljs, bar_internal.cljs, bar_public.cljs ... :-)

On Fri, May 16, 2014 at 6:24 AM, Tim Visher tim.vis...@gmail.com wrote:
 Seems worth a bug report/feature request to the Chrome Dev Tools team.

 On Thu, May 15, 2014 at 11:45 PM, t x txrev...@gmail.com wrote:
 Hi,

 * background:

   * I have clojurescript + lein cljsbuild auto working perfectly fine.

   * I have source maps working (when I click on a file in Chrome, it
 jumps me to the corresponding *.cljs file)


 * problem I am facing:

   * I like to name my modules:

 foo/public.cljs
 foo/other-stuff.cljs

 bar/public.cljs
 bar/other-stuff.cljs

   Now, Chrome + clojurescript (not sure who is at fault) appears to
 display not the _full name_, but only the _last part of the pathname_,
 so I get a bunch of lines saying things like:

public.cljs:23
public.cljs:68

   and I have no idea whether it's foo/public.cljs or bar/public.cljs
 without clicking on it.


 * question:

   Is there anyway to get Chrome / clojurescript to display the full
 name of the *.cljs file rather than just the last part?

 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojurescript: modifying function definitions

2014-05-15 Thread t x
Dave, Mike: Noted. Will study this. Thanks!

On Wed, May 14, 2014 at 6:46 AM, Mike Haney txmikes...@gmail.com wrote:
 There's a library for that - https://github.com/technomancy/robert-hooke/

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


clojurescript, sourcemaps, and debugging info

2014-05-15 Thread t x
Hi,

* background:

  * I have clojurescript + lein cljsbuild auto working perfectly fine.

  * I have source maps working (when I click on a file in Chrome, it
jumps me to the corresponding *.cljs file)


* problem I am facing:

  * I like to name my modules:

foo/public.cljs
foo/other-stuff.cljs

bar/public.cljs
bar/other-stuff.cljs

  Now, Chrome + clojurescript (not sure who is at fault) appears to
display not the _full name_, but only the _last part of the pathname_,
so I get a bunch of lines saying things like:

   public.cljs:23
   public.cljs:68

  and I have no idea whether it's foo/public.cljs or bar/public.cljs
without clicking on it.


* question:

  Is there anyway to get Chrome / clojurescript to display the full
name of the *.cljs file rather than just the last part?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


clojurescript: modifying function definitions

2014-05-13 Thread t x
Suppose we had the following:


(defn stupid-wrapper [f args]
  (. js/console log args)
  (let [ans (f args)]
(. js/console log ans)
ans))

It basically logs the arguments + return value on every function call.


Now, suppose I wanted to do this to _functions that already existed_ .
Is there a way to do this?

I.e. someone already wrote:


(defn foo [ ... ] ... )

now, I want to do :

(black-magic! foo)

;; and have this wrap the foo function. Is there a way to make this work?

Thnaks!

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


simple static analysis in cljs process

2014-05-02 Thread t x
Hi,

  I'm currently running cljs with :optimizations none.

  I would like to inject a trivial static analysis phase of my cljs code.

  I.e, something like:

  *.cljs files - call a clojure function of mine, which sees
everything as sexps - standard pipeline to generate *.js files

  Is there any tutorial / mini example of how to do something like this?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


lein cljsbuild auto ; hook to copy into directory post build

2014-04-29 Thread t x
Hi,


## context:

  I am currently running lein cljsbuild auto

  It appears that each new compile _overwrites_ the old compile in place, say

  resources/out


## what I would prefer to happen:

  every time a new build is triggered, have it

write to resources/tmp
then, exec rm -rf resources/out; mv resources/tmp resources/out


## why I want this behaviour

  I'm also using live.js . It appears, that with longer compile times,
live.js is pulling in _half completed_ builds from lein -- and giving
me very weird errors.

  Thus, I would like lein to build somewhere else, then after a build
is complete, in a single atomic operation, swap the two directories
(which I can do via symlinks).

  Where can I setup a clojure/shell command to be executed every time
lein cljsbuild auto successfully completes a build?


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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: lein cljsbuild auto ; hook to copy into directory post build

2014-04-29 Thread t x
Correct answer:
https://github.com/emezeske/lein-cljsbuild/blob/master/sample.project.clj#L73
:-)

On Tue, Apr 29, 2014 at 2:29 PM, t x txrev...@gmail.com wrote:
 Hi,


 ## context:

   I am currently running lein cljsbuild auto

   It appears that each new compile _overwrites_ the old compile in place, say

   resources/out


 ## what I would prefer to happen:

   every time a new build is triggered, have it

 write to resources/tmp
 then, exec rm -rf resources/out; mv resources/tmp resources/out


 ## why I want this behaviour

   I'm also using live.js . It appears, that with longer compile times,
 live.js is pulling in _half completed_ builds from lein -- and giving
 me very weird errors.

   Thus, I would like lein to build somewhere else, then after a build
 is complete, in a single atomic operation, swap the two directories
 (which I can do via symlinks).

   Where can I setup a clojure/shell command to be executed every time
 lein cljsbuild auto successfully completes a build?


 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


clojurescript sandboxed code execution

2014-04-21 Thread t x
Hi,

  1) I'm writing code in Clojurescript.

  2) I want to have some level of user customizibility (i.e. think elisp)

  3) I want this to be sandboxed. (i.e. not full javascript)

  4) How do I do this in cljs, given I don't have eval?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


multiple browsers, live.js - repl

2014-04-15 Thread t x
Hi,

  Okay. I think I have finally reached the limits of live.js, and now
want an interactive browser repl + being able to push portions of code
(rather than reloading the entire page).

  I have a simple question though:

  * I'm developing a _distribued_ app

  * So I can't test it unless I have 2+ browsers running.

  * With brepl, when I modify my *.cljs files, is it possible to push
the changes to _two_ browsers simultaneojsly?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


auto include a certain line in all *.cljs files

2014-04-13 Thread t x
Hi,

  Can I edit some user.clj/config.clj/project.clj file, so that it's as if:

(:require-macros [swiss.arrows :refer (-)])

  is auto included in *every* cljs file ?

  [I dislike the constant repetition]

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: auto include a certain line in all *.cljs files

2014-04-13 Thread t x
What does 
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L209-L211
mean ?

In particular, I'm confused about:

 Forms to prepend to every form that is evaluated inside your project.

I only want to insert it right into the (ns ...) clause.

Thanks!


On Sun, Apr 13, 2014 at 10:49 AM, Kevin Ilchmann Jørgensen
kijm...@gmail.com wrote:
 Look at  :injections in
 https://github.com/technomancy/leiningen/blob/master/sample.project.clj.
 Would that help you?



 On Sun, Apr 13, 2014 at 7:36 PM, t x txrev...@gmail.com wrote:

 Hi,

   Can I edit some user.clj/config.clj/project.clj file, so that it's as
 if:

 (:require-macros [swiss.arrows :refer (-)])

   is auto included in *every* cljs file ?

   [I dislike the constant repetition]

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


cljs, websocket, autoreconnect

2014-04-13 Thread t x
Hi,

  For building robust cljs web apps, I'd like to have a uber
websocket which does the following:

  * when disconnected, it auto reconnects
  * and re-sends any messages that were not received

  Before I hand-roll my own hacks, I was wondering -- is there any
existing cljs library which already does this?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: true lightweight threads on clojurescript?

2014-04-09 Thread t x
I believe 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7
suffices.

However, it's currently Firefox only and no Chrome.

On Tue, Apr 8, 2014 at 8:51 PM, Timothy Baldridge tbaldri...@gmail.com wrote:
 What is going to fulfill a promise? How will you know when a promise is
 fulfilled. In a single threaded VM like JS you're stuck with callbacks.
 Nothing short of full program transformation will give you any better
 experience than core.async.

 A good way to look at it is this...if you do this in ClojureScript what
 javascript is this supposed to execute?

 (deref (promise))

 The only way this can work is with a code transform like go. Perhaps someday
 a new version of JS will arise that presents a different solution, but until
 then core.async is the best you're going to get.

 Timothy


 On Tue, Apr 8, 2014 at 3:11 PM, t x txrev...@gmail.com wrote:

 I'm guilty of the X-Y problem.


 I'm trying to, inside of CLJS, write a simple WebOS.


 So I want to simultaneously be able to run things like:
   * a notepad app
   * an IRC app
   * a webRTC video chat app


 I have built each of these individual pieces in CLJS, -- but combining
 them / having them work well together in a clean, non-spaghetti way is
 harder than I thought.



 ### The main problems here I have are:

   * multi-threading (run all three apps at once) and
   * have is inter-process (in this case app) communication


 I'd also prefer to do this in a way where I write each app as if it's
 the only app running (i.e. no callback hell.)


 One possible approach is to make each app a go-thread, but then I
 run into the issue of:

   (go ... (! ... ) (! ... )) all forced into the same lexical function.



 I'm looking for alternatives to this. By using:

   settimeout(func, 0); I should be able to fire off 3 threads

   now, if I had something like promises, I can do inter-process
 communication



 I'm still working this through -- so if my thinking is sloppy /
 unclear, please point it out so I can make it clearer.


 Thanks!

 On Tue, Apr 8, 2014 at 2:05 PM, James Reeves ja...@booleanknot.com
 wrote:
  What exactly are you trying to do? Could you describe the problem you're
  trying to solve in more detail?
 
  - James
 
 
  On 8 April 2014 22:02, t x txrev...@gmail.com wrote:
 
  I'd really like to avoid callbacks. :-)
 
  If cljs had promises, it would suffice. :-)
 
  On Tue, Apr 8, 2014 at 2:00 PM, Gary Trakhman gary.trakh...@gmail.com
  wrote:
   I think you might be able to use put! with a callback, or (go (!
   ..))
   within foo for a transient go process.  Not sure if there's any ill
   effects.
  
  
   On Tue, Apr 8, 2014 at 4:51 PM, t x txrev...@gmail.com wrote:
  
   Hi,
  
  
 * I am aware of core.async. However, I don't like the fact that
   (go
   ... ) is a macro, thus forcing the ! and ! to appear in the
   body,
   and I can't do nested things like:
  
 (defn foo [chan]
(let [x (! chan)] ... ))
  
 (go ... (foo ... ))
  
  
 * For the following, I only need it to work in ClojureScript. I
   don't need it to work in Clojure. Furthermore, we can assume browser
   =
   latest Firefox, or browser = latest Chrome.
  
  
 Now, my question: is there a library which provides true
   lightweight Clojurescript threads?
  
  
   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 unsubscribe from this group and stop receiving emails from it,
   send
   an
   email to clojure+unsubscr...@googlegroups.com.
   For more options, visit https://groups.google.com/d/optout.
  
  
   --
   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 unsubscribe from this group and stop receiving emails from it,
   send
   an
   email to clojure+unsubscr...@googlegroups.com.
   For more options, visit https://groups.google.com/d/optout.
 
  --
  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

Re: rant / cljs in cljs ? :-)

2014-04-09 Thread t x
I recently started using livejs.

It's fucking awesome.

basically livejs + lein cljsbuild auto (without cljx) + optimizations :none =

* I edit code in emacs.
* I hit C-x C-s
* I see compiling window flyby in milliseconds.
* I see browser reload.

This is happiness. :-)

On Sat, Apr 5, 2014 at 4:52 PM, Dave Sann daves...@gmail.com wrote:
 or livejs

 http://livejs.com/


 On Sunday, 6 April 2014 04:58:51 UTC+10, Henrik Eneroth wrote:

 If that is your criterion, use something that reloads the browser
 automatically when the js is changed. I use CodeKit personally.

 On Wednesday, April 2, 2014 10:09:45 PM UTC+2, lypanov wrote:

 I hate REPLs. I also hate large compile times.
 For me the hardest part of the ~5s compile time is not waiting, it's the
 watching of the progress of the auto build and waiting until exactly that
 moment
 before pressing reload in the browser.

 That being said, I find run this currently selected code block in my
 connected browser functionality in editors (lighttable is the one I
 use/know) to be
 the best solution to this problem. It's painful as hell at first though.

 I had a work around in the past via a fork of noir-cljs which would delay
 the load of the .js files until compile completed via some hacks but
 now that I've switched to a browser  editor work flow I find myself
 doing as much work as possible in the editor via the run it in the browser
 REPL
 script tag trick from  lighttable that I'm no longer even noticing
 compile times. I leave them to the end of the pomodoro.

 On Friday, March 21, 2014 7:48:59 AM UTC+1, t x wrote:

 Hi,

 *  I'm already using:

   :incremental true
   :compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

   Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

   Furthermore, I'm _okay_ with their being a big delay every time I
 introduce a new macro from clj land.


   I realize this sounds spoiled -- but -- the cljs compiler delays are
 really really breaking my flow.


 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: true lightweight threads on clojurescript?

2014-04-09 Thread t x
For the purposes of building a webos:

Having yield + co-routines gives me cooperative multi-threading --
which is basically all I need.


The main difference between co-routines and go-routines. Is that for
(go ... ) blocks, the ! and ! must be lexically embedded within the
block; whereas with co-routines, the send/receive can be called in
functions I call.


On Wed, Apr 9, 2014 at 1:11 AM, Moritz Ulrich mor...@tarn-vedra.de wrote:
 What on this page would solve your problem? I just see
 Generators/Iterators, Array Comprehensions, lexical let and
 destructuring assignment.

 On Wed, Apr 9, 2014 at 9:39 AM, t x txrev...@gmail.com wrote:
 I believe 
 https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.7
 suffices.

 However, it's currently Firefox only and no Chrome.

 On Tue, Apr 8, 2014 at 8:51 PM, Timothy Baldridge tbaldri...@gmail.com 
 wrote:
 What is going to fulfill a promise? How will you know when a promise is
 fulfilled. In a single threaded VM like JS you're stuck with callbacks.
 Nothing short of full program transformation will give you any better
 experience than core.async.

 A good way to look at it is this...if you do this in ClojureScript what
 javascript is this supposed to execute?

 (deref (promise))

 The only way this can work is with a code transform like go. Perhaps someday
 a new version of JS will arise that presents a different solution, but until
 then core.async is the best you're going to get.

 Timothy


 On Tue, Apr 8, 2014 at 3:11 PM, t x txrev...@gmail.com wrote:

 I'm guilty of the X-Y problem.


 I'm trying to, inside of CLJS, write a simple WebOS.


 So I want to simultaneously be able to run things like:
   * a notepad app
   * an IRC app
   * a webRTC video chat app


 I have built each of these individual pieces in CLJS, -- but combining
 them / having them work well together in a clean, non-spaghetti way is
 harder than I thought.



 ### The main problems here I have are:

   * multi-threading (run all three apps at once) and
   * have is inter-process (in this case app) communication


 I'd also prefer to do this in a way where I write each app as if it's
 the only app running (i.e. no callback hell.)


 One possible approach is to make each app a go-thread, but then I
 run into the issue of:

   (go ... (! ... ) (! ... )) all forced into the same lexical function.



 I'm looking for alternatives to this. By using:

   settimeout(func, 0); I should be able to fire off 3 threads

   now, if I had something like promises, I can do inter-process
 communication



 I'm still working this through -- so if my thinking is sloppy /
 unclear, please point it out so I can make it clearer.


 Thanks!

 On Tue, Apr 8, 2014 at 2:05 PM, James Reeves ja...@booleanknot.com
 wrote:
  What exactly are you trying to do? Could you describe the problem you're
  trying to solve in more detail?
 
  - James
 
 
  On 8 April 2014 22:02, t x txrev...@gmail.com wrote:
 
  I'd really like to avoid callbacks. :-)
 
  If cljs had promises, it would suffice. :-)
 
  On Tue, Apr 8, 2014 at 2:00 PM, Gary Trakhman gary.trakh...@gmail.com
  wrote:
   I think you might be able to use put! with a callback, or (go (!
   ..))
   within foo for a transient go process.  Not sure if there's any ill
   effects.
  
  
   On Tue, Apr 8, 2014 at 4:51 PM, t x txrev...@gmail.com wrote:
  
   Hi,
  
  
 * I am aware of core.async. However, I don't like the fact that
   (go
   ... ) is a macro, thus forcing the ! and ! to appear in the
   body,
   and I can't do nested things like:
  
 (defn foo [chan]
(let [x (! chan)] ... ))
  
 (go ... (foo ... ))
  
  
 * For the following, I only need it to work in ClojureScript. I
   don't need it to work in Clojure. Furthermore, we can assume browser
   =
   latest Firefox, or browser = latest Chrome.
  
  
 Now, my question: is there a library which provides true
   lightweight Clojurescript threads?
  
  
   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 unsubscribe from this group and stop receiving emails from it,
   send
   an
   email to clojure+unsubscr...@googlegroups.com.
   For more options, visit https://groups.google.com/d/optout.
  
  
   --
   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

Re: true lightweight threads on clojurescript?

2014-04-09 Thread t x
Regarding yield:

  Understood, thanks for clarifying my misunderstandings!

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


true lightweight threads on clojurescript?

2014-04-08 Thread t x
Hi,


  * I am aware of core.async. However, I don't like the fact that (go
... ) is a macro, thus forcing the ! and ! to appear in the body,
and I can't do nested things like:

  (defn foo [chan]
 (let [x (! chan)] ... ))

  (go ... (foo ... ))


  * For the following, I only need it to work in ClojureScript. I
don't need it to work in Clojure. Furthermore, we can assume browser =
latest Firefox, or browser = latest Chrome.


  Now, my question: is there a library which provides true
lightweight Clojurescript threads?


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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: true lightweight threads on clojurescript?

2014-04-08 Thread t x
I'd really like to avoid callbacks. :-)

If cljs had promises, it would suffice. :-)

On Tue, Apr 8, 2014 at 2:00 PM, Gary Trakhman gary.trakh...@gmail.com wrote:
 I think you might be able to use put! with a callback, or (go (! ..))
 within foo for a transient go process.  Not sure if there's any ill effects.


 On Tue, Apr 8, 2014 at 4:51 PM, t x txrev...@gmail.com wrote:

 Hi,


   * I am aware of core.async. However, I don't like the fact that (go
 ... ) is a macro, thus forcing the ! and ! to appear in the body,
 and I can't do nested things like:

   (defn foo [chan]
  (let [x (! chan)] ... ))

   (go ... (foo ... ))


   * For the following, I only need it to work in ClojureScript. I
 don't need it to work in Clojure. Furthermore, we can assume browser =
 latest Firefox, or browser = latest Chrome.


   Now, my question: is there a library which provides true
 lightweight Clojurescript threads?


 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: true lightweight threads on clojurescript?

2014-04-08 Thread t x
I'm guilty of the X-Y problem.


I'm trying to, inside of CLJS, write a simple WebOS.


So I want to simultaneously be able to run things like:
  * a notepad app
  * an IRC app
  * a webRTC video chat app


I have built each of these individual pieces in CLJS, -- but combining
them / having them work well together in a clean, non-spaghetti way is
harder than I thought.



### The main problems here I have are:

  * multi-threading (run all three apps at once) and
  * have is inter-process (in this case app) communication


I'd also prefer to do this in a way where I write each app as if it's
the only app running (i.e. no callback hell.)


One possible approach is to make each app a go-thread, but then I
run into the issue of:

  (go ... (! ... ) (! ... )) all forced into the same lexical function.



I'm looking for alternatives to this. By using:

  settimeout(func, 0); I should be able to fire off 3 threads

  now, if I had something like promises, I can do inter-process communication



I'm still working this through -- so if my thinking is sloppy /
unclear, please point it out so I can make it clearer.


Thanks!

On Tue, Apr 8, 2014 at 2:05 PM, James Reeves ja...@booleanknot.com wrote:
 What exactly are you trying to do? Could you describe the problem you're
 trying to solve in more detail?

 - James


 On 8 April 2014 22:02, t x txrev...@gmail.com wrote:

 I'd really like to avoid callbacks. :-)

 If cljs had promises, it would suffice. :-)

 On Tue, Apr 8, 2014 at 2:00 PM, Gary Trakhman gary.trakh...@gmail.com
 wrote:
  I think you might be able to use put! with a callback, or (go (! ..))
  within foo for a transient go process.  Not sure if there's any ill
  effects.
 
 
  On Tue, Apr 8, 2014 at 4:51 PM, t x txrev...@gmail.com wrote:
 
  Hi,
 
 
* I am aware of core.async. However, I don't like the fact that (go
  ... ) is a macro, thus forcing the ! and ! to appear in the body,
  and I can't do nested things like:
 
(defn foo [chan]
   (let [x (! chan)] ... ))
 
(go ... (foo ... ))
 
 
* For the following, I only need it to work in ClojureScript. I
  don't need it to work in Clojure. Furthermore, we can assume browser =
  latest Firefox, or browser = latest Chrome.
 
 
Now, my question: is there a library which provides true
  lightweight Clojurescript threads?
 
 
  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 unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.
 
 
  --
  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 unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/d/optout.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


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

hacked up erldn

2014-04-06 Thread t x
Hi,


  I'm announcing my first (epsilon) contribution back to the Erlang community:

  https://github.com/txrev319/erldn -- a slightly hacked up fork of
the original erldn.


  The main use case is:

  * I'm using clojurescript on the client side. I need to use erlang
on the server side.


  The changes are as follows:

  * vector, sets == all goes to lists, instead of {vector, ... } and
{set, ... }
  * maps == goes to erlan17 maps, instead of {map, ... }

  * keywords == goes to {keyword, name} rather than name  [this is
to avoid denial of service attacks by generating lots of atoms via new
keywords]


  The main principle here is that cljs / erlang data structures
should look as similar as possible. cljs sequences = erlang
sequences; cljs maps = erlang maps. :-)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: alternative syntax for Clojure? Haskell?

2014-04-05 Thread t x
The way I think about syntax is:

Given:

  * my brain has limited processing power (measured in kilo-hertz ?)
  * my brain has very limited L1 cache

Question:

  * do I want to store the operator-precedence + left/right
associativity rules of Haskell operators in my brain
  * spend brain cycles pattern matching the above to even _read_ the code?

:-)


Having said that, I also feel, within the limits of (), one can do
creative things, like swiss arrows.

(- ...
   ( ...  ... ))

This example allows for cool syntax, but has 0 intellectual overhead.

On Sat, Apr 5, 2014 at 11:05 AM, Joseph Smith j...@uwcreations.com wrote:
 Clojure syntax (I.e. parentheses) enable features in the language- you can't
 remove them without sacrificing functionality.

 Personally, I feel the uniformity of Clojure syntax makes it easier for me
 to reason about code. When I'm working in a language like, say, Ruby, I have
 to think ahead about whether or not I need/will need delimiters (e.g.
 parentheses) depending on how I'm composing code.

 ---
 Joseph Smith
 @solussd


 On Apr 5, 2014, at 12:57 PM, Timothy Baldridge tbaldri...@gmail.com wrote:

 I find Haskell syntax completely unreadable. Just saying

 On Apr 5, 2014 11:36 AM, Travis Wellman twell...@gmail.com wrote:

 When I started learning Haskell after a year or more of Clojure, the
 syntax was refreshing, and I found myself wishing I could write Clojure with
 Haskell syntax.

 Later I left Clojure behind for plain Java because of code maintenance
 issues. I had been writing elegant but deeply nested Clojure code that was
 very difficult to read and realized that Clojure nurtures this propensity in
 its users. Though it's possible to write flatter more linear, more readable,
 more maintainable code, I didn't really want to, and other languages are
 designed for such.

 Now I'm coming back to those old discoveries again, and thinking about
 Clojure, and wondering how much work it would be to write a new Haskell-ish
 syntax for using Clojure. I was just looking at core.logic tests, which are
 a perfect example of hard-to-read, using single letter variables, few
 newlines, and zero comments.

 To be clear, in this topic I'm not interested in the functional purity of
 Haskell, nor it's libraries or type system, but just the syntax.

 Has anyone had a similar experience?

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop 

cljsbuild dev/release, different debug levels

2014-04-03 Thread t x
Hi,

  I'm trying to figure out how to do the following:

  Have a shared cljs/* ...

  For the dev build, have (debug ...) compile to (js/console.log ...)

  For the release build, have (debug ...) compile to (do).

  Basically, I want different things to happen depending on whether
the build is dev or release.

  Does anyone have an example of how to do this?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cljsbuild dev/release, different debug levels

2014-04-03 Thread t x
I don't use cljx. It slows down lein cljsbuild auto.

I'm using pure clojurescript. Is there a way to get the dev /
release tag passed somehow?

On Thu, Apr 3, 2014 at 6:58 AM, Alex Robbins
alexander.j.robb...@gmail.com wrote:
 If you used cljx, you could probably use the feature expressions to do what
 you want.

 https://github.com/lynaghk/cljx

 You'd need to set up a custom rule for it, but it seems well within the
 scope of the project.


 On Thu, Apr 3, 2014 at 8:50 AM, t x txrev...@gmail.com wrote:

 Hi,

   I'm trying to figure out how to do the following:

   Have a shared cljs/* ...

   For the dev build, have (debug ...) compile to (js/console.log ...)

   For the release build, have (debug ...) compile to (do).

   Basically, I want different things to happen depending on whether
 the build is dev or release.

   Does anyone have an example of how to do this?

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cljsbuild dev/release, different debug levels

2014-04-03 Thread t x
The correct statement should be: I *no longer* use cljx. :-)

On Thu, Apr 3, 2014 at 8:05 AM, t x txrev...@gmail.com wrote:
 I don't use cljx. It slows down lein cljsbuild auto.

 I'm using pure clojurescript. Is there a way to get the dev /
 release tag passed somehow?

 On Thu, Apr 3, 2014 at 6:58 AM, Alex Robbins
 alexander.j.robb...@gmail.com wrote:
 If you used cljx, you could probably use the feature expressions to do what
 you want.

 https://github.com/lynaghk/cljx

 You'd need to set up a custom rule for it, but it seems well within the
 scope of the project.


 On Thu, Apr 3, 2014 at 8:50 AM, t x txrev...@gmail.com wrote:

 Hi,

   I'm trying to figure out how to do the following:

   Have a shared cljs/* ...

   For the dev build, have (debug ...) compile to (js/console.log ...)

   For the release build, have (debug ...) compile to (do).

   Basically, I want different things to happen depending on whether
 the build is dev or release.

   Does anyone have an example of how to do this?

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: dependencies from github

2014-03-29 Thread t x
Ray, David, Aaron, Phil, dgrnbrg:

  Understood. Thanks for clarifying my misunderstandings!

On Thu, Mar 27, 2014 at 10:39 AM, dgrnbrg dsg123456...@gmail.com wrote:
 Voom is a Lein plugin that lets you depend on a repository and pins you to a 
 specific commit. It also provides tools manage systems spanning multiple 
 repos. You can find it here: https://github.com/LonoCloud/lein-voom and see 
 the video from clojure/west here: 
 https://m.youtube.com/watch?v=axztcYJUN4Ilist=PLZdCLR02grLp__wRg5OTavVj4wefg69hM

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


dependencies from github

2014-03-27 Thread t x
Hi,

## Context:

  * I'm using lein.
  * In my project.clj, I have something like:

:dependencies[ [org.clojure/clojure 1.5.1]
  [org.clojure/clojurescript 0.0.-2173]
  [not-really-trusted-package version]]

  Now, I don't like pulling not-really-trusted-package, which can
change under me. Instead I'd prefer to:

  (1) git fork the not-really-trusted package to
github/txrev319/not-really-trusted
  (2) have lein pull from github/txrev319/not-really-trusted

## Question:

  How do I achieve the above?

Thanks!

(I still don't trust the package, but atleast I want to use the same
untrusted package every time.)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


optimal way to generate/store/compare 256/512/1024 bytes

2014-03-23 Thread t x
Hi,

  In my _cljs_ code, I need to generate keys by:

  * randomly generating a 256/512/1024-bit object
  * testing that it hasn't been used before (and if it's already used,
pick another random value)

  The only use of these ids is as keys to a map. Thus, I would like to
have efficient tests for (1) equality and (2) comparison and (3)
possibly hashing.

  Now, my question is: what is the optimal format for these keys? (not
generate -- which I can do via some prg)

  Should I be using a string, an array of integers, or ... ?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: rant / cljs in cljs ? :-)

2014-03-22 Thread t x
I stopped using cljx, and lein cljsbuild auto is amazingly fast.

It does look like timing issues / how cljx/cljsbuild auto triggers
work is the issue.

Someone (that happens to be suffering more from this issue) please fix it. :-)

On Fri, Mar 21, 2014 at 4:31 PM, Moritz Ulrich mor...@tarn-vedra.de wrote:

 I really hope that a small plugin to coordinate cljx/cljsbuild will show
 up in the near future. I found cljsbuild's crossovers much better
 integrated and easier to use (but still far inferior to cljx).

 I agree that a REPL based workflow is much superior, especially with
 tools like Om which remove the need to coordinate DOM updates.

 Chas Emerick writes:

 This particular trick is a clever one (that I'm afraid I've had some
 hand in propagating, for the benefit of those that like an  auto +
 browser refresh workflow), but it's never going to be particularly
 efficient.  By its very nature, pdo sets up cljx and cljsbuild off and
 running without any coordination; it's equivalent to running the two
 tasks in separate processes.

 It's possible that some hooks may become available in cljsbuild so that
 things like cljx can do what they like prior to each compile, but that's
 speculative.

 IMO, a REPL-based workflow is far superior to anything involving
 reloading your app's page, insofar as you can (nearly always) apply the
 changes you're working on without blowing away the state of the app.  In
 this context, cljx's nREPL middleware excels (but unfortunately cannot
 be used with the stock ClojureScript browser-REPL; check out Austin).

 Note that cljx has not been optimized _at all_.  It's fast enough for
 my purposes (i.e. reasonable when doing a clean rebuild, and snappy when
 doing the small changes typical in a REPL). I'd be happy to merge
 reasonable patches that make the actual cljx transformation faster.

 - Chas

 On 03/21/2014 01:23 PM, t x wrote:
 I'm using:

 lein pdo cljx auto,cljsbuild auto dev'

 However, maybe perhaps it's weird timing interaction between cljx and
 cljsbuild that's making the lag appear more than it actually is.

 On Fri, Mar 21, 2014 at 8:27 AM, David Nolen dnolen.li...@gmail.com wrote:
 Unless you're compiling a very large file - with auto :optimizations :none
 you should always get sub-second compile times under auto.

 David


 On Fri, Mar 21, 2014 at 10:55 AM, Timothy Baldridge tbaldri...@gmail.com
 wrote:
 are you using lein cljsbuild auto ? That's what I use, and I get about
 1-3 sec recompile times for stuff that uses core.async.

 Timothy


 On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:
 Hi,

 *  I'm already using:

:incremental true
:compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

Furthermore, I'm _okay_ with their being a big delay every time I
 introduce a new macro from clj land.


I realize this sounds spoiled -- but -- the cljs compiler delays are
 really really breaking my flow.


 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.



 --
 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

 --
 You received this message because you are subscribed to the Google

cljsbuild hooks + rsync/ssh

2014-03-22 Thread t x
Hi,

  This sounds sorta silly:

  I'm already running lein cljsbuild auto

  Now, whenver the build completes (definitely when it succeeds; I
don't care what happens when it fails), I would like to trigger an
rsync or ssh to copy the resources/release/*.js files to a remote
machine.

  Is there a standard way to setup these hooks?

Thanks!

My situation is as follows:

  *.cljs files are on my laptop
  lein is on my laptop

  actual webserver is a weak digital ocean droplet

  whenever my (relatively powerful) laptop finishes compiling, I want
my *.js files sent over to the droplet

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: rant / cljs in cljs ? :-)

2014-03-22 Thread t x
Unlike you (involved in all three), I'm involved in 0 of the tools.

From a very short-sighted view, it seems the problem is that lein
configuration is not clojure code.

It seems what I want is to setup core.async channels:

  * a channel that gets an item whenever my foo/cljx directory changes
  * a channel for cljx to notify cljsbuild that foo/out-cljs has new
data and should be recompiled



On Sat, Mar 22, 2014 at 8:19 AM, Chas Emerick c...@cemerick.com wrote:
 Despite numerous requests, I have so far resisted integrating cljsbuild,
 cljx, and clojurescript.test.  I noted my sentiments on this topic in a
 comment here some time ago:

 https://github.com/lynaghk/cljx/issues/25

 I haven't thought about it much since then, but I suspect I will relent at
 some point.  That said, any integration amongst these various tools will
 need to be open enough that alternatives can be used as desired (e.g. surely
 clojurescript.test is not the last word in ClojureScript testing??).

 - Chas


 On 03/22/2014 05:26 AM, t x wrote:

 I stopped using cljx, and lein cljsbuild auto is amazingly fast.

 It does look like timing issues / how cljx/cljsbuild auto triggers
 work is the issue.

 Someone (that happens to be suffering more from this issue) please fix it.
 :-)

 On Fri, Mar 21, 2014 at 4:31 PM, Moritz Ulrich mor...@tarn-vedra.de
 wrote:

 I really hope that a small plugin to coordinate cljx/cljsbuild will show
 up in the near future. I found cljsbuild's crossovers much better
 integrated and easier to use (but still far inferior to cljx).

 I agree that a REPL based workflow is much superior, especially with
 tools like Om which remove the need to coordinate DOM updates.

 Chas Emerick writes:

 This particular trick is a clever one (that I'm afraid I've had some
 hand in propagating, for the benefit of those that like an  auto +
 browser refresh workflow), but it's never going to be particularly
 efficient.  By its very nature, pdo sets up cljx and cljsbuild off and
 running without any coordination; it's equivalent to running the two
 tasks in separate processes.

 It's possible that some hooks may become available in cljsbuild so that
 things like cljx can do what they like prior to each compile, but that's
 speculative.

 IMO, a REPL-based workflow is far superior to anything involving
 reloading your app's page, insofar as you can (nearly always) apply the
 changes you're working on without blowing away the state of the app.  In
 this context, cljx's nREPL middleware excels (but unfortunately cannot
 be used with the stock ClojureScript browser-REPL; check out Austin).

 Note that cljx has not been optimized _at all_.  It's fast enough for
 my purposes (i.e. reasonable when doing a clean rebuild, and snappy when
 doing the small changes typical in a REPL). I'd be happy to merge
 reasonable patches that make the actual cljx transformation faster.

 - Chas

 On 03/21/2014 01:23 PM, t x wrote:

 I'm using:

 lein pdo cljx auto,cljsbuild auto dev'

 However, maybe perhaps it's weird timing interaction between cljx and
 cljsbuild that's making the lag appear more than it actually is.

 On Fri, Mar 21, 2014 at 8:27 AM, David Nolen dnolen.li...@gmail.com
 wrote:

 Unless you're compiling a very large file - with auto :optimizations
 :none
 you should always get sub-second compile times under auto.

 David


 On Fri, Mar 21, 2014 at 10:55 AM, Timothy Baldridge
 tbaldri...@gmail.com
 wrote:

 are you using lein cljsbuild auto ? That's what I use, and I get
 about
 1-3 sec recompile times for stuff that uses core.async.

 Timothy


 On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:

 Hi,

 *  I'm already using:

 :incremental true
 :compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though
 it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

 Is there any cljs in cljs _slow_ interpreter? I'm perfectly
 happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

 Furthermore, I'm _okay_ with their being a big delay every time
 I
 introduce a new macro from clj land.


 I realize this sounds spoiled -- but -- the cljs compiler delays
 are
 really really breaking my flow.


 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 unsubscribe from this group and stop receiving emails from it,
 send

rant / cljs in cljs ? :-)

2014-03-21 Thread t x
Hi,

*  I'm already using:

  :incremental true
  :compiler { :optimizations :none }

* I'm also aware of cljs brepl


However:

1) the cljs compiler is still too slow for my liking (even though it's
not calling closure)

2) I don't like the cljs repl nearly as much as I like the clj repl


Now, my dumb/stupid question:

  Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
with an interpreter that runs 10x slower, if, in exchange, I get to
hit refresh and my new code starts running.

  Furthermore, I'm _okay_ with their being a big delay every time I
introduce a new macro from clj land.


  I realize this sounds spoiled -- but -- the cljs compiler delays are
really really breaking my flow.


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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: rant / cljs in cljs ? :-)

2014-03-21 Thread t x
I'm using:

lein pdo cljx auto,cljsbuild auto dev'

However, maybe perhaps it's weird timing interaction between cljx and
cljsbuild that's making the lag appear more than it actually is.

On Fri, Mar 21, 2014 at 8:27 AM, David Nolen dnolen.li...@gmail.com wrote:
 Unless you're compiling a very large file - with auto :optimizations :none
 you should always get sub-second compile times under auto.

 David


 On Fri, Mar 21, 2014 at 10:55 AM, Timothy Baldridge tbaldri...@gmail.com
 wrote:

 are you using lein cljsbuild auto ? That's what I use, and I get about
 1-3 sec recompile times for stuff that uses core.async.

 Timothy


 On Fri, Mar 21, 2014 at 12:48 AM, t x txrev...@gmail.com wrote:

 Hi,

 *  I'm already using:

   :incremental true
   :compiler { :optimizations :none }

 * I'm also aware of cljs brepl


 However:

 1) the cljs compiler is still too slow for my liking (even though it's
 not calling closure)

 2) I don't like the cljs repl nearly as much as I like the clj repl


 Now, my dumb/stupid question:

   Is there any cljs in cljs _slow_ interpreter? I'm perfectly happy
 with an interpreter that runs 10x slower, if, in exchange, I get to
 hit refresh and my new code starts running.

   Furthermore, I'm _okay_ with their being a big delay every time I
 introduce a new macro from clj land.


   I realize this sounds spoiled -- but -- the cljs compiler delays are
 really really breaking my flow.


 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




 --
 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: purely functional math renderer

2014-03-16 Thread t x
The best I've sound so far is MathML.

Unfortunately:

  * it's FireFox only
  * Chrome dropped support
  * I really like Chrome's debugger

  * It's also slow-ish

On Sun, Mar 16, 2014 at 4:04 AM, Jony Hudson jonyepsi...@gmail.com wrote:
 It doesn't help answer your question, but FWIW: I know MathJax renders
 dynamically into an existing DOM node because it needs to get sizing
 information before it renders. This means, for instance, that you can't even
 render into a DOM fragment off-screen.


 Jony


 On Saturday, 15 March 2014 03:36:04 UTC, t x wrote:

 Hi,


   I'm aware of MathJax, JsMath, MathQuill, MathDox.


   However, I'm wondering if anyone have implemented a pure clojure
 math renderer (not just a binding, but with the actual rendering in
 Clojure).



   What I find frustrating about existing solutions is their
 im-pureness. The basic idea is:

   * my cljs code creates a div with some math inside of $\frac{2}{3}$

   * I queue some javascript call, which then takes a dom node as
 input, and through lots of icky stateful destructive updates, replaces
 the dom element with a bunch of HTML/CSS that represents some math


   What I really want, would be a pure Javascript function, which does
 something like:

   (defn magic-func [sexp-representing-math]
  ... does some magic ...
   .. returns a svg-node-tree which renders the math ...)


   I've spent a few hours of my life searching for this. I have not
 found anything like it.


   Does anyone know of a piece of software which does something similar?



 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


jquery/$ in cljs

2014-03-12 Thread t x
Hi,

  Consider 
https://github.com/extend/bullet/blob/master/examples/clock/src/toppage_handler.erl#L50-L57

  I want to know how to express $.bullet in cljs (when compiled with
optimiztaions: advanced).

  I know how to use things like


  (js/console.log ... )
  (js/MathJax ... )

  However, what I'm stuck on here is how to use $ in cljs land.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: jquery/$ in cljs

2014-03-12 Thread t x
@Timothy, James: Everything works now. Thanks!

On Wed, Mar 12, 2014 at 10:38 AM, James Reeves ja...@booleanknot.com wrote:
 Take a look at jayq: https://github.com/ibdknox/jayq

 - James


 On 12 March 2014 17:14, t x txrev...@gmail.com wrote:

 Hi,

   Consider
 https://github.com/extend/bullet/blob/master/examples/clock/src/toppage_handler.erl#L50-L57

   I want to know how to express $.bullet in cljs (when compiled with
 optimiztaions: advanced).

   I know how to use things like


   (js/console.log ... )
   (js/MathJax ... )

   However, what I'm stuck on here is how to use $ in cljs land.

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help a Startup use Clojure!

2014-03-12 Thread t x
I personally recommend ClojureScript + Erlang.

As for convincing your boss to use Erlang, ask him about WhatsApp. :-)

On Wed, Mar 12, 2014 at 5:06 PM, Jarrod Swart jcsw...@gmail.com wrote:
 Alan,

 Thanks for your input!  ClojureScript is something I have wanted to try more
 but it seems even more cutting edge than Clojure.  It might be too much
 effort to try and tackle that now.

 I do agree though that Clojure+Ring is a great back-end setup for connecting
 to with JavaScript.

 Best,
 Jarrod

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[soft/philosophical] event handers in cljs

2014-03-09 Thread t x
Hi,

  Before core.async, the way I did event handling in cljs was:


## approach 1
  goog.events.listen(... , callback-func)

  After learning core.async, I read (and liked the idea of):

## approach 2
  * (defn global-events (core.async/chan 1))
  * shove all events on to global-events
  * have a go-thread ! from global-events and process there



### Question


  I'm now shifting back to liking approach 1 a bit more. The reason
being: at the point where I define the GUI element, I also define it's
behavior.


  Approach 2 has this weird coupling, where it's like:

  I'm going to define my GUI elements at location X.

  Then, at location Y, which centralizes event processing, I'm going
to define how each event is handled.


  What are people's takes on this? Am I doing approach 2 incorrectly,
or does approach 1 actually has it's merits?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


cljs + mathjax

2014-03-08 Thread t x
Hi,

  Is there any example of using cljs + mathjax together?

  In particular, I need to do something like:

  1) cljs generates some new dom element

  2) I need mathjax to re-render

  Does any have an example of how to do this?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cljs + mathjax

2014-03-08 Thread t x
In particular,

 (js/MathJax.Hub.Queue (array Typeset js/MathJax.Hub))

is that the right call to make, or am I doing something wrong?

Thanks!

On Sat, Mar 8, 2014 at 6:48 AM, t x txrev...@gmail.com wrote:
 Hi,

   Is there any example of using cljs + mathjax together?

   In particular, I need to do something like:

   1) cljs generates some new dom element

   2) I need mathjax to re-render

   Does any have an example of how to do this?

 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cljs + mathjax

2014-03-08 Thread t x
Issue resolved. (This had nothing to do with cljs / javascript
interop, and was purely stupidity with how I was calling MathJax).

Sorry for 3 emails of spam.

On Sat, Mar 8, 2014 at 7:01 AM, t x txrev...@gmail.com wrote:
 In particular,

  (js/MathJax.Hub.Queue (array Typeset js/MathJax.Hub))

 is that the right call to make, or am I doing something wrong?

 Thanks!

 On Sat, Mar 8, 2014 at 6:48 AM, t x txrev...@gmail.com wrote:
 Hi,

   Is there any example of using cljs + mathjax together?

   In particular, I need to do something like:

   1) cljs generates some new dom element

   2) I need mathjax to re-render

   Does any have an example of how to do this?

 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cljs + mathjax

2014-03-08 Thread t x
On http://docs.mathjax.org/en/latest/start.html , there's a line
you're supposed to copy to pull MathJax from the MathJax CDN.

For some stupid reason, I managed to introduce a typo while copying/pasting. :-(

I realized this when, even a static page wouldn't render MathJax.


On Sat, Mar 8, 2014 at 3:57 PM, Daniel doubleagen...@gmail.com wrote:
 What did you end up doing differently?


 On Saturday, March 8, 2014 10:15:38 AM UTC-6, t x wrote:

 Issue resolved. (This had nothing to do with cljs / javascript
 interop, and was purely stupidity with how I was calling MathJax).

 Sorry for 3 emails of spam.

 On Sat, Mar 8, 2014 at 7:01 AM, t x txre...@gmail.com wrote:
  In particular,
 
   (js/MathJax.Hub.Queue (array Typeset js/MathJax.Hub))
 
  is that the right call to make, or am I doing something wrong?
 
  Thanks!
 
  On Sat, Mar 8, 2014 at 6:48 AM, t x txre...@gmail.com wrote:
  Hi,
 
Is there any example of using cljs + mathjax together?
 
In particular, I need to do something like:
 
1) cljs generates some new dom element
 
2) I need mathjax to re-render
 
Does any have an example of how to do this?
 
  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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for a Rich Hickey quotation

2014-03-01 Thread t x
Thus, programs must be written for people to read, and only
incidentally for machines to execute. --
http://mitpress.mit.edu/sicp/front/node3.html


On Sat, Mar 1, 2014 at 2:48 AM, Kashyap CK ckkash...@gmail.com wrote:
 Hi,
 In one of the talks, Rich Hickey had mentioned something to the effect -

 Programs are meant to state the intention of your computation to other
 programmers/humans - as opposed to instructions for a machine

 He was quoting someone else actually (perhaps Knuth). I just cant seem to
 get my hands on that video. Could someone please remind me what that
 quotation was?

 Regards,
 Kashyap

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ace / codemirror in cljs

2014-03-01 Thread t x
No, it appears lighttable uses CodeMIrror.

See:
  * https://github.com/LightTable/LightTable/search?q=codemirrorref=cmdform
  * http://www.chris-granger.com/2012/04/15/light-tables-numbers/


On Sat, Mar 1, 2014 at 3:02 AM, Dave Sann daves...@gmail.com wrote:
 have you considered reading the LightTable code? There is probably some cljs
 and editor in there


 On Saturday, 1 March 2014 17:26:18 UTC+11, t x wrote:

 Hi,

   Is there anything like http://codemirror.net/ or
 http://ace.c9.io/#nav=about in cljs ?

   The goal is not to use codemirror/ace in a cljs project. The goal is
 to read some interesting cljs code on how to write an editor.

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ace / codemirror in cljs

2014-02-28 Thread t x
Hi,

  Is there anything like http://codemirror.net/ or
http://ace.c9.io/#nav=about in cljs ?

  The goal is not to use codemirror/ace in a cljs project. The goal is
to read some interesting cljs code on how to write an editor.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: object identity

2014-02-26 Thread t x
[start slightly insane idea]


Perhaps we need the following:

* a way to tag a function as _pure_

* a map with uber_weak keys + values

  by uber_weak, I mean the k/v pair vanishes when either the key
_or_ the value is gc-ed


Then, what we do here, is that every function auto-memoizes:

  (func args) ==

* lookup in my uber_weak k/v map; if args is already there, return
last computed value

* if not, compute value, then put it into the uber_weak k/v map


Suppose uber_weak maps exist, this does not cause gc problems because:

  * if our uber_weak map is the last reference to the either the k or
the v, the entire k/v pair gets removed from the uber_weak map


[end slightly insane idea]


I'm also going to mention that I know no where near enough about
js/java GC to say anything about how to implement uber_weak maps.


On Wed, Feb 26, 2014 at 8:37 PM, Bobby Eickhoff beickh...@gmail.com wrote:
 This seems like a reasonable optimization.  I read something similar a few
 years ago
 (http://lorgonblog.wordpress.com/2008/05/24/catamorphisms-part-four/):

 What we want is a function which will be smart, and only allocate new data
 structures when necessary.  Indeed, one of the main advantages of immutable
 data structures is the ability to share portions of structure.


 Bobby

 On Monday, February 24, 2014 4:00:34 PM UTC-5, Brian Craft wrote:

 This is vaguely related to David's posts about om/react, where he talks
 about optimizing state change tracking by checking object identity on
 immutable objects: deep compares can be avoided if same identity implies no
 changes.

 My first thought was that there are many algorithms that will give you a
 new object every time, even if nothing has changed.  E.g. if your state has
 an array whose elements must be validated, doing a map over the elements
 will give you a new array every time, even if it makes no changes.

 Enforcing non-negative values, for instance:

 = (let [x {:a [1 -2 3]}] (update-in x [:a] (fn [y] (mapv #(if ( % 0) 0
 %) y
 {:a [1 0 3]}

 In the following case the values are already non-negative, but we still
 get a new object:

 = (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (mapv
 #(if ( % 0) 0 %) y)
 false

 One can imagine trying to rewrite this so it passes through the vector if
 nothing has changed. E.g.

 = (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (reduce
 (fn [v i] (if ( (v i) 0) (assoc v i 0) v)) y (range (count y)))
 true

 = (let [x {:a [1 -1 3]}] (identical? x (update-in x [:a] (fn [y] (reduce
 (fn [v i] (if ( (v i) 0) (assoc v i 0) v)) y (range (count y)))
 false

 I expect many algorithms would need to be reworked like this in order to
 rely on object identity for change tracking. Is this madness? Am I thinking
 about this the wrong way?


 An interesting note here is that the next-to-last update-in, above,
 returned the same object. I didn't know update-in could return the same
 object. A simpler example:

 = (let [x {a [1 2 3]} y (update-in x [a] (fn [z] z))] [x y
 (identical? x y)])
 [{a [1 2 3]} {a [1 2 3]} true]

 = (let [x {a [1 2 3]} y (update-in x [a] (fn [z] [1 2 3]))] [x y
 (identical? x y)])
 [{a [1 2 3]} {a [1 2 3]} false]


 Is this some kind of optimization in update-in, that it doesn't create a
 new object if the new attribute is identical to the old attribute? Is it
 peculiar to the data type? Is it documented anywhere?


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: object identity

2014-02-24 Thread t x
I finally have a chance to give back. :-)

I hacked up a newb's half-React. It does tree diffing + dom updating,
but not the virtual event handling system.

I ran into this exact problem, and solved it as follows:


## problem definition:

render: data - dom
tree-diff: dom * dom - list of dom-update-actions

we want to avoid deep tree diffing on tree-diff

the key idea is as follows:

  when render is called twice with same args,

  * we still have to recompute every time
  * we don't have to re-compare every time

if render is a pure function, we do somethign like:

(defn render [data]
  (with-meta (render-pure data) {:pure data}))

(render-pure data) gives us a dom-tree
we tag it with a meta project, telling us that it came from data,
and that it was a pure function


then, doing the tree-diff stage, we do:


(defn tree-diff [old-dom new-dom]
  (let [mo (meta old-dom)
no (meta new-dom)]
(if (and (:pure mo) (:pure no) (= (:pure mo) (:pure no)))
  .. ah, they're from the same pure function, thus the same ...
  ... okay, let's do expensive deep diff)))


so basically, we abuse meta objects, record

  * what data gave us this dom tree ?
  * was the func that gave us the dom tree pure ?

And if so, we just do a equality check on the data -- which are are
_not_ regenerating and thus matches an equality check.


Please let me if:

  (a) this resolves the issue
  (b) I completely misunderstood the question


Thanks!






On Mon, Feb 24, 2014 at 1:00 PM, Brian Craft craft.br...@gmail.com wrote:
 This is vaguely related to David's posts about om/react, where he talks
 about optimizing state change tracking by checking object identity on
 immutable objects: deep compares can be avoided if same identity implies no
 changes.

 My first thought was that there are many algorithms that will give you a new
 object every time, even if nothing has changed.  E.g. if your state has an
 array whose elements must be validated, doing a map over the elements will
 give you a new array every time, even if it makes no changes.

 Enforcing non-negative values, for instance:

 = (let [x {:a [1 -2 3]}] (update-in x [:a] (fn [y] (mapv #(if ( % 0) 0 %)
 y
 {:a [1 0 3]}

 In the following case the values are already non-negative, but we still get
 a new object:

 = (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (mapv #(if
 ( % 0) 0 %) y)
 false

 One can imagine trying to rewrite this so it passes through the vector if
 nothing has changed. E.g.

 = (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (reduce (fn
 [v i] (if ( (v i) 0) (assoc v i 0) v)) y (range (count y)))
 true

 = (let [x {:a [1 -1 3]}] (identical? x (update-in x [:a] (fn [y] (reduce
 (fn [v i] (if ( (v i) 0) (assoc v i 0) v)) y (range (count y)))
 false

 I expect many algorithms would need to be reworked like this in order to
 rely on object identity for change tracking. Is this madness? Am I thinking
 about this the wrong way?


 An interesting note here is that the next-to-last update-in, above, returned
 the same object. I didn't know update-in could return the same object. A
 simpler example:

 = (let [x {a [1 2 3]} y (update-in x [a] (fn [z] z))] [x y (identical?
 x y)])
 [{a [1 2 3]} {a [1 2 3]} true]

 = (let [x {a [1 2 3]} y (update-in x [a] (fn [z] [1 2 3]))] [x y
 (identical? x y)])
 [{a [1 2 3]} {a [1 2 3]} false]


 Is this some kind of optimization in update-in, that it doesn't create a new
 object if the new attribute is identical to the old attribute? Is it
 peculiar to the data type? Is it documented anywhere?


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: object identity

2014-02-24 Thread t x
Perhaps I mis-interpreted your question.

I thought the question asked was:


GIven:
  * pure function func
  * some object obj
  * (def a (func obj))
  * (def b (func obj))

Example:
  * obj = [1 2 3]
  * (defn func [lst] (map #(* 2 %) lst))

Then:
  * is there a O(1) way to check if (= a b) ?

  In the above, we create two _different_ lists, both of which stores
[2 4 6], thus they're equal, but not identical

Proposed solution:
  tag the returned-value with a meta object, where the meta object
describes how the object was computed.

  in this case, both [2 4 6] would have _identical_ meta objects,
since they're both from the list [1 2 3]





On Mon, Feb 24, 2014 at 5:56 PM, Brian Craft craft.br...@gmail.com wrote:
 You're solving a similar problem, but I'm asking specifically about using
 object identity, not equality, for tracking changes in a nested structure.


 On Monday, February 24, 2014 1:42:03 PM UTC-8, t x wrote:

 I finally have a chance to give back. :-)

 I hacked up a newb's half-React. It does tree diffing + dom updating,
 but not the virtual event handling system.

 I ran into this exact problem, and solved it as follows:


 ## problem definition:

 render: data - dom
 tree-diff: dom * dom - list of dom-update-actions

 we want to avoid deep tree diffing on tree-diff

 the key idea is as follows:

   when render is called twice with same args,

   * we still have to recompute every time
   * we don't have to re-compare every time

 if render is a pure function, we do somethign like:

 (defn render [data]
   (with-meta (render-pure data) {:pure data}))

 (render-pure data) gives us a dom-tree
 we tag it with a meta project, telling us that it came from data,
 and that it was a pure function


 then, doing the tree-diff stage, we do:


 (defn tree-diff [old-dom new-dom]
   (let [mo (meta old-dom)
 no (meta new-dom)]
 (if (and (:pure mo) (:pure no) (= (:pure mo) (:pure no)))
   .. ah, they're from the same pure function, thus the same ...
   ... okay, let's do expensive deep diff)))


 so basically, we abuse meta objects, record

   * what data gave us this dom tree ?
   * was the func that gave us the dom tree pure ?

 And if so, we just do a equality check on the data -- which are are
 _not_ regenerating and thus matches an equality check.


 Please let me if:

   (a) this resolves the issue
   (b) I completely misunderstood the question


 Thanks!






 On Mon, Feb 24, 2014 at 1:00 PM, Brian Craft craft...@gmail.com wrote:
  This is vaguely related to David's posts about om/react, where he talks
  about optimizing state change tracking by checking object identity on
  immutable objects: deep compares can be avoided if same identity implies
  no
  changes.
 
  My first thought was that there are many algorithms that will give you a
  new
  object every time, even if nothing has changed.  E.g. if your state has
  an
  array whose elements must be validated, doing a map over the elements
  will
  give you a new array every time, even if it makes no changes.
 
  Enforcing non-negative values, for instance:
 
  = (let [x {:a [1 -2 3]}] (update-in x [:a] (fn [y] (mapv #(if ( % 0) 0
  %)
  y
  {:a [1 0 3]}
 
  In the following case the values are already non-negative, but we still
  get
  a new object:
 
  = (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (mapv
  #(if
  ( % 0) 0 %) y)
  false
 
  One can imagine trying to rewrite this so it passes through the vector
  if
  nothing has changed. E.g.
 
  = (let [x {:a [1 2 3]}] (identical? x (update-in x [:a] (fn [y] (reduce
  (fn
  [v i] (if ( (v i) 0) (assoc v i 0) v)) y (range (count y)))
  true
 
  = (let [x {:a [1 -1 3]}] (identical? x (update-in x [:a] (fn [y]
  (reduce
  (fn [v i] (if ( (v i) 0) (assoc v i 0) v)) y (range (count y)))
  false
 
  I expect many algorithms would need to be reworked like this in order to
  rely on object identity for change tracking. Is this madness? Am I
  thinking
  about this the wrong way?
 
 
  An interesting note here is that the next-to-last update-in, above,
  returned
  the same object. I didn't know update-in could return the same object. A
  simpler example:
 
  = (let [x {a [1 2 3]} y (update-in x [a] (fn [z] z))] [x y
  (identical?
  x y)])
  [{a [1 2 3]} {a [1 2 3]} true]
 
  = (let [x {a [1 2 3]} y (update-in x [a] (fn [z] [1 2 3]))] [x y
  (identical? x y)])
  [{a [1 2 3]} {a [1 2 3]} false]
 
 
  Is this some kind of optimization in update-in, that it doesn't create a
  new
  object if the new attribute is identical to the old attribute? Is it
  peculiar to the data type? Is it documented anywhere?
 
 
  --
  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

clojure - beam compiler

2014-02-23 Thread t x
Hi,

  Are there any active efforts to compile clj/cljs to Erlang/Beam ?

## Pre-emptive responses:

  * I'm aware of http://lfe.github.io/ . It's not what I want. After
programming in Clojure, I find normal lisp ugly in comparison. I
want clojure syntax.

  * I'm aware I will lose STM + Agents. I'm okay with that. What I
really like about Clojure is: maps + vectors + keywords + lisp-1 +
macros + ease of CLJ/CLJS code + data sharing (i.e. pr-str +
read-string).

## Background

  Currently, I'm developing a web-socket webapp, using cljx (clj +
cljs). However, I've increasingly found that:

  * I really want erlang rather than roll my own pseudo-erlang on top
of core.async for things like:

* otp
* separate heap for each process
* ease of running on multiple machines

  However, I really like the cljs + clj dynamic, and would prefer to
write the backend in something clojure-ish.

  Thus, my question -- are there any active efforts to port clojure
(say via cljs's compiler) to Erlang/Beam ?


Thanks!

PS: I understand JVM has awesome JIT + awesome libraries. However, for
this particular server, all I really want is a simple way to deal with
fault tolerance.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure - beam compiler

2014-02-23 Thread t x
http://docs.joxa.org/en/latest/language.html looks amazing.

Thanks!

On Sun, Feb 23, 2014 at 1:54 AM, Michael Klishin
michael.s.klis...@gmail.com wrote:
 2014-02-23 13:40 GMT+04:00 t x txrev...@gmail.com:

 Thus, my question -- are there any active efforts to port clojure
 (say via cljs's compiler) to Erlang/Beam ?


 Take a look at Joxa:

 http://joxa.org/
 --
 MK

 http://github.com/michaelklishin
 http://twitter.com/michaelklishin

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: weird bug with cljs.core.async + macros

2014-02-18 Thread t x
Hi Timothy,

One paragraph summary:

  When a macro expands to case inside of a go-block, it appears that
the _ELSE_ clause of the case is always run. (Even after a previous
clause has matched.)

Slightly longer summary:


  In these lines:
https://github.com/txrev319/bug-report/blob/master/src/app.cljx#L11-L20

  The macro is supposed to expand into:

  (case (:tag {:tag :dog})
:dog woof woof
unrecognized)


  When we do not use go, we get the result as expected.


  When we put it into a go-block, it appears that both the

  :dog woof woof branch

and the

  unrecognized branch

  are _BOTH_ being executed -- when only one should be executed.




On Tue, Feb 18, 2014 at 12:09 PM, Thomas Heller th.hel...@gmail.com wrote:
 Well, while case allows for symbols it still doesn't make sense to use it
 except :tag switches between keywords and symbols to. Apart from that cat
 pat2 is never actually used.

 (defmacro silly [object pat1 body1 pat2 body2]
   `(case (:tag ~object)
  ~pat1 ~body1
  ~body2))



 But as Timothy said its probably related to case, so I'll shut up.

 On Tuesday, February 18, 2014 8:20:07 PM UTC+1, Ben wrote:

 On Tue, Feb 18, 2014 at 11:18 AM, Thomas Heller th.h...@gmail.com wrote:

 While I haven't tested the code, I can see one obvious mistake.

 https://github.com/txrev319/bug-report/blob/master/src/app.cljx#L20

 cat is undefined?


 That isn't a mistake. `silly` expands into a case, which expects bare
 symbols.

 --
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks, which
 may be sweet, aromatic, fermented or spirit-based. ... Family and social
 life also offer numerous other occasions to consume drinks for pleasure.
 [Larousse, Drink entry]

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: weird bug with cljs.core.async + macros

2014-02-18 Thread t x
@Thomas:
(this is completely unrelated to the actual bug)

  This particular code was simplified from a more complicated macro
-- where for the else clause, I want to capture the original value, so
it would be something like:


  (silly obj
:dog dog-line
cat cat-line) ==

  (case (:tag obj)
 :dog dog-line
  (let [cat obj] cat-line ))

  However, in simplifying the example, parts of the macro was
removed, and thus it appears that we have this dangling cat symbol.





On Tue, Feb 18, 2014 at 12:09 PM, Thomas Heller th.hel...@gmail.com wrote:
 Well, while case allows for symbols it still doesn't make sense to use it
 except :tag switches between keywords and symbols to. Apart from that cat
 pat2 is never actually used.

 (defmacro silly [object pat1 body1 pat2 body2]
   `(case (:tag ~object)
  ~pat1 ~body1
  ~body2))



 But as Timothy said its probably related to case, so I'll shut up.

 On Tuesday, February 18, 2014 8:20:07 PM UTC+1, Ben wrote:

 On Tue, Feb 18, 2014 at 11:18 AM, Thomas Heller th.h...@gmail.com wrote:

 While I haven't tested the code, I can see one obvious mistake.

 https://github.com/txrev319/bug-report/blob/master/src/app.cljx#L20

 cat is undefined?


 That isn't a mistake. `silly` expands into a case, which expects bare
 symbols.

 --
 Ben Wolfson
 Human kind has used its intelligence to vary the flavour of drinks, which
 may be sweet, aromatic, fermented or spirit-based. ... Family and social
 life also offer numerous other occasions to consume drinks for pleasure.
 [Larousse, Drink entry]

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: weird bug with cljs.core.async + macros

2014-02-18 Thread t x
Hi Timothy,

  I've picked case over cond/condp because I want a O(1) dispatch
rather than linear execution since there are many patterns [though I'm
probably guilty of premature optimization here].

  I've currently been working around it via two techniques:

** Refactoring it into a function.

  i.e.

  (defn some-func [msg]
(hmatch msg ... )) ;; silly is called hmatch

  (async/go
(loop [msg (! some-chan)]
  (some-func msg)
  (recur (! some-chan

** And when I can't refactor, due to needing to interact with other
parts of go, manually expand it, i.e.

  (async/go
(loop [msg (! some-chan)]
  (case (:tag msg)
:dog (... some op involving some-chan


  Please let us know when the next release of core.async is ready --
looking forward to it!

PS: I'm a big fan of your youtube tutorials. :-)

On Tue, Feb 18, 2014 at 12:42 PM, Timothy Baldridge
tbaldri...@gmail.com wrote:
 When a macro expands to case inside of a go-block, it appears that
 the _ELSE_ clause of the case is always run. (Even after a previous
 clause has matched.)

 Thanks, I'll get a test in the project for this, it'll probably be fixed in
 the next alpha release. Until then, cond or condp might work?

 Timothy


 On Tue, Feb 18, 2014 at 1:40 PM, t x txrev...@gmail.com wrote:

 @Thomas:
 (this is completely unrelated to the actual bug)

   This particular code was simplified from a more complicated macro
 -- where for the else clause, I want to capture the original value, so
 it would be something like:


   (silly obj
 :dog dog-line
 cat cat-line) ==

   (case (:tag obj)
  :dog dog-line
   (let [cat obj] cat-line ))

   However, in simplifying the example, parts of the macro was
 removed, and thus it appears that we have this dangling cat symbol.





 On Tue, Feb 18, 2014 at 12:09 PM, Thomas Heller th.hel...@gmail.com
 wrote:
  Well, while case allows for symbols it still doesn't make sense to use
  it
  except :tag switches between keywords and symbols to. Apart from that
  cat
  pat2 is never actually used.
 
  (defmacro silly [object pat1 body1 pat2 body2]
`(case (:tag ~object)
   ~pat1 ~body1
   ~body2))
 
 
 
  But as Timothy said its probably related to case, so I'll shut up.
 
  On Tuesday, February 18, 2014 8:20:07 PM UTC+1, Ben wrote:
 
  On Tue, Feb 18, 2014 at 11:18 AM, Thomas Heller th.h...@gmail.com
  wrote:
 
  While I haven't tested the code, I can see one obvious mistake.
 
  https://github.com/txrev319/bug-report/blob/master/src/app.cljx#L20
 
  cat is undefined?
 
 
  That isn't a mistake. `silly` expands into a case, which expects bare
  symbols.
 
  --
  Ben Wolfson
  Human kind has used its intelligence to vary the flavour of drinks,
  which
  may be sweet, aromatic, fermented or spirit-based. ... Family and
  social
  life also offer numerous other occasions to consume drinks for
  pleasure.
  [Larousse, Drink entry]
 
  --
  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 unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 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
 ---
 You received this message because you

Re: weird bug with cljs.core.async + macros

2014-02-18 Thread t x
Looking at 
https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1144-L1147
, you win. :-)

On Tue, Feb 18, 2014 at 1:33 PM, Michał Marczyk
michal.marc...@gmail.com wrote:
 On 18 February 2014 22:31, Michał Marczyk michal.marc...@gmail.com wrote:
 Actually in ClojureScript case dispatch is O(n), since it's
 implemented as a macro expanding to cond.

 As of release 2156:

 https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1119

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: weird bug with cljs.core.async + macros

2014-02-18 Thread t x
With apologies for potential stupidity:

* (get {... } key) is an operation that is O(log n) worst case (if
using Red-Black trees) or O(1) average case (hashing)

* (get { ... } key) does not have integer/string limitation

Therefore: why are we not compiling down to get ? Are the big-Oh
constants enormous?

On Tue, Feb 18, 2014 at 3:51 PM, Michał Marczyk
michal.marc...@gmail.com wrote:
 Great! First cut at compiling case to switch (when given numbers and
 strings only as tests at the moment, but this can be improved) here:

 https://github.com/michalmarczyk/clojurescript/tree/713-compile-case-to-switch

 I'll post more details on the ticket.

 Cheers,
 Michał


 On 18 February 2014 22:38, David Nolen dnolen.li...@gmail.com wrote:
 Due to asm.js some JS engines are starting to compile switch statements
 where the cases are integers into jump tables. Compiler enhancement that
 compiles optimizable case expressions to JS switch statements would be a
 welcome enhancement - http://dev.clojure.org/jira/browse/CLJS-713.

 David


 On Tue, Feb 18, 2014 at 4:35 PM, t x txrev...@gmail.com wrote:

 Looking at
 https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1144-L1147
 , you win. :-)

 On Tue, Feb 18, 2014 at 1:33 PM, Michał Marczyk
 michal.marc...@gmail.com wrote:
  On 18 February 2014 22:31, Michał Marczyk michal.marc...@gmail.com
  wrote:
  Actually in ClojureScript case dispatch is O(n), since it's
  implemented as a macro expanding to cond.
 
  As of release 2156:
 
 
  https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1119
 
  --
  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 unsubscribe from this group and stop receiving emails from it, send
  an email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving

Re: weird bug with cljs.core.async + macros

2014-02-18 Thread t x
@Timothy, Michal:

  Understood. Thanks for clarifying!

On Tue, Feb 18, 2014 at 5:09 PM, Michał Marczyk
michal.marc...@gmail.com wrote:
 switch can be compiled to a direct array indexing operation or a
 binary search. I believe that's what the JVM does for tableswitch and
 lookupswitch, respectively.

 On 19 February 2014 01:02, t x txrev...@gmail.com wrote:
 With apologies for potential stupidity:

 * (get {... } key) is an operation that is O(log n) worst case (if
 using Red-Black trees) or O(1) average case (hashing)

 * (get { ... } key) does not have integer/string limitation

 Therefore: why are we not compiling down to get ? Are the big-Oh
 constants enormous?

 On Tue, Feb 18, 2014 at 3:51 PM, Michał Marczyk
 michal.marc...@gmail.com wrote:
 Great! First cut at compiling case to switch (when given numbers and
 strings only as tests at the moment, but this can be improved) here:

 https://github.com/michalmarczyk/clojurescript/tree/713-compile-case-to-switch

 I'll post more details on the ticket.

 Cheers,
 Michał


 On 18 February 2014 22:38, David Nolen dnolen.li...@gmail.com wrote:
 Due to asm.js some JS engines are starting to compile switch statements
 where the cases are integers into jump tables. Compiler enhancement that
 compiles optimizable case expressions to JS switch statements would be a
 welcome enhancement - http://dev.clojure.org/jira/browse/CLJS-713.

 David


 On Tue, Feb 18, 2014 at 4:35 PM, t x txrev...@gmail.com wrote:

 Looking at
 https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1144-L1147
 , you win. :-)

 On Tue, Feb 18, 2014 at 1:33 PM, Michał Marczyk
 michal.marc...@gmail.com wrote:
  On 18 February 2014 22:31, Michał Marczyk michal.marc...@gmail.com
  wrote:
  Actually in ClojureScript case dispatch is O(n), since it's
  implemented as a macro expanding to cond.
 
  As of release 2156:
 
 
  https://github.com/clojure/clojurescript/blob/r2156/src/clj/cljs/core.clj#L1119
 
  --
  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 unsubscribe from this group and stop receiving emails from it, send
  an email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

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

hooks on namespace required/loaded

2014-02-18 Thread t x
Hi,

  Although solutions not involving cljx are perfectly fine, I'm using
cljx -- so solutions that involves hooking into cljx are perfectly
fine too.

  I have my own poor-man's lint / type checker (with different
objectives from core.typed). I want a certain function (call it
CHECKER) to be called every time a namespace has been required /
loaded / reloaded

  Every time I require/load/reload a namespace, I want the following to happen:

(CHECKER ... source code of the namesapce)

i.e. something like

(CHECKER (read-string namesapce-just-loaded.clj))

Then, if CHECKER throws an exception, it should be a compile error. If
CHECKER prints stuff out, it should go into the lein repl stdout,
and if CHECKER doesn't do anything, it's assumed that the namespace
passed the check.

  Is there a minimal example somewhere of how this works? (i.e.
something as stupid as: this example calls a function, which just
prints out the name of all functions defined would be extremely
helpful).

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: hooks on namespace required/loaded

2014-02-18 Thread t x
As a point of clarification, read-string is not a hard requirement.
Just getting the name of the namespace (and walking through the
symbols + calling source on each of them to get the source code is
perfeclty fine).

Basically, I want to hook a function that
  * gets called every time a namespace is loaded/required/reloaded
  * gets passed the namespace

Thanks!

On Tue, Feb 18, 2014 at 8:32 PM, t x txrev...@gmail.com wrote:
 Hi,

   Although solutions not involving cljx are perfectly fine, I'm using
 cljx -- so solutions that involves hooking into cljx are perfectly
 fine too.

   I have my own poor-man's lint / type checker (with different
 objectives from core.typed). I want a certain function (call it
 CHECKER) to be called every time a namespace has been required /
 loaded / reloaded

   Every time I require/load/reload a namespace, I want the following to 
 happen:

 (CHECKER ... source code of the namesapce)

 i.e. something like

 (CHECKER (read-string namesapce-just-loaded.clj))

 Then, if CHECKER throws an exception, it should be a compile error. If
 CHECKER prints stuff out, it should go into the lein repl stdout,
 and if CHECKER doesn't do anything, it's assumed that the namespace
 passed the check.

   Is there a minimal example somewhere of how this works? (i.e.
 something as stupid as: this example calls a function, which just
 prints out the name of all functions defined would be extremely
 helpful).

 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: hooks on namespace required/loaded

2014-02-18 Thread t x
With apologies for spamming:

  Solutions that involves installing a new lein plugin is fine too.

  I'm willing to completely re-organize my workflow in order to

  * have some other piece of Clojure code gets called / do
verification whenever a clojure namespace is required/loaded/reloaded

/ Done spamming.

On Tue, Feb 18, 2014 at 8:38 PM, t x txrev...@gmail.com wrote:
 As a point of clarification, read-string is not a hard requirement.
 Just getting the name of the namespace (and walking through the
 symbols + calling source on each of them to get the source code is
 perfeclty fine).

 Basically, I want to hook a function that
   * gets called every time a namespace is loaded/required/reloaded
   * gets passed the namespace

 Thanks!

 On Tue, Feb 18, 2014 at 8:32 PM, t x txrev...@gmail.com wrote:
 Hi,

   Although solutions not involving cljx are perfectly fine, I'm using
 cljx -- so solutions that involves hooking into cljx are perfectly
 fine too.

   I have my own poor-man's lint / type checker (with different
 objectives from core.typed). I want a certain function (call it
 CHECKER) to be called every time a namespace has been required /
 loaded / reloaded

   Every time I require/load/reload a namespace, I want the following to 
 happen:

 (CHECKER ... source code of the namesapce)

 i.e. something like

 (CHECKER (read-string namesapce-just-loaded.clj))

 Then, if CHECKER throws an exception, it should be a compile error. If
 CHECKER prints stuff out, it should go into the lein repl stdout,
 and if CHECKER doesn't do anything, it's assumed that the namespace
 passed the check.

   Is there a minimal example somewhere of how this works? (i.e.
 something as stupid as: this example calls a function, which just
 prints out the name of all functions defined would be extremely
 helpful).

 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: hooks on namespace required/loaded

2014-02-18 Thread t x
@Joel:

  While on IRC, I completely misunderstood you.

  Now, after looking at it again, it makes sense. This is very cool --
because making it a macro forces it to be evaluated at compile time,
when the source is available. Very nice. :-)

@Andy

  Thanks! I will look into load-libs.

  The following is a bit vague-ish not on purpose, but because part of
it works, part of it is still being hacked together.


## stuff I have:

This is how my current pattern matching / object system looks like:
https://gist.github.com/txrev319/9086538

In a very hackish and theoretically unsound way, each hash-map is an
object and the :tag field represents the type of the object.


## stuff that are vague because I'm still hacking them together /
thinking about them

### missing feature 1

now, I want to be able to say things like:

:animal = [:cat :dog :mouse]

then, if I do:

(hmatch obj :animal
   :dog ...
   :cat ... )

I want it to give me an error of: hey, you're not matching against
:mouse -- and I want this to happen at COMPILE time, not at run time


### missing feature 2

using standard Hindley-Milner, and using the :tag field as the type,
I want to be able to tag a function as having a certain type, and have
it verified at compile time -- this is purely optional type checking

a common pattern I run into is:

(async/go
  (loop [msg (! some-chan)]
(hmatch ...
  [:dog ... ] (call-other-function msg)
...)))

now, when I pull the msg off the channel, I have no idea what type it
is -- and that is fine.

However, I'd prefer to verify, at compile time, that
call-other-function has type :dog - :something


### in summary,

  I'm basically hacking together poor-man's pattern matching (done)
and type checking (still need more hacking). The idea is:

  * I want a dynamically typed langauge

  * I want to be able to say: for this subset of functions, they have
type signatures, and we can catch errors statically (-- and these
choices are completely adhoc, based on what errors I waste time
catching)



On Tue, Feb 18, 2014 at 9:15 PM, Andy Fingerhut
andy.finger...@gmail.com wrote:
 I am not sure about ClojureScript, but in Clojure/Java you can use
 alter-var-root to change the definition of load-libs, which is called by
 both require and use.  You can use alter-var-root to change the definition
 of any function you want in clojure.core or any other namespace.  I wouldn't
 recommend going crazy with it, but it should be able to do the job, at least
 after the alter-var-root takes effect.

 Out of curiosity, what kind of linting does your function do?

 Andy


 On Tue, Feb 18, 2014 at 8:41 PM, t x txrev...@gmail.com wrote:

 With apologies for spamming:

   Solutions that involves installing a new lein plugin is fine too.

   I'm willing to completely re-organize my workflow in order to

   * have some other piece of Clojure code gets called / do
 verification whenever a clojure namespace is required/loaded/reloaded

 / Done spamming.

 On Tue, Feb 18, 2014 at 8:38 PM, t x txrev...@gmail.com wrote:
  As a point of clarification, read-string is not a hard requirement.
  Just getting the name of the namespace (and walking through the
  symbols + calling source on each of them to get the source code is
  perfeclty fine).
 
  Basically, I want to hook a function that
* gets called every time a namespace is loaded/required/reloaded
* gets passed the namespace
 
  Thanks!
 
  On Tue, Feb 18, 2014 at 8:32 PM, t x txrev...@gmail.com wrote:
  Hi,
 
Although solutions not involving cljx are perfectly fine, I'm using
  cljx -- so solutions that involves hooking into cljx are perfectly
  fine too.
 
I have my own poor-man's lint / type checker (with different
  objectives from core.typed). I want a certain function (call it
  CHECKER) to be called every time a namespace has been required /
  loaded / reloaded
 
Every time I require/load/reload a namespace, I want the following to
  happen:
 
  (CHECKER ... source code of the namesapce)
 
  i.e. something like
 
  (CHECKER (read-string namesapce-just-loaded.clj))
 
  Then, if CHECKER throws an exception, it should be a compile error. If
  CHECKER prints stuff out, it should go into the lein repl stdout,
  and if CHECKER doesn't do anything, it's assumed that the namespace
  passed the check.
 
Is there a minimal example somewhere of how this works? (i.e.
  something as stupid as: this example calls a function, which just
  prints out the name of all functions defined would be extremely
  helpful).
 
  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

weird bug with cljs.core.async + macros

2014-02-17 Thread t x
Hi,

  repo: https://github.com/txrev319/bug-report

  I have a really weird bug where:

  * (my-macro ...) == everything works

  * (async/go (my-macro ...)) == something weird happens


  A minimal failure case is documented at:
https://github.com/txrev319/bug-report/blob/master/src/app.cljx

  It depends on the macro defined in:
https://github.com/txrev319/bug-report/blob/master/src/macros.cljx

  The bug can be replicated by following the instructions at:
https://github.com/txrev319/bug-report/blob/master/README.md

  I *believe* I have included everything required to replicate the
bug. If I am missing anything, please let me know.


Extra info:

$ lein --version
Leiningen 2.2.0 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM

I'm on 64-bit OSX.


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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (series of swap! on atom) == single swap!

2014-02-17 Thread t x
Hi Jan,

  Thanks for your explanations.

  I have no idea how I managed to completely misunderstand
clojure/atom for the past few years -- I suspect it's because I never
use clojure/STM, and as a result, I've never had an atom roll back on
me.

  I've decided to switch to agents.

  Thanks again for catching this fundamental error.



On Sun, Feb 16, 2014 at 11:00 PM, Jan Herich jan.her...@gmail.com wrote:
 Hi t x,

 I think, that lock-free approach an it's semantics is more in line with
 other Clojure reference types such as refs.
 It also encourages you to only use pure functions for state transitions,
 among other things, such as significant
 performance benefits in comparison with lock based approaches, see for
 example this article.
 If you really want to update some reference with function which will also
 perform impure actions such as file I/O,
 consider using agents and send or send-off (the latter in case of I/O
 blocking actions), functions given to send
 and send-off are guaranteed to run only once.

 Dňa pondelok, 17. februára 2014 2:36:59 UTC+1 t x napísal(-a):

 Hi Jan,

   You're right. I'm wrong.

   I'm grateful you pointed this out -- this would have otherwise been
 impossible to debug.

 ===

 To everyone:

   Why can swap! be retried? This confuses me -- to implement swap!, why
 can't we

   * have a lock

   * ensure that only one swap! is in session at any given time

   * have the given swap! complete before running the next swap!


 Thanks!


 On Sun, Feb 16, 2014 at 3:51 PM, Jan Herich jan.h...@gmail.com wrote:
  I'm afraid your understanding of atom swap! operations is not quite
  correct
  - update function must (or should) be pure as well.
  See the documentation for swap!, update function could be potentially
  called
  multiple times if there are more threads of execution
  updating one atomic reference - there is simple compare and set
  mechanism
  involved, which compares the old value of the atom
  (input for the update function) and sets the atom to new value (return
  value
  from the update function) only value of the atom reference
  was not changed in between, if yes the compare and set is retried until
  ti
  succeeds.
 
  Dňa nedeľa, 16. februára 2014 23:35:24 UTC+1 t x napísal(-a):
 
  I believe that's the STM approach, which has the advanrtage of:
 
* can synchronize across multiple pieces of data
 
  but has the disadvantage of:
 
* work must be pure since it can be retried
 
* possibly less efficient due to possibility of retrying
 
 
  In the example I posted above, I only need to:
 
* modify a single atom
 
  and the approach I presented above:
 
* can be impure, since it is guaranteed to only run once
 
* is guaranteed to succeed (without retrys)
 
  On Sun, Feb 16, 2014 at 2:25 PM, Ramesh ramesh1...@gmail.com wrote:
   You can use a ref instead of an atom. And use dosync with multiple
   alter, so
   everything is safely inside a transaction.
  
   On Feb 16, 2014 2:04 PM, t x txre...@gmail.com wrote:
  
   Hi John,
  
 Your solution is perfectly valid and optimal for the problem I
   described above.
  
  
 Unfortunately, I forgot to mention an additional constraint:
   sometimes I
   do:
  
   (let [ foo (:some-selector @data-atom) ]
 (swap! data-atom update-in [:other-selector] ... ))
  
   which the - doesn't quite work on, but my ugly hack above does
   resolve.
  
  
 The problem being -- I want to update one part of the atom, but it
   depends on another part of the atom.
  
 I ended up with the following hack:
  
   (defn tswap! [atm func]
 (swap! atm
(fn [old]
  (let [natm (atom old)]
(func natm)
@natm
  
  
   On Sat, Feb 15, 2014 at 4:09 PM, John D. Hume duelin@gmail.com
   wrote:
On Sat, Feb 15, 2014 at 6:04 PM, t x txre...@gmail.com wrote:
   
   
(defn what-I-want []
  (with-atom some-atom
assoc-in ...
assoc-in ...
update-in ...))
   
   
I often do something like this and don't find it too ugly:
(swap! my-atom #(- %
  (assoc-in [:k] v)
  (update-in [:k2] inc)
  ,,,))
   
--
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
---
You received this message because you are subscribed to the Google
Groups
Clojure group.
To unsubscribe from this group and stop receiving emails from it,
send
an
email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups

Re: weird bug with cljs.core.async + macros

2014-02-17 Thread t x
Can anyone verify whether this bug is reproducible?

On Mon, Feb 17, 2014 at 12:28 AM, t x txrev...@gmail.com wrote:
 Hi,

   repo: https://github.com/txrev319/bug-report

   I have a really weird bug where:

   * (my-macro ...) == everything works

   * (async/go (my-macro ...)) == something weird happens


   A minimal failure case is documented at:
 https://github.com/txrev319/bug-report/blob/master/src/app.cljx

   It depends on the macro defined in:
 https://github.com/txrev319/bug-report/blob/master/src/macros.cljx

   The bug can be replicated by following the instructions at:
 https://github.com/txrev319/bug-report/blob/master/README.md

   I *believe* I have included everything required to replicate the
 bug. If I am missing anything, please let me know.


 Extra info:

 $ lein --version
 Leiningen 2.2.0 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM

 I'm on 64-bit OSX.


 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: weird bug with cljs.core.async + macros

2014-02-17 Thread t x
Thanks for verifying!

@tbaldridge: can you enlighten us on if:

  * I'm doing something stupid or
  * this is an actual bug in cljs/core.async?

Thanks!

On Mon, Feb 17, 2014 at 2:10 PM, Manuel Paccagnella
manuel.paccagne...@gmail.com wrote:
 Tested on Linux x64, Chromium 31.0.1650.63 and Firefox 26.0. Same behaviour
 that you have seen. However, I haven't looked at the code yet.

 Il giorno lunedì 17 febbraio 2014 20:34:22 UTC+1, t x ha scritto:

 Can anyone verify whether this bug is reproducible?

 On Mon, Feb 17, 2014 at 12:28 AM, t x txre...@gmail.com wrote:
  Hi,
 
repo: https://github.com/txrev319/bug-report
 
I have a really weird bug where:
 
* (my-macro ...) == everything works
 
* (async/go (my-macro ...)) == something weird happens
 
 
A minimal failure case is documented at:
  https://github.com/txrev319/bug-report/blob/master/src/app.cljx
 
It depends on the macro defined in:
  https://github.com/txrev319/bug-report/blob/master/src/macros.cljx
 
The bug can be replicated by following the instructions at:
  https://github.com/txrev319/bug-report/blob/master/README.md
 
I *believe* I have included everything required to replicate the
  bug. If I am missing anything, please let me know.
 
 
  Extra info:
 
  $ lein --version
  Leiningen 2.2.0 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM
 
  I'm on 64-bit OSX.
 
 
  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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: weird bug with cljs.core.async + macros

2014-02-17 Thread t x
Hi Michal,

  Does this mean:

  (a) the reported behavior is normal (and my bug report is invalid) or

  (b) this error happens in both cljs + clojure ?

Thanks!

On Mon, Feb 17, 2014 at 4:33 PM, Michał Marczyk
michal.marc...@gmail.com wrote:
 Just to be clear, the above is a version of t x's bug-report modified
 to use a StringWriter instead of console.log.

 Cheers,
 Michał


 On 18 February 2014 01:25, Michał Marczyk michal.marc...@gmail.com wrote:
 The same thing happens in Clojure:

 (defmacro silly [object pat1 body1 pat2 body2]
   `(case (:tag ~object)
  ~pat1 ~body1
  ~body2))

 (def out (java.io.StringWriter.))

 (defn log [ args]
   (doseq [arg args]
 (.write out (str arg))
 (.write out \n)))

 (defn init []
   (silly {:tag :dog}
  :dog (log without-go: woof woof)
  cat (log without-go: unrecognized))
   (async/go
(silly {:tag :dog}
   :dog (log with-go: woof woof)
   cat (log with-go: unrecognized

 (init)

 (print (str out))
 without-go: woof woof
 with-go: woof woof
 with-go: unrecognized
 nil

 Cheers,
 Michał


 On 18 February 2014 01:01, t x txrev...@gmail.com wrote:
 Thanks for verifying!

 @tbaldridge: can you enlighten us on if:

   * I'm doing something stupid or
   * this is an actual bug in cljs/core.async?

 Thanks!

 On Mon, Feb 17, 2014 at 2:10 PM, Manuel Paccagnella
 manuel.paccagne...@gmail.com wrote:
 Tested on Linux x64, Chromium 31.0.1650.63 and Firefox 26.0. Same behaviour
 that you have seen. However, I haven't looked at the code yet.

 Il giorno lunedì 17 febbraio 2014 20:34:22 UTC+1, t x ha scritto:

 Can anyone verify whether this bug is reproducible?

 On Mon, Feb 17, 2014 at 12:28 AM, t x txre...@gmail.com wrote:
  Hi,
 
repo: https://github.com/txrev319/bug-report
 
I have a really weird bug where:
 
* (my-macro ...) == everything works
 
* (async/go (my-macro ...)) == something weird happens
 
 
A minimal failure case is documented at:
  https://github.com/txrev319/bug-report/blob/master/src/app.cljx
 
It depends on the macro defined in:
  https://github.com/txrev319/bug-report/blob/master/src/macros.cljx
 
The bug can be replicated by following the instructions at:
  https://github.com/txrev319/bug-report/blob/master/README.md
 
I *believe* I have included everything required to replicate the
  bug. If I am missing anything, please let me know.
 
 
  Extra info:
 
  $ lein --version
  Leiningen 2.2.0 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM
 
  I'm on 64-bit OSX.
 
 
  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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

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

Re: weird bug with cljs.core.async + macros

2014-02-17 Thread t x
Building on Michal's example, here is a more minimal example --
which also fails in Clojure:


(ns test
  (:require [clojure.core.async :as async]))


(defmacro silly [obj pat1 body1 other]
  `(case ~obj
 ~pat1 ~body1
 ~other))

(let []

  (def out (java.io.StringWriter.))

  (defn log [ args]
(doseq [arg args]
  (.write out (str arg))
  (.write out \n)))


  (async/!! (async/go
  (silly :dog
 :dog (log with-go: woof woof)
 (log with-go: other

  (str out))

On Mon, Feb 17, 2014 at 5:14 PM, t x txrev...@gmail.com wrote:
 Hi Michal,

   Does this mean:

   (a) the reported behavior is normal (and my bug report is invalid) or

   (b) this error happens in both cljs + clojure ?

 Thanks!

 On Mon, Feb 17, 2014 at 4:33 PM, Michał Marczyk
 michal.marc...@gmail.com wrote:
 Just to be clear, the above is a version of t x's bug-report modified
 to use a StringWriter instead of console.log.

 Cheers,
 Michał


 On 18 February 2014 01:25, Michał Marczyk michal.marc...@gmail.com wrote:
 The same thing happens in Clojure:

 (defmacro silly [object pat1 body1 pat2 body2]
   `(case (:tag ~object)
  ~pat1 ~body1
  ~body2))

 (def out (java.io.StringWriter.))

 (defn log [ args]
   (doseq [arg args]
 (.write out (str arg))
 (.write out \n)))

 (defn init []
   (silly {:tag :dog}
  :dog (log without-go: woof woof)
  cat (log without-go: unrecognized))
   (async/go
(silly {:tag :dog}
   :dog (log with-go: woof woof)
   cat (log with-go: unrecognized

 (init)

 (print (str out))
 without-go: woof woof
 with-go: woof woof
 with-go: unrecognized
 nil

 Cheers,
 Michał


 On 18 February 2014 01:01, t x txrev...@gmail.com wrote:
 Thanks for verifying!

 @tbaldridge: can you enlighten us on if:

   * I'm doing something stupid or
   * this is an actual bug in cljs/core.async?

 Thanks!

 On Mon, Feb 17, 2014 at 2:10 PM, Manuel Paccagnella
 manuel.paccagne...@gmail.com wrote:
 Tested on Linux x64, Chromium 31.0.1650.63 and Firefox 26.0. Same 
 behaviour
 that you have seen. However, I haven't looked at the code yet.

 Il giorno lunedì 17 febbraio 2014 20:34:22 UTC+1, t x ha scritto:

 Can anyone verify whether this bug is reproducible?

 On Mon, Feb 17, 2014 at 12:28 AM, t x txre...@gmail.com wrote:
  Hi,
 
repo: https://github.com/txrev319/bug-report
 
I have a really weird bug where:
 
* (my-macro ...) == everything works
 
* (async/go (my-macro ...)) == something weird happens
 
 
A minimal failure case is documented at:
  https://github.com/txrev319/bug-report/blob/master/src/app.cljx
 
It depends on the macro defined in:
  https://github.com/txrev319/bug-report/blob/master/src/macros.cljx
 
The bug can be replicated by following the instructions at:
  https://github.com/txrev319/bug-report/blob/master/README.md
 
I *believe* I have included everything required to replicate the
  bug. If I am missing anything, please let me know.
 
 
  Extra info:
 
  $ lein --version
  Leiningen 2.2.0 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM
 
  I'm on 64-bit OSX.
 
 
  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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

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

Re: (series of swap! on atom) == single swap!

2014-02-16 Thread t x
Hi John,

  Your solution is perfectly valid and optimal for the problem I
described above.


  Unfortunately, I forgot to mention an additional constraint: sometimes I do:

(let [ foo (:some-selector @data-atom) ]
  (swap! data-atom update-in [:other-selector] ... ))

which the - doesn't quite work on, but my ugly hack above does resolve.


  The problem being -- I want to update one part of the atom, but it
depends on another part of the atom.

  I ended up with the following hack:

(defn tswap! [atm func]
  (swap! atm
 (fn [old]
   (let [natm (atom old)]
 (func natm)
 @natm


On Sat, Feb 15, 2014 at 4:09 PM, John D. Hume duelin.mark...@gmail.com wrote:
 On Sat, Feb 15, 2014 at 6:04 PM, t x txrev...@gmail.com wrote:


 (defn what-I-want []
   (with-atom some-atom
 assoc-in ...
 assoc-in ...
 update-in ...))


 I often do something like this and don't find it too ugly:
 (swap! my-atom #(- %
   (assoc-in [:k] v)
   (update-in [:k2] inc)
   ,,,))

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (series of swap! on atom) == single swap!

2014-02-16 Thread t x
I believe that's the STM approach, which has the advanrtage of:

  * can synchronize across multiple pieces of data

but has the disadvantage of:

  * work must be pure since it can be retried

  * possibly less efficient due to possibility of retrying


In the example I posted above, I only need to:

  * modify a single atom

and the approach I presented above:

  * can be impure, since it is guaranteed to only run once

  * is guaranteed to succeed (without retrys)

On Sun, Feb 16, 2014 at 2:25 PM, Ramesh ramesh10dul...@gmail.com wrote:
 You can use a ref instead of an atom. And use dosync with multiple alter, so
 everything is safely inside a transaction.

 On Feb 16, 2014 2:04 PM, t x txrev...@gmail.com wrote:

 Hi John,

   Your solution is perfectly valid and optimal for the problem I
 described above.


   Unfortunately, I forgot to mention an additional constraint: sometimes I
 do:

 (let [ foo (:some-selector @data-atom) ]
   (swap! data-atom update-in [:other-selector] ... ))

 which the - doesn't quite work on, but my ugly hack above does resolve.


   The problem being -- I want to update one part of the atom, but it
 depends on another part of the atom.

   I ended up with the following hack:

 (defn tswap! [atm func]
   (swap! atm
  (fn [old]
(let [natm (atom old)]
  (func natm)
  @natm


 On Sat, Feb 15, 2014 at 4:09 PM, John D. Hume duelin.mark...@gmail.com
 wrote:
  On Sat, Feb 15, 2014 at 6:04 PM, t x txrev...@gmail.com wrote:
 
 
  (defn what-I-want []
(with-atom some-atom
  assoc-in ...
  assoc-in ...
  update-in ...))
 
 
  I often do something like this and don't find it too ugly:
  (swap! my-atom #(- %
(assoc-in [:k] v)
(update-in [:k2] inc)
,,,))
 
  --
  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 unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (series of swap! on atom) == single swap!

2014-02-16 Thread t x
Hi Jan,

  You're right. I'm wrong.

  I'm grateful you pointed this out -- this would have otherwise been
impossible to debug.

===

To everyone:

  Why can swap! be retried? This confuses me -- to implement swap!, why can't we

  * have a lock

  * ensure that only one swap! is in session at any given time

  * have the given swap! complete before running the next swap!


Thanks!


On Sun, Feb 16, 2014 at 3:51 PM, Jan Herich jan.her...@gmail.com wrote:
 I'm afraid your understanding of atom swap! operations is not quite correct
 - update function must (or should) be pure as well.
 See the documentation for swap!, update function could be potentially called
 multiple times if there are more threads of execution
 updating one atomic reference - there is simple compare and set mechanism
 involved, which compares the old value of the atom
 (input for the update function) and sets the atom to new value (return value
 from the update function) only value of the atom reference
 was not changed in between, if yes the compare and set is retried until ti
 succeeds.

 Dňa nedeľa, 16. februára 2014 23:35:24 UTC+1 t x napísal(-a):

 I believe that's the STM approach, which has the advanrtage of:

   * can synchronize across multiple pieces of data

 but has the disadvantage of:

   * work must be pure since it can be retried

   * possibly less efficient due to possibility of retrying


 In the example I posted above, I only need to:

   * modify a single atom

 and the approach I presented above:

   * can be impure, since it is guaranteed to only run once

   * is guaranteed to succeed (without retrys)

 On Sun, Feb 16, 2014 at 2:25 PM, Ramesh ramesh1...@gmail.com wrote:
  You can use a ref instead of an atom. And use dosync with multiple
  alter, so
  everything is safely inside a transaction.
 
  On Feb 16, 2014 2:04 PM, t x txre...@gmail.com wrote:
 
  Hi John,
 
Your solution is perfectly valid and optimal for the problem I
  described above.
 
 
Unfortunately, I forgot to mention an additional constraint:
  sometimes I
  do:
 
  (let [ foo (:some-selector @data-atom) ]
(swap! data-atom update-in [:other-selector] ... ))
 
  which the - doesn't quite work on, but my ugly hack above does
  resolve.
 
 
The problem being -- I want to update one part of the atom, but it
  depends on another part of the atom.
 
I ended up with the following hack:
 
  (defn tswap! [atm func]
(swap! atm
   (fn [old]
 (let [natm (atom old)]
   (func natm)
   @natm
 
 
  On Sat, Feb 15, 2014 at 4:09 PM, John D. Hume duelin@gmail.com
  wrote:
   On Sat, Feb 15, 2014 at 6:04 PM, t x txre...@gmail.com wrote:
  
  
   (defn what-I-want []
 (with-atom some-atom
   assoc-in ...
   assoc-in ...
   update-in ...))
  
  
   I often do something like this and don't find it too ugly:
   (swap! my-atom #(- %
 (assoc-in [:k] v)
 (update-in [:k2] inc)
 ,,,))
  
   --
   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
   ---
   You received this message because you are subscribed to the Google
   Groups
   Clojure group.
   To unsubscribe from this group and stop receiving emails from it,
   send
   an
   email to clojure+u...@googlegroups.com.
   For more options, visit https://groups.google.com/groups/opt_out.
 
  --
  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
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
  --
  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
  ---
  You received this message because you are subscribed to the Google

(series of swap! on atom) == single swap!

2014-02-15 Thread t x
Hi,

  Consider the following block of code:

## Sample Code

(ns test)


(def some-atom (atom {:tag :language
  :name Clojure
  :better-than [scheme java ruby python]}))


(defn demo-func []
  (swap! some-atom assoc-in [:name] Clojure 1.6)
  (swap! some-atom assoc-in [:tag] :Language)
  (swap! some-atom update-in [:better-than] #(cons javascript %)))

;; I don't like the fact that things can happen between the swaps.

(defn what-I-want []
  (with-atom some-atom
assoc-in ...
assoc-in ...
update-in ...))

== act as if a single
(swap! some-atom
    all changes here ...)


## Question

  Now, what I don't like above is that the swap! in the first example
can be interleaved with other swaps.

  Instead, I'd like all three swaps to happen all at once. Thus, I
need to do something like:

(swap! some-atom
  (fn [old]
... ))

but, notationally, this is messy compared to a series of swap!


Is there something like:

with-atom ...

which basically takes a series of changes, and puts them into a single
swap! ...  ?

Thanks!

(I apologize if this question is not clear; and if so, please tell me
how I can make it more clear.)

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


query on clojure maps / vectors

2014-02-13 Thread t x
Hi,

Preemptive: :-)

  * I'm not looking for datomic.
  * I'm also not looking for sqlkorma.

  * An in-memory data-log might be what I'm after.

Context:

  I'm reading:
http://code.kx.com/wiki/JB:QforMortals2/tables

  and it struck me -- why can't I view a clojure {vector,list} of maps
as a table? I.e.:

  [{:tag :animal :type :dog :age 2}
  {:tag :animal :type :cat :age 4}]

  then do queries on things like:

get me all vector-indices of cats' of age = 3

Question:

  Is there a library (or even a blog post) about doing sql-like
querying on _in memory clojure data structures_ ?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: query on clojure maps / vectors

2014-02-13 Thread t x
@David:
  * set operations is not what I'm looking for
  * the relational algebra blog was very useful

@Jeb:
  * Ha! I didn't know that q could be used separate of datomic. I
might just use datomic after all.

Thanks!

On Thu, Feb 13, 2014 at 6:43 PM, Jeb Beich jebbe...@gmail.com wrote:
 You sure this isn't what you're looking for?

 https://gist.github.com/stuarthalloway/2645453


 On Thu, Feb 13, 2014 at 8:34 PM, David Jagoe davidja...@gmail.com wrote:

 Here's an example:


 http://www.bagdemir.com/2013/07/30/implementing-relational-algebra-in-clojure/


 On 13 February 2014 18:32, David Jagoe davidja...@gmail.com wrote:

 Would this work for you?

 http://clojure.github.io/clojure/clojure.set-api.html

 (in particular select for your example)


 On 13 February 2014 17:27, t x txrev...@gmail.com wrote:

 Hi,

 Preemptive: :-)

   * I'm not looking for datomic.
   * I'm also not looking for sqlkorma.

   * An in-memory data-log might be what I'm after.

 Context:

   I'm reading:
 http://code.kx.com/wiki/JB:QforMortals2/tables

   and it struck me -- why can't I view a clojure {vector,list} of maps
 as a table? I.e.:

   [{:tag :animal :type :dog :age 2}
   {:tag :animal :type :cat :age 4}]

   then do queries on things like:

 get me all vector-indices of cats' of age = 3

 Question:

   Is there a library (or even a blog post) about doing sql-like
 querying on _in memory clojure data structures_ ?

 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 unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 David Jagoe

 davidja...@gmail.com
 +18053284389




 --
 David Jagoe

 davidja...@gmail.com
 +18053284389

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


meta circular clojure

2014-02-11 Thread t x
Hi,

  With apologies for a soft question:

  * in SICP, the meta circular evaluator of scheme in scheme (chapter
4) is about a page
  * in Ansi Common Lisp, there's a lisp in lisp in about half a page

  * if we took Clojure, and ripped out all the JVM support (i.e.
gen-class, proxy, (.javaFunc ... ), (. obj javaFunc) ... ), but kept
clojure data structures (atoms, agents, maps, vectors, lists) -- is
there any reason we can't have a Clojure in Clojure meta circular
evaluator in about 2-3 pages?


 If the above exists, can someone please point me to a
clojure-in-clojure meta circular evaluator? (besides 'eval')

  If no such evaluator exists, where is the complexity of a
clojure-in-clojure evaluator that I failed to mention above?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: unconditional append to end

2014-02-10 Thread t x
Someone needs to make a flappy bird version of
http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html

It provides a description of the function, you type in the function name. :-)

On Mon, Feb 10, 2014 at 8:22 AM, Alan Thompson thompson2...@gmail.com wrote:
 Thank you for the cheat sheet refs.  Definitely helpful.

 Anybody have any insight into the current state of clojuredocs.org?
 Alan


 On Sun, Feb 9, 2014 at 9:38 PM, mynomoto mynom...@gmail.com wrote:

 +1 to the Cheat Sheet although I prefer this version:
 http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html

 After you go though the cheat sheet you can try
 http://clojure.github.io/clojure
 It's more complete but way less nice.


 On Monday, February 10, 2014 3:21:16 AM UTC-2, Mars0i wrote:

 On Sunday, February 9, 2014 10:45:04 PM UTC-6, Alan Thompson wrote:

 ...
 I saw an email a while back that claimed ClojureDocs.org is working on a
 re-write of the site, and an upgrade from Clojure 1.2 to 1.5.  In the
 meantime, is there a better way of exploring the API?


 Not a full answer, but I get a lot of mileage from the cheatsheet:
 http://clojure.org/cheatsheet

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


cljs, binding, async/go

2014-02-09 Thread t x
Hi,


## Consider this block of code:

(defn init [] ;; called from window.onload
   (def ^:dynamic *dvar*)

(binding [*dvar* 20]
  (. js/console log (str from main: *dvar*:  *dvar*))
  (async/go
   (. js/console log (str from go  : *dvar*:  *dvar*)


## In Chrome, I get back:

from main: *dvar*: 20
from go  : *dvar*: // returns nil

  I expect to get back:

from main: *dvar*: 20
from go  : *dvar*: 20


## Confusion:

* I was under the impression that go blocks works with binding/dynamic vars.

What am I doing wrong?

I'm using:

* [lein-cljsbuild 1.0.1-SNAPSHOT]
* [lein-cljsbuild 1.0.1-SNAPSHOT]
* [org.clojure/clojure 1.5.1]

I get the same behavior in both Firefox 26.0 and Chrome 32.0.1700.107

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: cljs, binding, async/go

2014-02-09 Thread t x
Hi Timothy,

  Useful to know this behavior is normal with respect to the current
state of cljs/core.async -- for the longest time I thought I was doing
something stupid / using wrong compiler options.

Thanks!

On Sun, Feb 9, 2014 at 6:35 AM, Timothy Baldridge tbaldri...@gmail.com wrote:
 Gos work with bindings on CLJ, CLJs biding  support is different enough that
 it doesn't currently work with gos.

 Timothy


 On Sun, Feb 9, 2014 at 7:33 AM, t x txrev...@gmail.com wrote:

 Hi,


 ## Consider this block of code:

 (defn init [] ;; called from window.onload
(def ^:dynamic *dvar*)

 (binding [*dvar* 20]
   (. js/console log (str from main: *dvar*:  *dvar*))
   (async/go
(. js/console log (str from go  : *dvar*:  *dvar*)


 ## In Chrome, I get back:

 from main: *dvar*: 20
 from go  : *dvar*: // returns nil

   I expect to get back:

 from main: *dvar*: 20
 from go  : *dvar*: 20


 ## Confusion:

 * I was under the impression that go blocks works with binding/dynamic
 vars.

 What am I doing wrong?

 I'm using:

 * [lein-cljsbuild 1.0.1-SNAPSHOT]
 * [lein-cljsbuild 1.0.1-SNAPSHOT]
 * [org.clojure/clojure 1.5.1]

 I get the same behavior in both Firefox 26.0 and Chrome 32.0.1700.107

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Alternative - macro for threading sequences?

2014-02-08 Thread t x
I think the problem is as follows:

map = 3 characters
filter = 6 characters

Given that we're doing clojure not apl, to specify the function we're
mapping/filtering on, we have to do either:
  #( ... %  ) = 5 characters off the bat
  or provide the name of the function (atleast 1 english word)

Thus, even if we reduced map to M and filter to F, it's very unlikely
that we'll ever shorten anything by more than 50% (just given the # of
characters required to specify the function that we are
mapping/filtering on.)


From this, it seems, unless we go the APL route and make the task of
describing the filtering/mapping function itself very short, there's
almost no gain in shortening map / filter.


This isn't meant to be discouraging -- in fact, I'd love to see a way
to mix APL + Clojure. :-) Often times, I'm looking at a multiline
clojure expression and thinking: this'd be a single line of APL.

On Fri, Feb 7, 2014 at 8:03 PM, Mars0i marsh...@logical.net wrote:
 Since a few of these higher order functions--map, filter, reduce, etc.--are
 so common and useful, I wonder whether there could be sufficient benefit to
 having some abbreviations for them.  I know that some of these characters
 are already taken, but just to sketch the idea:

 (-- things  %wrangle  %pacify  |effable  %#(aggravate % :bees :sharks)
 \(mapinate {}) )

 In one sense this reduces the visual complexity of Korny's example.  In
 another sense it increases it.  I thought this option was worth mentioning,
 but I don't think I like it.  It makes the syntax closer to line noise, and
 if there are too many magical characters, no one will remember what they
 mean except the people who use them all of the time (like some of the
 options in Perl regexps).  Why not go all the way, and provide an alternate
 APL-style syntax for Clojure?


 On Friday, February 7, 2014 9:14:27 AM UTC-6, t x wrote:

 I think

 (- things
 (map wrangle)
 (map pacify)
 (filter effable)
 (map #(aggravate % :bees :sharks))
 (reduce mapinate {})


 is optimal for the following reason:


 If you're doing map and map alone, i.e.

 (- things
   (map f1)
   (map f2)
   (map f3)
   (map f4))

 then you can do:

 (map #(f4 (f3 (f2 (f1 % things)


 Now, if you're not doing pure maps, i.e. maps + filters

 Then for each function call, from an information theoretic
 perspective, you have to, at the very least, specify:

   (*) the function to be called
   (*) whether it's a filter or a map

 in this case,

 what you initially have is optimal.

 On Fri, Feb 7, 2014 at 6:33 AM, Korny Sietsma ko...@sietsma.com wrote:
  I tend to agree, I think.  I certainly can't think of a syntax that
  would
  make me happy.  It just feels like a bit of a smell that I keep using
  - to
  process sequences in similar ways.
 
  The data.zip xml- macro is an example of something like what I'm
  thinking
  about - it lets you process sequences of xml data nicely:
  http://clojure.github.io/data.zip/#clojure.data.zip.xml/xml-
 
  ... but I can't see a way to use something similar for the sort of data
  I'm
  processing.  I'll let this percolate, and stick to just using lots of
  (map)
  and (filter) instead.
 
  - Korny
 
 
  On 6 February 2014 18:34, Jozef Wagner jozef@gmail.com wrote:
 
  I agree with Colin, the cognitive load is greater than benefits of such
  approach. BTW you can use comp to chain consecutive map transformation
  functions. (map (comp pacify wrangle) things)
 
  JW
 
 
  On Thu, Feb 6, 2014 at 3:40 PM, Korny Sietsma ko...@sietsma.com
  wrote:
 
  Hi folks,
 
  I seem to regularly find myself writing - threaded code that follows
  similar patterns:
 
  (- things
  (map wrangle)
  (map pacify)
  (filter effable)
  (map #(aggravate % :bees :sharks))
  (reduce mapinate {})
 
  i.e. all stages of the code actually operate on a collection rather
  than
  a single value - usually with a call to map at each stage.  This
  example
  is over simplified - often many of the calls to map are inline
  functions,
  which makes this even more verbose.
 
  I wonder if there would be value in (yet another) variant on '-' that
  assumes you are threading a collection and calling 'map' by default.
  I'm
  not sure of the syntax that would work though.  Something like:
 
  ([]- things
  wrangle
  pacify
  [:filter effable]
  (aggravate :bees :sharks)
  [:reduce mapinate {}])
 
  I'm not sure about the syntax for non-map functions, I'm not even sure
  if
  this is worthwhile.  Thoughts?
 
  - Korny
 
  --
  Kornelis Sietsma  korny at my surname dot com http://korny.info
  .fnord { display: none !important; }
 
  --
  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

pdf.js

2014-02-08 Thread t x
Hi,

  I've looked at the first few pages of Google results for pdf.js
cljs and found nothing.

  Before I start hacking on my own pdf.js bindings, I wanted to ask --
does anyone have cljs bindings to pdf.js ?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Alternative - macro for threading sequences?

2014-02-07 Thread t x
 I think

(- things
(map wrangle)
(map pacify)
(filter effable)
(map #(aggravate % :bees :sharks))
(reduce mapinate {})


is optimal for the following reason:


If you're doing map and map alone, i.e.

(- things
  (map f1)
  (map f2)
  (map f3)
  (map f4))

then you can do:

(map #(f4 (f3 (f2 (f1 % things)


Now, if you're not doing pure maps, i.e. maps + filters

Then for each function call, from an information theoretic
perspective, you have to, at the very least, specify:

  (*) the function to be called
  (*) whether it's a filter or a map

in this case,

what you initially have is optimal.

On Fri, Feb 7, 2014 at 6:33 AM, Korny Sietsma ko...@sietsma.com wrote:
 I tend to agree, I think.  I certainly can't think of a syntax that would
 make me happy.  It just feels like a bit of a smell that I keep using - to
 process sequences in similar ways.

 The data.zip xml- macro is an example of something like what I'm thinking
 about - it lets you process sequences of xml data nicely:
 http://clojure.github.io/data.zip/#clojure.data.zip.xml/xml-

 ... but I can't see a way to use something similar for the sort of data I'm
 processing.  I'll let this percolate, and stick to just using lots of (map)
 and (filter) instead.

 - Korny


 On 6 February 2014 18:34, Jozef Wagner jozef.wag...@gmail.com wrote:

 I agree with Colin, the cognitive load is greater than benefits of such
 approach. BTW you can use comp to chain consecutive map transformation
 functions. (map (comp pacify wrangle) things)

 JW


 On Thu, Feb 6, 2014 at 3:40 PM, Korny Sietsma ko...@sietsma.com wrote:

 Hi folks,

 I seem to regularly find myself writing - threaded code that follows
 similar patterns:

 (- things
 (map wrangle)
 (map pacify)
 (filter effable)
 (map #(aggravate % :bees :sharks))
 (reduce mapinate {})

 i.e. all stages of the code actually operate on a collection rather than
 a single value - usually with a call to map at each stage.  This example
 is over simplified - often many of the calls to map are inline functions,
 which makes this even more verbose.

 I wonder if there would be value in (yet another) variant on '-' that
 assumes you are threading a collection and calling 'map' by default.  I'm
 not sure of the syntax that would work though.  Something like:

 ([]- things
 wrangle
 pacify
 [:filter effable]
 (aggravate :bees :sharks)
 [:reduce mapinate {}])

 I'm not sure about the syntax for non-map functions, I'm not even sure if
 this is worthwhile.  Thoughts?

 - Korny

 --
 Kornelis Sietsma  korny at my surname dot com http://korny.info
 .fnord { display: none !important; }

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Kornelis Sietsma  korny at my surname dot com http://korny.info
 .fnord { display: none !important; }

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google

unconditional append to end

2014-02-07 Thread t x
Consider the following:

(cons 1 '(2 3 4)) == (1 2 3 4)
(cons 1 [2 3 4])  == (1 2 3 4)

(conj '(a b c) 1) == (1 a b c)
(conj '[a b c] 1) == [a b c 1]




Now, I would like something that _always_
  * appends to the end

cons is almost what I want, except it always appends to front.

conj is not what I want -- in fact, I'm afraid of conj. Often times,
I'll run map/filter on something, and suddenly, instead of a vector, I
now have a list -- and conj changes the order of the item added.

Thus, my question: is there a builtin to _unconditinoally_ append to
the end of a list/sequence/vector?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


how does source work?

2014-02-04 Thread t x
Hi,

user (source source)
(defmacro source
  Prints the source code for the given symbol, if it can find it.
  This requires that the symbol resolve to a Var defined in a
  namespace for which the .clj is in the classpath.

  Example: (source filter)
  [n]
  `(println (or (source-fn '~n) (str Source not found
nil
user (source source-fn)
Source not found
nil


Is there a way, from pure-clojure that I can implement my-def +
my-source (without using def+source) which behaves as def+source does
... or does doing so require writing Java code?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: how does source work?

2014-02-04 Thread t x
Issue resolved. Thanks!

On Tue, Feb 4, 2014 at 1:09 PM, Michał Marczyk michal.marc...@gmail.com wrote:
 source-fn is a private Var in the clojure.repl namespace; you can
 still use source to display its definition, but you'll have to use the
 fully qualified name:

 user= (source clojure.repl/source-fn)
 (defn source-fn
   Returns a string of the source code for the given symbol, if it can
   find it.  This requires that the symbol resolve to a Var defined in
   a namespace for which the .clj is in the classpath.  Returns nil if
   it can't find the source.  For most REPL usage, 'source' is more
   convenient.

   Example: (source-fn 'filter)
   [x]
   (when-let [v (resolve x)]
 (when-let [filepath (:file (meta v))]
   (when-let [strm (.getResourceAsStream (RT/baseLoader) filepath)]
 (with-open [rdr (LineNumberReader. (InputStreamReader. strm))]
   (dotimes [_ (dec (:line (meta v)))] (.readLine rdr))
   (let [text (StringBuilder.)
 pbr (proxy [PushbackReader] [rdr]
   (read [] (let [i (proxy-super read)]
  (.append text (char i))
  i)))]
 (read (PushbackReader. pbr))
 (str text)))

 Cheers,
 Michał


 On 4 February 2014 21:34, t x txrev...@gmail.com wrote:
 Hi,

 user (source source)
 (defmacro source
   Prints the source code for the given symbol, if it can find it.
   This requires that the symbol resolve to a Var defined in a
   namespace for which the .clj is in the classpath.

   Example: (source filter)
   [n]
   `(println (or (source-fn '~n) (str Source not found
 nil
 user (source source-fn)
 Source not found
 nil


 Is there a way, from pure-clojure that I can implement my-def +
 my-source (without using def+source) which behaves as def+source does
 ... or does doing so require writing Java code?

 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


cljs sound synthesis

2014-02-03 Thread t x
Hi,

  Are there any tutorials for doing sound synthesis in _cljs_, using
latest firefox/chrome features?

  I'm not looking for
http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/ ..
which wraps Overtone . I'm looking for something where the actual
synthesis is done in js land as well.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: soft question: should remote channels appear like local channels

2014-02-01 Thread t x
I agree, besides potential connection loss, I no longer see the
distinction between local async channel and remote async channel.

Thanks to everyone for clarifications / help.

On Fri, Jan 31, 2014 at 6:51 PM, Sean Corfield s...@corfield.org wrote:
 I like that way of thinking, Timothy!

 Thomas: it's very specifically two separate channels; on the client
 side, code puts data on a channel and additional client code (in a
 library) takes data off the channel and handles the client/server
 communication; on the server side, a library reads data from the
 client/server connection and puts it on a channel, and your own server
 side code takes data from that channel. And the same thing in reverse.

 The point is that each side is isolated and core.async is used as a
 way to interact with a library that consumes data (and sends it
 somewhere) and produces data (that it reads from somewhere). The
 application code doesn't care about the client/server bridge -
 that's the library's problem. Cedric's right about connection loss etc
 but that's all part of what the library deals with - if it can't
 consume from a channel (because it can't send data over the wire),
 that's the same as any other consumer failing to take data from a
 channel that you supply.

 Sean

 On Fri, Jan 31, 2014 at 7:59 AM, Timothy Baldridge tbaldri...@gmail.com 
 wrote:
 A quick thought...there really isn't much of a difference between a failing
 network connection and a (chan (dropping-buffer 1024))

 Both may (or may not) drop information that you put into them, but also,
 both can be expected to work normally as long as certain conditions hold.
 Namely, the net connection doesn't die, or the consumer can keep up with the
 data being put into the dropping buffer.

 So that's my advice, if you can't guarantee the data will reach the remote
 end, or you can't perfectly match core.async back pressure semantics, simply
 use a dropping buffer at the edges and code to those semantics.

 Timothy

 Timothy


 On Fri, Jan 31, 2014 at 3:37 AM, Thomas Heller th.hel...@gmail.com wrote:

 Hi,

 only advice I can give is: no or don't.

 In the many years I have done web development one of the most important
 things I have learned is to keep the server as stateless as possible. Data
 is easily kept externally while channels are not. Channels also aren't
 exactly simple state since they are usually also attached to some go-blocks
 and the like. While its very common the handle disconnects of the client on
 the server und not as common to handle disconnects of the server on the
 client.

 Disconnects are very frequent so you need to respect them, machines go to
 sleep, wireless goes away, servers get restarted, jvms crash, etc.

 Never assume that a remote channel actually exist when writing to it,
 unless you have some really solid error recovery (which probably is more
 work than using traditional approaches).

 Just my 2 cents.

 /thomas


 On Friday, January 31, 2014 6:43:14 AM UTC+1, t x wrote:

 Hi,

 With apologies for a soft question:

 This question is NOT:

   I'm in a situation where client = cljs, server = clj, and I want to
 figure out how to setup a core.async channel, using pr-str and
 edn/read-string, where I can seamlessly push data back and forth
 between client and server.

 This question is:

   Should I do the above?

   The pro being: yay, channels everywhere, everything looks the same.

   The con being: a local core.async channel and a remote core.async
 channel over a websocket are _NOT_ the same thing, and thus should not
 appear to be the same thing.

 ## Responses:

 Although detailed responses are always appreciated, given the nature
 of this soft question, responses of go read _link_ are perfectly
 welcome too.

 I suspect someone in this world has thought deeply about the question,
 written up their insights, and pointing me at this primary resource
 (rather than trying to summarize it in a three paragraph email) is
 perfectly fine too.

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




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

Re: soft question: should remote channels appear like local channels

2014-01-31 Thread t x
  Originally, I had this mental analogy of:

function call :: remote procedure call = local async :: async over websocket

  In the func vs rpc case, the distinction is important to know what
is fast / what requires a network connection.

  However, upon further reflection, this analogy / distinction doesn't
hold in the local async / async over websocket because ... async
doesn't require immedaite return -- the mental model is: I fire off
this message to a mailbox, and forget about it -- so whether the
destination is in the same apartment complex or another state doesn't
really matter.




On Fri, Jan 31, 2014 at 7:59 AM, Timothy Baldridge tbaldri...@gmail.com wrote:
 A quick thought...there really isn't much of a difference between a failing
 network connection and a (chan (dropping-buffer 1024))

 Both may (or may not) drop information that you put into them, but also,
 both can be expected to work normally as long as certain conditions hold.
 Namely, the net connection doesn't die, or the consumer can keep up with the
 data being put into the dropping buffer.

 So that's my advice, if you can't guarantee the data will reach the remote
 end, or you can't perfectly match core.async back pressure semantics, simply
 use a dropping buffer at the edges and code to those semantics.

 Timothy

 Timothy


 On Fri, Jan 31, 2014 at 3:37 AM, Thomas Heller th.hel...@gmail.com wrote:

 Hi,

 only advice I can give is: no or don't.

 In the many years I have done web development one of the most important
 things I have learned is to keep the server as stateless as possible. Data
 is easily kept externally while channels are not. Channels also aren't
 exactly simple state since they are usually also attached to some go-blocks
 and the like. While its very common the handle disconnects of the client on
 the server und not as common to handle disconnects of the server on the
 client.

 Disconnects are very frequent so you need to respect them, machines go to
 sleep, wireless goes away, servers get restarted, jvms crash, etc.

 Never assume that a remote channel actually exist when writing to it,
 unless you have some really solid error recovery (which probably is more
 work than using traditional approaches).

 Just my 2 cents.

 /thomas


 On Friday, January 31, 2014 6:43:14 AM UTC+1, t x wrote:

 Hi,

 With apologies for a soft question:

 This question is NOT:

   I'm in a situation where client = cljs, server = clj, and I want to
 figure out how to setup a core.async channel, using pr-str and
 edn/read-string, where I can seamlessly push data back and forth
 between client and server.

 This question is:

   Should I do the above?

   The pro being: yay, channels everywhere, everything looks the same.

   The con being: a local core.async channel and a remote core.async
 channel over a websocket are _NOT_ the same thing, and thus should not
 appear to be the same thing.

 ## Responses:

 Although detailed responses are always appreciated, given the nature
 of this soft question, responses of go read _link_ are perfectly
 welcome too.

 I suspect someone in this world has thought deeply about the question,
 written up their insights, and pointing me at this primary resource
 (rather than trying to summarize it in a three paragraph email) is
 perfectly fine too.

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google
Groups Clojure

(async/go (async/chan)) gc ?

2014-01-30 Thread t x
Hi,

  Consider this block of code:

  (async/go (async/chan))

  This creates a go-thread and a go-chan.

  The go-thread is linked from the list of blocked go-threads.

  The go-chan is linked from the go-thread.

  Thus, did we just create a go-thread and a go-chan which is NOT gc-ed at all?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (async/go (async/chan)) gc ?

2014-01-30 Thread t x
 The key thing to remember in all questions of core.async GC is that there is
 no global blocked gos queue. Instead, the blocked gos are attached
 directly to the channel. When the channel is GC'd all attached gos are GC'd
 as well.

This is the source of all my mis-understanding. Thanks for explaining!



 So in this case, it's actually even simpler.the go never blocks. What
 this code is doing is creating a channel to return from the go. This channel
 has a buffer size of 1. It then puts a channel into the channel. The go then
 exits and is GC'd. Once the return channel is discarded by the caller of
 this code, both channels are also GC'd

 Timothy


 On Thu, Jan 30, 2014 at 11:24 AM, t x txrev...@gmail.com wrote:

 Hi,

   Consider this block of code:

   (async/go (async/chan))

   This creates a go-thread and a go-chan.

   The go-thread is linked from the list of blocked go-threads.

   The go-chan is linked from the go-thread.

   Thus, did we just create a go-thread and a go-chan which is NOT gc-ed at
 all?

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (async/go (async/chan)) gc ?

2014-01-30 Thread t x
Following up on this. Is the following correct:

* async/thread creates Java threads -- these _are_ root gc objects

* async/go creates go blocks, which in reality, is just a state
machine. go-blocks are NOT root gc objects

* go-blocks do _NOT_ have stackframes -- they're just a simple, flat
state machine created via inversion of control at !, !, and alt!
locations

* when a go-block blocks, it gets appended to either the put or the
take queue of the channel it's blocking on

Thus, in the following code:

(let [c (async/chan)
  d (async/go (! c))] )

what happens is the following thing:

* we create a channel c
* we create a go-block, who returns to a channel d
* the go block hits (! c), then gets ioc-ed into a state machine
* this state machine is put on the take-list of c

Then, the GC collects c and d -- and the go-block vanishes, since
it's just a state machine attached to c


Can you please tell me if

(1) all above statements are correct or
(2) correct the wrong ones in place?

Thanks!


On Thu, Jan 30, 2014 at 11:06 AM, t x txrev...@gmail.com wrote:
 The key thing to remember in all questions of core.async GC is that there is
 no global blocked gos queue. Instead, the blocked gos are attached
 directly to the channel. When the channel is GC'd all attached gos are GC'd
 as well.

 This is the source of all my mis-understanding. Thanks for explaining!



 So in this case, it's actually even simpler.the go never blocks. What
 this code is doing is creating a channel to return from the go. This channel
 has a buffer size of 1. It then puts a channel into the channel. The go then
 exits and is GC'd. Once the return channel is discarded by the caller of
 this code, both channels are also GC'd

 Timothy


 On Thu, Jan 30, 2014 at 11:24 AM, t x txrev...@gmail.com wrote:

 Hi,

   Consider this block of code:

   (async/go (async/chan))

   This creates a go-thread and a go-chan.

   The go-thread is linked from the list of blocked go-threads.

   The go-chan is linked from the go-thread.

   Thus, did we just create a go-thread and a go-chan which is NOT gc-ed at
 all?

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: (async/go (async/chan)) gc ?

2014-01-30 Thread t x
Great! Thanks for verifying.

On Thu, Jan 30, 2014 at 11:46 AM, Jozef Wagner jozef.wag...@gmail.com wrote:
 Seems OK. Note that code inside go blocks is transformed into state machine
 'object' immediatelly, not waiting for hitting !, as go is a macro.


 On Thu, Jan 30, 2014 at 8:36 PM, t x txrev...@gmail.com wrote:

 Following up on this. Is the following correct:

 * async/thread creates Java threads -- these _are_ root gc objects

 * async/go creates go blocks, which in reality, is just a state
 machine. go-blocks are NOT root gc objects

 * go-blocks do _NOT_ have stackframes -- they're just a simple, flat
 state machine created via inversion of control at !, !, and alt!
 locations

 * when a go-block blocks, it gets appended to either the put or the
 take queue of the channel it's blocking on

 Thus, in the following code:

 (let [c (async/chan)
   d (async/go (! c))] )

 what happens is the following thing:

 * we create a channel c
 * we create a go-block, who returns to a channel d
 * the go block hits (! c), then gets ioc-ed into a state machine
 * this state machine is put on the take-list of c

 Then, the GC collects c and d -- and the go-block vanishes, since
 it's just a state machine attached to c


 Can you please tell me if

 (1) all above statements are correct or
 (2) correct the wrong ones in place?

 Thanks!


 On Thu, Jan 30, 2014 at 11:06 AM, t x txrev...@gmail.com wrote:
  The key thing to remember in all questions of core.async GC is that
  there is
  no global blocked gos queue. Instead, the blocked gos are attached
  directly to the channel. When the channel is GC'd all attached gos are
  GC'd
  as well.
 
  This is the source of all my mis-understanding. Thanks for explaining!
 
 
 
  So in this case, it's actually even simpler.the go never blocks.
  What
  this code is doing is creating a channel to return from the go. This
  channel
  has a buffer size of 1. It then puts a channel into the channel. The go
  then
  exits and is GC'd. Once the return channel is discarded by the caller
  of
  this code, both channels are also GC'd
 
  Timothy
 
 
  On Thu, Jan 30, 2014 at 11:24 AM, t x txrev...@gmail.com wrote:
 
  Hi,
 
Consider this block of code:
 
(async/go (async/chan))
 
This creates a go-thread and a go-chan.
 
The go-thread is linked from the list of blocked go-threads.
 
The go-chan is linked from the go-thread.
 
Thus, did we just create a go-thread and a go-chan which is NOT
  gc-ed at
  all?
 
  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 unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
  --
  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
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send

soft question: should remote channels appear like local channels

2014-01-30 Thread t x
Hi,

With apologies for a soft question:

This question is NOT:

  I'm in a situation where client = cljs, server = clj, and I want to
figure out how to setup a core.async channel, using pr-str and
edn/read-string, where I can seamlessly push data back and forth
between client and server.

This question is:

  Should I do the above?

  The pro being: yay, channels everywhere, everything looks the same.

  The con being: a local core.async channel and a remote core.async
channel over a websocket are _NOT_ the same thing, and thus should not
appear to be the same thing.

## Responses:

Although detailed responses are always appreciated, given the nature
of this soft question, responses of go read _link_ are perfectly
welcome too.

I suspect someone in this world has thought deeply about the question,
written up their insights, and pointing me at this primary resource
(rather than trying to summarize it in a three paragraph email) is
perfectly fine too.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


core.typed

2014-01-28 Thread t x
## Background

  I'm using [org.clojure/core.typed 0.2.25]

## Question:

  Which is the following is true:

  (1) my code is correct / should work, and therefore there is something
with my setup

  (2) my code is wrong (and please point out how I can fix it)


## Code

(ns test
  #+clj (:require [clojure.core.typed])
  #+clj (:use [clojure.core.typed]))

(ann add [Number Number - Number])
(defn add [a b]
  (+ a b))

(check-ns)


## Error

When I execute the above, I get the following error.

It's not clear to me what I'm doing wrong.

java.lang.NullPointerException: null
 at clojure.core$deref_future.invoke (core.clj:2108)
clojure.core$deref.invoke (core.clj:2129)
cljs.analyzer$resolve_var.invoke (analyzer.clj:347)
cljs.analyzer$resolve_var.invoke (analyzer.clj:308)
clojure.core.typed.util_cljs$resolve_var.invoke (util_cljs.clj:40)
clojure.core.typed.parse_unparse$resolve_type_cljs.invoke
(parse_unparse.clj:585)
clojure.core.typed.parse_unparse/fn (parse_unparse.clj:709)
clojure.lang.MultiFn.invoke (MultiFn.java:227)
clojure.core.typed.parse_unparse/fn (parse_unparse.clj:723)
clojure.lang.MultiFn.invoke (MultiFn.java:227)
clojure.core.typed.parse_unparse$parse_function.invoke
(parse_unparse.clj:879)
clojure.core.typed.parse_unparse/fn (parse_unparse.clj:900)
clojure.lang.MultiFn.invoke (MultiFn.java:227)

clojure.core.typed.base_env_cljs$generator_init_jsnominals$iter__17058__17062$fn__17063$fn__17320$iter__17321__17325$fn__17326.invoke
(base_env_cljs.clj:31)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:484)
clojure.core$seq.invoke (core.clj:133)
clojure.core.protocols$seq_reduce.invoke (protocols.clj:30)
clojure.core.protocols/fn (protocols.clj:54)
clojure.core.protocols$fn__5979$G__5974__5992.invoke (protocols.clj:13)
clojure.core$reduce.invoke (core.clj:6177)
clojure.core$into.invoke (core.clj:6229)
clojure.lang.AFn.applyToHelper (AFn.java:163)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:619)
clojure.core.contracts.constraints$apply_contract$fn__845.doInvoke
(constraints.clj:175)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
clojure.lang.RestFn.invoke (RestFn.java:421)

clojure.core.typed.base_env_cljs$generator_init_jsnominals$iter__17058__17062$fn__17063$fn__17320.invoke
(base_env_cljs.clj:31)

clojure.core.typed.base_env_cljs$generator_init_jsnominals$iter__17058__17062$fn__17063.invoke
(base_env_cljs.clj:31)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:60)
clojure.lang.RT.seq (RT.java:484)
clojure.core$seq.invoke (core.clj:133)
clojure.core$dorun.invoke (core.clj:2780)
clojure.core$doall.invoke (core.clj:2796)
clojure.core.typed.base_env_cljs$generator_init_jsnominals.invoke
(base_env_cljs.clj:31)
clojure.core.typed.base_env_cljs$init_jsnominals.invoke
(base_env_cljs.clj:29)
clojure.core.typed.base_env_cljs$reset_jsnominal_env_BANG_.invoke
(base_env_cljs.clj:67)
clojure.core.typed.base_env_cljs$generator_init_alias_env.invoke
(base_env_cljs.clj:138)
clojure.core.typed.base_env_cljs$init_alias_env.invoke
(base_env_cljs.clj:136)
clojure.core.typed.base_env_cljs$reset_alias_env_BANG_.invoke
(base_env_cljs.clj:159)
clojure.core.typed.base_env_cljs$reset_cljs_envs_BANG_$fn__17803.invoke
(base_env_cljs.clj:188)
clojure.core.typed.base_env_cljs$reset_cljs_envs_BANG_.invoke
(base_env_cljs.clj:187)
clojure.core.typed.reset_env$reset_envs_BANG_.invoke (reset_env.clj:24)
clojure.core.typed$check_ns_info.doInvoke (typed.clj:1490)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.lang.AFn.applyToHelper (AFn.java:161)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:619)
clojure.core.typed$check_ns.doInvoke (typed.clj:1559)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.core.typed$check_ns.invoke (typed.clj:1557)
test$eval21761.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:6619)
clojure.lang.Compiler.eval (Compiler.java:6582)
clojure.core$eval.invoke (core.clj:2852)
clojure.main$repl$read_eval_print__6588$fn__6591.invoke (main.clj:259)
clojure.main$repl$read_eval_print__6588.invoke (main.clj:259)
clojure.main$repl$fn__6597.invoke (main.clj:277)
clojure.main$repl.doInvoke (main.clj:277)
clojure.lang.RestFn.invoke (RestFn.java:1096)

clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__5040.invoke
(interruptible_eval.clj:56)
clojure.lang.AFn.applyToHelper (AFn.java:159)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:617)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1788)
clojure.lang.RestFn.invoke (RestFn.java:425)

Re: core.typed

2014-01-28 Thread t x
Hi Ambrose,

Yes, I have a manual dependency on:
 [org.clojure/clojurescript 0.0-2138]

I looked at the project.clj of core.typed, and got:

https://github.com/clojure/core.typed/blob/master/project.clj#L13

Is the dependency on [org.clojure/clojurescript 0.0-1859] correct?
(it seems rather outdated).

Thanks!

On Tue, Jan 28, 2014 at 4:59 AM, Ambrose Bonnaire-Sergeant
abonnaireserge...@gmail.com wrote:
 Hi,

 There is some conflict with ClojureScript, some others have also observed
 this.

 Is there some library that is upgrading the Clojurescript version to one
 different to
 what core.typed depends on?

 Thanks,
 Ambrose


 On Tue, Jan 28, 2014 at 5:38 PM, t x txrev...@gmail.com wrote:

 ## Background

   I'm using [org.clojure/core.typed 0.2.25]

 ## Question:

   Which is the following is true:

   (1) my code is correct / should work, and therefore there is something
 with my setup

   (2) my code is wrong (and please point out how I can fix it)


 ## Code

 (ns test
   #+clj (:require [clojure.core.typed])
   #+clj (:use [clojure.core.typed]))

 (ann add [Number Number - Number])
 (defn add [a b]
   (+ a b))

 (check-ns)


 ## Error

 When I execute the above, I get the following error.

 It's not clear to me what I'm doing wrong.

 java.lang.NullPointerException: null
  at clojure.core$deref_future.invoke (core.clj:2108)
 clojure.core$deref.invoke (core.clj:2129)
 cljs.analyzer$resolve_var.invoke (analyzer.clj:347)
 cljs.analyzer$resolve_var.invoke (analyzer.clj:308)
 clojure.core.typed.util_cljs$resolve_var.invoke (util_cljs.clj:40)
 clojure.core.typed.parse_unparse$resolve_type_cljs.invoke
 (parse_unparse.clj:585)
 clojure.core.typed.parse_unparse/fn (parse_unparse.clj:709)
 clojure.lang.MultiFn.invoke (MultiFn.java:227)
 clojure.core.typed.parse_unparse/fn (parse_unparse.clj:723)
 clojure.lang.MultiFn.invoke (MultiFn.java:227)
 clojure.core.typed.parse_unparse$parse_function.invoke
 (parse_unparse.clj:879)
 clojure.core.typed.parse_unparse/fn (parse_unparse.clj:900)
 clojure.lang.MultiFn.invoke (MultiFn.java:227)

 clojure.core.typed.base_env_cljs$generator_init_jsnominals$iter__17058__17062$fn__17063$fn__17320$iter__17321__17325$fn__17326.invoke
 (base_env_cljs.clj:31)
 clojure.lang.LazySeq.sval (LazySeq.java:42)
 clojure.lang.LazySeq.seq (LazySeq.java:60)
 clojure.lang.RT.seq (RT.java:484)
 clojure.core$seq.invoke (core.clj:133)
 clojure.core.protocols$seq_reduce.invoke (protocols.clj:30)
 clojure.core.protocols/fn (protocols.clj:54)
 clojure.core.protocols$fn__5979$G__5974__5992.invoke
 (protocols.clj:13)
 clojure.core$reduce.invoke (core.clj:6177)
 clojure.core$into.invoke (core.clj:6229)
 clojure.lang.AFn.applyToHelper (AFn.java:163)
 clojure.lang.AFn.applyTo (AFn.java:151)
 clojure.core$apply.invoke (core.clj:619)
 clojure.core.contracts.constraints$apply_contract$fn__845.doInvoke
 (constraints.clj:175)
 clojure.lang.RestFn.applyTo (RestFn.java:137)
 clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
 clojure.lang.RestFn.invoke (RestFn.java:421)

 clojure.core.typed.base_env_cljs$generator_init_jsnominals$iter__17058__17062$fn__17063$fn__17320.invoke
 (base_env_cljs.clj:31)

 clojure.core.typed.base_env_cljs$generator_init_jsnominals$iter__17058__17062$fn__17063.invoke
 (base_env_cljs.clj:31)
 clojure.lang.LazySeq.sval (LazySeq.java:42)
 clojure.lang.LazySeq.seq (LazySeq.java:60)
 clojure.lang.RT.seq (RT.java:484)
 clojure.core$seq.invoke (core.clj:133)
 clojure.core$dorun.invoke (core.clj:2780)
 clojure.core$doall.invoke (core.clj:2796)
 clojure.core.typed.base_env_cljs$generator_init_jsnominals.invoke
 (base_env_cljs.clj:31)
 clojure.core.typed.base_env_cljs$init_jsnominals.invoke
 (base_env_cljs.clj:29)
 clojure.core.typed.base_env_cljs$reset_jsnominal_env_BANG_.invoke
 (base_env_cljs.clj:67)
 clojure.core.typed.base_env_cljs$generator_init_alias_env.invoke
 (base_env_cljs.clj:138)
 clojure.core.typed.base_env_cljs$init_alias_env.invoke
 (base_env_cljs.clj:136)
 clojure.core.typed.base_env_cljs$reset_alias_env_BANG_.invoke
 (base_env_cljs.clj:159)

 clojure.core.typed.base_env_cljs$reset_cljs_envs_BANG_$fn__17803.invoke
 (base_env_cljs.clj:188)
 clojure.core.typed.base_env_cljs$reset_cljs_envs_BANG_.invoke
 (base_env_cljs.clj:187)
 clojure.core.typed.reset_env$reset_envs_BANG_.invoke
 (reset_env.clj:24)
 clojure.core.typed$check_ns_info.doInvoke (typed.clj:1490)
 clojure.lang.RestFn.invoke (RestFn.java:410)
 clojure.lang.AFn.applyToHelper (AFn.java:161)
 clojure.lang.RestFn.applyTo (RestFn.java:132)
 clojure.core$apply.invoke (core.clj:619)
 clojure.core.typed$check_ns.doInvoke (typed.clj:1559)
 clojure.lang.RestFn.invoke (RestFn.java:410)
 clojure.core.typed$check_ns.invoke (typed.clj:1557)
 test$eval21761.invoke (NO_SOURCE_FILE:1)
 clojure.lang.Compiler.eval

mimic erlang in core.async

2014-01-28 Thread t x
Hi,

  With apologies for a vague question:

  Is there a library built on top of core.async that tries to mimic
erlang-like processes?

  The main features I'm looking for are:

  * each channel has a single go-thread attached to it

  * ! sends messages of the form
  {:tag :message
   :return-channel ;; input channel associated with the go-thread
we're running in
   :message ... actual message }

  I find that this is basically what I'm already doing, but it's just
a bit clunky at the moment.

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: mimic erlang in core.async

2014-01-28 Thread t x
Hi John,

  This is great. I really like minimal examples to hack on / play with.

Thanks!

On Tue, Jan 28, 2014 at 3:46 PM, john walker john.lou.wal...@gmail.com wrote:
 This doesn't answer your question, but you might find it interesting if you
 search for actors on it:

 https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj


 On Tuesday, January 28, 2014 6:43:19 PM UTC-5, t x wrote:

 Hi,

   With apologies for a vague question:

   Is there a library built on top of core.async that tries to mimic
 erlang-like processes?

   The main features I'm looking for are:

   * each channel has a single go-thread attached to it

   * ! sends messages of the form
   {:tag :message
:return-channel ;; input channel associated with the go-thread
 we're running in
:message ... actual message }

   I find that this is basically what I'm already doing, but it's just
 a bit clunky at the moment.

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: mimic erlang in core.async

2014-01-28 Thread t x
Found something I don't like about it. :-)

https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj#L470

as mentioned at

https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj#L470

creates an unbounded queue.


Is there anyway around this, or does:

  * design specs of core.async, requiring all ! and ! to be in
lexical scope of go block, essentially imply this?

Thanks!

On Tue, Jan 28, 2014 at 3:59 PM, john walker john.lou.wal...@gmail.com wrote:
 No problem, I'm glad you also think it is cool :)


 On Tuesday, January 28, 2014 6:54:22 PM UTC-5, t x wrote:

 Hi John,

   This is great. I really like minimal examples to hack on / play with.

 Thanks!

 On Tue, Jan 28, 2014 at 3:46 PM, john walker john.lo...@gmail.com wrote:
  This doesn't answer your question, but you might find it interesting if
  you
  search for actors on it:
 
 
  https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj
 
 
  On Tuesday, January 28, 2014 6:43:19 PM UTC-5, t x wrote:
 
  Hi,
 
With apologies for a vague question:
 
Is there a library built on top of core.async that tries to mimic
  erlang-like processes?
 
The main features I'm looking for are:
 
* each channel has a single go-thread attached to it
 
* ! sends messages of the form
{:tag :message
 :return-channel ;; input channel associated with the go-thread
  we're running in
 :message ... actual message }
 
I find that this is basically what I'm already doing, but it's just
  a bit clunky at the moment.
 
  Thanks!
 
  --
  --
  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
  ---
  You received this message because you are subscribed to the Google
  Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to clojure+u...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 --
 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.edn/read-string exceptions = nil

2014-01-26 Thread t x
I recently ran into this problem again.

The solution I came up with is:

(defn filter-printable [obj]
  (cond
   (or (symbol? obj) (number? obj) (string? obj) (keyword? obj)) obj
   (vector? obj) (apply vector (map filter-printable obj))
   (seq? obj) (map filter-printable obj)
   (set? obj) (into #{} (map filter-printable obj))
   (map? obj) (into {} (for [[k v] obj]
 [(filter-printable v) (filter-printable v)]))
   true [:un-readable (pr-str obj)]))

## example:

(filter-printable
 {:k 20
  :f 'abc
  :d '(+ 1 2 3 foo)
  :other (async/chan 10)})


Anyone have a better / more elegant solution?




On Thu, Jan 16, 2014 at 10:17 AM, t x txrev...@gmail.com wrote:

 After looking at edn/read-string and realizing I would have to modify Java
 code, I have decided that modifying the sender in clojure land isn't so bad
 after all.


 On Thu, Jan 16, 2014 at 9:41 AM, Alex Miller a...@puredanger.com wrote:

 I think I would change the sender to elide whatever parts you don't want
 to send rather than mess with the receiver.


 On Thursday, January 16, 2014 2:11:02 AM UTC-6, t x wrote:

 Hi,

   Right now if I do (clojure.edn/read-string ...) on a string with a
 unreadable part, I get an exception. Instead, I would like to just get nil.
 For example:


 ## code

 (clojure.edn/read-string
  (pr-str
   {:tag :message
:chan (async/chan 10)}))

 ## currently returns

 java.lang.RuntimeException: Unreadable form
  at clojure.lang.Util.runtimeException (Util.java:219)


 ## instead, I would like:

 {:tag :message
  :chan :nil}


 Is there a way to make this happen?

 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 unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


async/close! called when channel is gc-ed ?

2014-01-26 Thread t x
## Context:

  I'm doing some communication across cljs/clj with core.async

## Problem:

  I want a certain function called whenever:
  (a) the first time the channel is closed
  (b) when the channel is gc-ed (if not previously closed)

  (a) is rather easy: I define my own channel, wrapped around
ManyToManyChannel, and define my own
https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/protocols.clj#L22

  (b) I have no idea how to do -- is there someway to register some
function that gets called when a channel is gc-ed ? (perferably in both
cljs + clj -- although, if it just works in cljs, it suffices)

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


  1   2   >