Lisp/Scheme for HTML scripting

Why is there no


and how do we make one?

Attached: large-cover.png (700x900, 172K)

Other urls found in this thread:

scsh.net
gitlab.com/ryukoposting/weblisp
languagelog.ldc.upenn.edu/myl/llog/jmc.pdf
biwascheme.org/
github.com/manuel/wat-js
iolanguage.org/
wordsandbuttons.online/learn_you_a_lisp_in_0_minutes.html
7chan.org/pr/src/The_Little_Schemer_4th_2.pdf
stevelosh.com/blog/2018/08/a-road-to-common-lisp/
en.wikipedia.org/wiki/SXML
twitter.com/SFWRedditVideos

Because then every browser would need to implement a hundred scripting languages to account for everyone's preference.

You can use whatever language you want server-side, though.

scsh.net

because the web is beyond saving at this point, JS isn't going anywhere.

Easier to make a compile-to-js language than to require every browser to implement a new language.

I had the idea of making a web extension or similar that packaged a WASM binary that interpreted programming languages embedded into sites with other types, and ran the code there.
So someone could compile the LISP VM into WASM, expose some DOM API to it, and then feed LISP into it from a web page.

Of course, you could always try pulling out the guts of an already established browser engine like Gecko or Blink and cramming any arbitrary VM alongside it. It'll be much more performant than using the above idea, because you still have to go through Javascript, but less people are likely to use it.

Actually, why don't we just use Lisp/Scheme in place of HTML entirely?

Imagine:
>(img (src (append protocol base-domain "image1.jpg")))

Plus if you gave users the ability to override what any function does you the customizability would be insane.

Lisp is too hard for me to learn

weblisp is the future, user. the author accepts PRs. gitlab.com/ryukoposting/weblisp

Lisp isn't hard. It's just very non-linear.

languagelog.ldc.upenn.edu/myl/llog/jmc.pdf

This is pretty much the very core of common lisp, and also works on emacs lisp. It's not all of the language, there is a little more to learn. But all of it revolves around what is being said in these 13 pages.

Someone is already working on it. Look a weblisp.
;; todo.wl
(body
(p "hello, " (env "USER"))

(b "TODO:")
(ul
(li (st "argument parser"))
(li "CSS expressions")
(li "JSON expressions")
(li "file import")
(li "CGI string parser + CGI expression")
(li (st "if statement"))
(li "case statement?")
(li "moar tests")
(li "build cmd")
(li "def expression/variable storage"))
(img "pbs.twimg.com/media/CUNZWTTUcAAicyv.png"
(width 100)))

Heh, this user beat me to it.

I can do this in Haskell.
And I have a ton of options to do it with

I think I'm too dumb for programming in general

Learn Python on Treehouse and tackle some projects. If you can't do it then maybe yes your iq may be to small for programming, but why wouldn't you try if it draws your attention?

Sexy

I just wish it could all be native instead of having to compile down to html, css, and javascript first.

biwascheme.org/

I tried python I couldn't. I don't think I have low iq though

Apply yourself...

If you can't learn Python, it's time for you to find a new hobby.

There's nothing else.
It's not fair

Probably because you're "trying to learn". That doesn't work for everyone. Some people need to just stop trying to learn and just make something.
And I don't mean pick some random thing and try to make it as a way to learn. I mean figure out some program/script that you _need_ or that you actually _want_ to have. Then make it, fuck around with variables and functions and when it doesn't work search the web for why it doesn't work.

So who wants to create a new Scheme powered internet with me?

We'll build browsers that run on Scheme and interpret Scheme instead of HTML.
We can also build some basic websites, maybe even an imageboard on a server powered by Scheme which returns pages formatted in Scheme that can be run by our Scheme browsers.

Anyone?

Your offer is tempting... Although, there is only one language that could be used here and it's not Scheme.

Attached: holyc.png (544x260, 9K)

