Re:Show HN: ClojureScript REPL within Excel
by mfikes on Sunday November 15, 2015 @10:33AM
(#10569839)
This reminds me of one of the points pg makes in What Made Lisp Different [1], under #9:
"compiling at runtime is the basis of Lisp's use as an extension language in programs like Emacs"
This Excel capability is an extremely cool demonstration of where ClojureScript's self-hosting capability can take us. Seems like there's no stopping it. Kudos to Christian Felde!
Re:Show HN: ClojureScript REPL within Excel
by ghufran_syed on Sunday November 15, 2015 @11:09AM
(#10569963)
I love the idea of this, but then started to wonder what this would let me do. Can I take data from an arbitrary set of input cells, pass them through a sequence of clojurescript functions, then output the result(s) back to the spreadsheet?
Re:Show HN: ClojureScript REPL within Excel
by WBrentWilliams on Sunday November 15, 2015 @12:16PM
(#10570203)
I would hope that would be the ultimate goal. However, that might not be possible without at least some VBA work. Experimentation will have to be undertaken.
The real question is how do you sell the ClojureScript "macro" to an end user that, ultimately, doesn't care how the answer in the spreadsheet is arrived at, so long as it is correct.
Re:Show HN: ClojureScript REPL within Excel
by moonchrome on Sunday November 15, 2015 @03:05PM
(#10570941)
why use continuation functions (... println) instead of returning values ? Is it because of the underlying JS API is async ? Maybe use something like chans to pipe async values ? Just doesn't seem clojureish to me :D
Re:Show HN: ClojureScript REPL within Excel
by moomin on Sunday November 15, 2015 @03:44PM
(#10571101)
Author of cljs-ajax here, I'd always favour a straight callback. The async stuff is so easy to add on top it doesn't really seem worth it to add the dependency to the library and complicate matters for people that don't want it.
Re:Show HN: ClojureScript REPL within Excel
by moonchrome on Sunday November 15, 2015 @03:52PM
(#10571139)
I guess that's true - core.async adds a lot of stuff you don't want for something as simple as futures/promises.
I wish ClojureScript guys would abstract 'go' macro from core.async in to the clojurescript core, provide well documented protocols that it uses and include implementation for JS Promises by default (then leave core.async to expose chans for those who need channels trough those protocols).
Hell if I knew they wouldn't be against doing this I might even do it my self in a few weeks.
Considering the async nature of JS it makes sense to provide such a construct as a part of language/standard library.
[1] http://www.paulgraham.com/diff.html
The real question is how do you sell the ClojureScript "macro" to an end user that, ultimately, doesn't care how the answer in the spreadsheet is arrived at, so long as it is correct.
You can bind to arbitrary data regions using named items. For example:
cljs.user=> (add-binding-named-item "A1:B2" "binding-id" println)
nil
{:rc 2, :cc 2, :type matrix, :id binding-id}
cljs.user=> (get-binding-data "binding-id" println)
nil
{:rc 2, :cc 2, :type matrix, :id binding-id, :data [[1 2] [3 4]]}
cljs.user=> (set-binding-data! "binding-id" [[2 3] [4 5]])
I wish ClojureScript guys would abstract 'go' macro from core.async in to the clojurescript core, provide well documented protocols that it uses and include implementation for JS Promises by default (then leave core.async to expose chans for those who need channels trough those protocols).
Hell if I knew they wouldn't be against doing this I might even do it my self in a few weeks.
Considering the async nature of JS it makes sense to provide such a construct as a part of language/standard library.
I wouldn't mind adding a blocking variant of these functions, and use async internally to make that happen. But, not there yet.