Mike,

Thanks so much! You set me on the right path and I'm starting to understand how 
the compilation process works.

I'm going to work on a few examples of how this can be used to get things done 
in GAS/Sheets and update the project page with instructions.

I'm loving Planck on Linux too! Thanks for all that you do.

V/r

John

On Wednesday, September 7, 2016 at 9:50:12 PM UTC-4, Mike Fikes wrote:
> Hi John,
> 
> 
> You’ll have to arrange in some way to create a namespace so that defs work. 
> While the cljs.user namespace is the default namespace when :ns is not 
> specified, it is not automatically created for you.
> 
> 
> Here is a way to do it directly in the script:
> 
> 
> 
> function evalstr() {
>   clgs.core.evalCljs("(ns cljs.user)");
>   var s = "(def x 3)";
>   var res = clgs.core.evalCljs(s);
>   Logger.log("output: " + res);
>     var s = "(+ x 2)";
>   var res = clgs.core.evalCljs(s);
>   Logger.log("output: " + res);
>   return res;
>   
>   // In the menu above, click "Run" -> "evalstr"
>   //   Then click "View" -> "Log"
>   
> }
> 
> 
> 
> [16-09-07 18:39:26:408 PDT] cljs in: (ns cljs.user)
> [16-09-07 18:39:26:539 PDT] cljs out: {:value nil}
> [16-09-07 18:39:26:540 PDT] cljs in: (def x 3)
> [16-09-07 18:39:26:672 PDT] cljs out: {:value 3}
> [16-09-07 18:39:26:673 PDT] output: 3
> [16-09-07 18:39:26:674 PDT] cljs in: (+ x 2)
> [16-09-07 18:39:26:767 PDT] cljs out: {:value 5}
> [16-09-07 18:39:26:769 PDT] output: 5
> 
> 
> 
> 
> If you are curious, Planck sets up cljs.user here 
> https://github.com/mfikes/planck/blob/a4ffedda17da086581b40a48f87c66e1a36a6453/planck/PLKClojureScriptEngine.m#L1318-L1321
> 
> 
> And Replumb accomplishes the same in a different way here:
> https://github.com/Lambda-X/replumb/blob/d29caa57d336ea023e00319faedef47a4736141a/src/cljs/replumb/common.cljs#L125-L128
> 
> 
> This topic has been discussed previously: 
> https://groups.google.com/d/msg/clojurescript/j0CoBSK4nXg/gtNI_pDvBQAJ
> 
> 
> - Mike
> 
> 
> 
> On Sep 7, 2016, at 6:14 PM, John Newman <[email protected]> wrote:
> 
> 
> Hello all,
> 
> I am trying to get self-hosted CLJS running on Google's Apps Script servers.
> 
> I thought I would just try it out and was surprised to find that some simple 
> expressions just worked, like (take 4 (range 10)). However, def'ing does not 
> yet work.
> 
> Does anyone have any pointers on how to debug this? Perhaps collection 
> containing the current ns's vars is not accessible? If so, would I even be 
> able to run any expressions?
> 
> I will say, being able to run CLJS expressions as Google Sheets formulas is 
> pretty neat. And being able to automate the rest of the Google Apps Script 
> ecosystem with CLJS would be a blessing.
> 
> The Github project is here: https://github.com/johnmn3/clgs
> 
> The GAS script is here: 
> https://script.google.com/d/1vUqjhUd21PD84gXqgOUy9tpx-kpvLRn2kZh-2y9DpwTrf-JTwh2F0xp1/edit?usp=sharing
> 
> Let me know if you have any problems and thanks!
> 
> V/r
> 
> John
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to