There's a language that's smaller, more powerful, and more consistent than Scheme which can be embedded in JS.
github.com/manuel/wat-js
The author doesn't make a big deal of it, but its first-class fexprs are strictly more powerful than Scheme's combination of functions and macros.
A function evaluates its operands (what's passed to it) in its dynamic environment (the function's call site) to produce arguments, which are then bound within the lexical environment (the variables within the function's defintion) and manipulated to produce an output.
Macros expand code at compile time without evaluating it. They map one syntactic form to another without destroying the structure.
Fexprs are like functions, but they do not evaluate their operands; they receive the unevaluated operands at runtime along with both the static and dynamic environments, in which variables can be selectively evaluated (or not at all). As such, they can be functions, macros, and more.

Having first-class fexprs, wat.js doesn't have Scheme's problems with macro hygiene (have you seen the mess required to fix it behind the scenes?), no special forms (everything can be passed to everything else, no built-in rules in eval), etc. Moreover, it maps directly onto JSON - it can be integrated into the existing ecosystem.

Another language with fexpr magic is Io.
iolanguage.org/
It's also easier for newbies to read than Lisp.

For a clean start away from webshit with an existing ecosystem, the Squeak VM is only a few megabytes - smaller than most webpages - and could be reimplemented in wasm.
Read this:
wordsandbuttons.online/learn_you_a_lisp_in_0_minutes.html
Now download DrRacket, set the language to R5RS, and read The Little Schemer.
7chan.org/pr/src/The_Little_Schemer_4th_2.pdf
After that, learn Emacs and follow Steve Losh's Road To Common Lisp.
stevelosh.com/blog/2018/08/a-road-to-common-lisp/

>all of these people that don't know about mithriljs

>implying that a generic FoTM JS framework is superior to the eternal beauty and power of Lisp
Not sure if bait or dumb webdev.

It's a several years old functional js framework you braindead monkey.

I'm comfortable with JavaScript via some interactive web projects that I wanted to make and I'm reasonably decent with Ruby for *nix scripts. I suck at Python though. Maybe because I haven't found an interesting project to implement with it or something. Either way, don't think that just because you suck at Python that you suck at programming. Find something fun to do with a language via a project and you'll start to get it.

What if there's nothing I want to make

Dumb webdev it is.
>It's a several years old functional js framework
It's several years old? It's functional?! Oh my god!
[spoiler]if that's all you have to say for it, looks like I was right[/spoiler]
Read SICP. Come back when you've had your Lisp enlightenment.
Make yourself a few games and see if you like it. I'm going to recommend DrRacket again, but get the book "Realm Of Racket". You'll make a series of small games in Racket (a Scheme dialect) piece by piece. Just get going and it'll be fun.
Also, take a look at the "Learn You A Lisp In 0 Minutes" link in Lisp is easy.

Attached: read-your-SICP.jpg (202x250, 9K)

Build a time machine, go back to the 90s, and start breaking kneecaps at Netscape until they let Brendan Eich integrate Scheme instead of creating JavaScript.

I'm allergic to assholes sorry

>languagelog.ldc.upenn.edu/myl/llog/jmc.pdf
great paper, foken saved

Because functional programming his a waste of time

XML -> S-exp is pretty painful because XML sometimes is and sometimes isn't whitespace aware. While this could work with unbinded symbols, string quoted strings might be necessary.
There are also bazillion versions for how to deal with attributes and nested tags.

But the advantage is obvious: where XML gets clunky and too big, the Lisp macro can clear it drastically.
But now you have a turing complete markup language. (or does just macro expansion make it turing complete? idk, maybe not. that would be a big argument)
But it's ok because CSS3+HTML5 are already turing complete.

SXML looks pretty ok way to deal with tags
en.wikipedia.org/wiki/SXML

Text node

(tag (@ (attr1 "value1")
(attr2 "value2"))
(nested "Text node")
(empty))

I don't think it would be considered Turing complete. Lisp is, but not the s-exprs used to encode it, in the same way that XML is not Turing complete but XSLT is.