We're not there yet, but this would be LavaScript's [1] entry into the Arc Challenge [2], once the language gets sufficiently developed: ($ (fn ()
(.html ($ 'body)
(+ (<input>)
(<button> "submit")))
(.click ($ 'button) (fn ()
(= said (.val ($ 'input)))
(.html ($ 'body)
(<a> href '#))
(.click ($ 'a) (fn ()
(.html ($ 'body)
(+ "you said: " said))))))))
And the JavaScript output would be: $(function() {
$('body').html(
'<input></input>' +
'<button>submit</button>');
$('button').click(function() {
said = $('input').val();
$('body').html(
'<a href="#">click here</a>');
$('a').click(function() {
$('body').html("you said: " + said);
});
});
});
It depends on jQuery and a hypothetical HTML library that can generate strings like '<tag attr1="val1">body</tag>' from calls like (<tag> attr1 'val1 "body").--- [1] https://github.com/evanrmurphy/lava-script [2] http://arclanguage.org/item?id=722 |