A ClojureScript Tutorial For Light Table Users

436 views
Skip to first unread message

David Nolen

unread,
Jan 15, 2014, 8:44:06 AM1/15/14
to light-table...@googlegroups.com, clojure, clojur...@googlegroups.com
I've started what I hope will be a collaborative and comprehensive reference on the ClojureScript language for people looking to extend Light Table. This is a file that can be directly evaluated in the Light Table UI Connection. http://swannodette.github.io/2014/01/15/clojurescript-for-light-table-users/

I hope it inspires people to put together similar interactive guides on Light Table specific functionality.

David

Mark

unread,
Jan 15, 2014, 7:54:31 PM1/15/14
to clo...@googlegroups.com, light-table...@googlegroups.com, clojur...@googlegroups.com
The concept seems cool but I can't figure out the mechanics. What are the magic keystrokes to directly evaluate in the Light Table UI Connection?

David Nolen

unread,
Jan 15, 2014, 8:34:58 PM1/15/14
to light-table...@googlegroups.com, clojure, clojur...@googlegroups.com
Control-SPACE to open the command pane. Type "Add Connection" and select it. Choose Light Table UI. You should now be able to evaluate forms in the tutorial.


--
You received this message because you are subscribed to the Google Groups "Light Table Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to light-table-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mark

unread,
Jan 15, 2014, 10:22:00 PM1/15/14
to clo...@googlegroups.com, light-table...@googlegroups.com, clojur...@googlegroups.com
Ok, thanks.  I was thinking of something a bit different:  connecting directly to the URL 
To unsubscribe from this group and stop receiving emails from it, send an email to light-table-discussion+unsub...@googlegroups.com.

Mimmo Cosenza

unread,
Jan 16, 2014, 8:58:34 AM1/16/14
to clojur...@googlegroups.com, light-table...@googlegroups.com, clojure
Great initiative David!!

It seems the fastest path to learn ClojureScript by minimising  any incidental complexities generated by tools.

mimmo

  
--
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 clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

signature.asc

Gary Johnson

unread,
Jan 16, 2014, 12:24:03 PM1/16/14
to clo...@googlegroups.com, light-table...@googlegroups.com, clojur...@googlegroups.com
Great job, David. Looking very sharp!

  ~Gary

Gregg Ramsey

unread,
May 20, 2014, 4:44:55 AM5/20/14
to clojur...@googlegroups.com, light-table...@googlegroups.com, clojure
Hi David,

This has been very helpful in understanding the internals of the ClojureScript compiler and I found it fascinating. Much appreciated.

I am having a bit of trouble understanding the syntax of the user environment map. Is there documentation for this? My goal is to specify multiple requires and multiple locals.

You have defined it as:

(def user-env '{:ns {:name cljs.user} :locals {}})

I have your code running happily in Light Table and I have pasted the following code at the end:

(let [form (read1 "(fn [a b] (+ a b x handler/y hand/z))")]
(with-out-str (c/emit (ana/analyze user-env form))))

This evaluates to:

"(function (a,b){return ((((a + b) + cljs.user.x) + handler.y) + hand.z);\r\n});\r\n"

Now, I want to find a way of altering the environment to something like:

(def user-env '{:ns {:name cljs.user :require [[compojure.handler :as hand]]} :locals {:name x}})

I am only showing one require and one local in this example but the result I would be hoping for is:

"(function (a,b){return ((((a + b) + x) + handler.y) + compojure.handler.z);\r\n});\r\n"

Notice that because handler/y would just compile to handler.y since there is no specific info on what to do in the environment.

When I evaluate using my environment, the JavaScript doesn't change, so what am I doing wrong? Is what I want even possible?

Many thanks,

Gregg.
Reply all
Reply to author
Forward
0 new messages