Fork me on GitHub

I'm still just getting started, experimenting with tweaks to the Get Started project ( I want to add a text area to the web page, into which the user can type, and then grab that text in the function called when a button is pressed. I had thought from the name that an input cell would do that... but not the one used in the example... Is there a simple example of this in one of the demos, or can someone give me code or a pointer to help me do this?


@lspector: check out the todo list example on


it demonstrates the idiom of using an input cell in a closure


(last code example)


hm, with a textarea it's a little tricker, since textareas don't have a value attribute. their value is stored as a child text node


@alandipert: Thanks. I think I could figure out how to adapt the todo example.... although the limitation to single line input would be pretty rough. Any pointers on how to circumvent this? FWIW the example that would solve all of my problems in one fell swoop (and help many others?) would have an input text area, a "process" button, and an output text area. The default function behind the process button could just put in the output area some simple transformation of the input, like the input up-cased or reversed. With this, folks like me who want to provide some (more interesting) input->output function, which we can write in Clojurescript, on the web, without knowing anything about web programming or Javascript, would be in business instantly.


sure, i can cook up an example quickly


@alandipert: For even more generality/utility, it'd be great if the output area could be written to incrementally, in case the "process" function takes a long time to run and you want to provide status messages along the way.


@lspector: for that kinda thing i think you maybe want a separate status cell


the example i sent you runs process whenever the value of input changes


but if process takes a long time, you might want to use a watch instead... and leave cell world


the idea with javelin is that most UI updates are not cpu-heavy, just hard to orchestrate and do consistently


but you don't necessarily want to use them to do all kinds of processing


instead using them to build interfaces in front of other (potentially cpu/io heavy) processing


so that your UI is coupled to what your app does only indirectly, through cells


does that make sense?


@alandipert: Woo hoo! And the separate status cell sounds right too. I can't try this right now (in a workshop...) but will as soon as I get a chance.


@alandipert: I'm not sure that I do fully understand your comment about the concepts behind javelin and UI updates, but my "process" function will indeed almost always be CPU heavy (in a big way, sometimes).


have you ever done Swing stuff in java?


in like desktop UIs, one usually has at least 2 threads


1 to do the work, whatever it is


and 1 to do UI repaints


What I mostly do is AI research...


if you try to use just 1 thread, the UI thread can block processing and vice versa, which is not what anyone usually wants


the browser environment is single-threaded, so to do work without blocking one needs to program with callbacks, which get queued kind of the way threads get scheduled


tl;dr it's not good to put functions that could block for a long time in formula cells, since that will block updates for any dependent UI bits


But in that one thread, could I occasionally spit out some status to the status cell and have it actually appear in the browser while I keep computing?


well, there aren't threads really in the browser


there is something call a webworker, which is a limited form of thread and kind of weird to work with


but yeah that's the basic idea


this is how we do e.g. polling a server in most cases


Hmm. What I want to do is conceptually like a single threaded program running in a terminal, which prints stuff out along the way while it does a long computation


and this computation is happening in the browser, not in the server?


for something compute-heavy that looks like Javelin you can look at - the Dataflow part


i gotta run, but feel free to post on discourse if you have other q's


Hmmm... from a quick look at pulsar I don't see how to get started with what I know, without learning a lot more. The lovely thing that attracted me to holon is the Get Started page that showed how to get a complete web page app up knowing only pure Clojure.


yeah, regrettably the browser isn't the best computing platform


I think I'm going to try to stick with hoplon, ignore the issue about blocking, etc., and see how far I get


Mainly just because it seems to me like it will be the easiest way, by far, to get something running in the users' browsers


@alandipert: re: "and this computation is happening in the browser, not in the server?" Yeah, that's the idea. But again, just because I'm not a web programmer and don't know what I'm doing 🙂. The particular program I want to do this with is something that people could run in their terminals... except that my audience is mathematicians, many who won't know how to install anything on their computers... so since it's in Clojure, and since Clojurescript exists, I thought it'd be easiest to put something up that lets them run it in their browsers... and hoplon looks like it will let me do this without learning much of anything about web programming, assuming that I can handle the issues raised here (maybe I already can -- I have to study and try the code you posted :-).