Do we have a browser connected REPL ?

53 views
Skip to first unread message

Pranav Bhaskar

unread,
Jun 26, 2021, 4:53:52 PMJun 26
to BiwaScheme
Hi, 
I am a beginner in scheme and lisp languages in general. I've been learning clojure/script for about 6 months. 
I just learned about biwascheme today and am fascinated by it. 
I was building a tic-tac-toe game and loved working in my emacs, having an `npx biwascheme` repl open in a buffer and sending and evaluating expressions as i code. 
Now when i am thinking about building views for this app. I was wondering if there is a way i can have a repl connected with the browser like they have in clojurescript. so that i can evaluate browser specific functions like (alert "") etc., from my emacs buffer.

Thanks 

Thomas Elam

unread,
Jun 27, 2021, 7:21:57 AMJun 27
to biwas...@googlegroups.com
I’d be very interested in that, too!

You should also be aware of Gambit Scheme. They have a very active group on the messaging platform. Gambit can be built to target JavaScript and can run in the browser. You could ask Prof. Marc Feeley about connecting Emacs to Gambit in the browser.

BiwaScheme loads very fast in the browser because it is so small, but with enough optimisation Gambit Scheme can be about 640kB of JavaScript.

--
You received this message because you are subscribed to the Google Groups "BiwaScheme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biwascheme+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/biwascheme/6e02760d-ea75-4268-902b-8562ad6ed7ecn%40googlegroups.com.
--
Tom

ArooBaito Art

unread,
Jul 28, 2021, 3:39:16 AM (2 days ago) Jul 28
to BiwaScheme
I think this would be a pretty easy project to do using websockets. The design of BiwaScheme makes it very easy to drop a repl in anywhere, I've done it for several node/electron and browser projects, so I haven't bothered to set up a full connection to the browser and emacs like Cider, but I'll put it on my list of things to do and I'll post a git repo. 

The reason I prefer BiwaScheme over Gambit is because Gambit creates one of those long ugly obfuscated js files like ClojureScript does, while BiwaScheme lets you host the actual SCM files since they're meant to be interpreted in real-time. 

In any case I'll post one up as soon as I'm done participating in this Lisp game jam. BiwaScheme works amazing with the 3D webGL libraries, I really can't say enough positive things about it! 

It can literally go anywhere javascript can! I modified my Discord client to have a BiwaScheme repl built into it using BiwaScheme itself, and I also coded a box that automatically pulls Scheme programming Tweets from Twitter. The sky is the limit with this labguage I tell you! 

unknown-9.png

Thomas Elam

unread,
Jul 29, 2021, 6:13:36 AM (yesterday) Jul 29
to biwas...@googlegroups.com
Aroo, I'm very interested in your work. Please keep us posted here.

On Wed, Jul 28, 2021 at 1:09 PM ArooBaito Art <arooba...@gmail.com> wrote:
I think this would be a pretty easy project to do using websockets. The design of BiwaScheme makes it very easy to drop a repl in anywhere, I've done it for several node/electron and browser projects, so I haven't bothered to set up a full connection to the browser and emacs like Cider, but I'll put it on my list of things to do and I'll post a git repo. 

The reason I prefer BiwaScheme over Gambit is because Gambit creates one of those long ugly obfuscated js files like ClojureScript does, while BiwaScheme lets you host the actual SCM files since they're meant to be interpreted in real-time. 

I've been wondering how (load "a-scheme-file.scm") would work with Gambit on JavaScript. I'll be looking into that, but maybe not anytime soon.
 

In any case I'll post one up as soon as I'm done participating in this Lisp game jam. BiwaScheme works amazing with the 3D webGL libraries, I really can't say enough positive things about it! 

Would you mind to post any particular pointers to online examples?
 

ArooBaito Art

unread,
Jul 29, 2021, 4:55:27 PM (yesterday) Jul 29
to biwas...@googlegroups.com
Thank you, I appreciate it!

Yes, I can think of a way for Gambit to load SCMs in real-time too if you had a NodeJS server running to execute the compiler and relay the compiled javascript back to the browser. I still think Gambit is a fantastic and very flexible Scheme, of course, since it's the "go anywhere" Scheme with its elaborate inter-op, but I prefer BiwaScheme and Gauche personally. They're easily my top 2. I usually host my static files with a Gauche Makiki server while I'm developing my 3D web apps, mostly out of habit since since BiwaScheme can do that just fine as well. Or I think Node itself even has a simple one-off "serve this folder" command somewhere.

As for examples, most of my own have a bunch of macros that may only be conducive to my own use, so I'll just code up a simple framework real fast and post it up here and on github!
I'll send it out when I get a chance later today. Here are a couple more examples of my work with BiwaScheme though:

My current big project is a re-creation of the Nintendo game Splatoon using the PlayCanvas webGL engine and the YUKA AI library, and maybe eventually SocketIO and Simple-Peer if I want to make it multiplayer. I'm extremely familiar with all 4 of these libraries, I highly recommend them. In any case, I call it LispLatoon since all the interfacing code and game logic (everything that's mine instead of the framework) is 100% in BiwaScheme:





Also, I used to work as a 3D artist in college! I sculpted all of the assets and created all the textures in Blender. You can also see in the bottom picture there's a developer's console you can open that will interpret any BiwaScheme you type into it. Like I said, it's ridiculously easy to shove BiwaScheme interpreters everywhere hahaha

And here's another example of my modified Discord client:



Here you can see that with Yutaka Hara's convenient RESTful macros your Scheme code has direct access to all kinds of services, like Discord's webhook bots. I also updated my ui elements to be draggable and resizable yesterday instead of hiding them with a hotkey like I was before, all in BiwaScheme.

It goes without saying that JavaScript has a ton of utility libraries that do really cool things, and with BiwaScheme you get access to all of those and the awesome power of macros and list processing that comes with Lisp. I've been using it for years and I still can't help but nerd out about it hahaha

I'm a pretty big fan. I only recently started joining Lisp communities though, I never knew BiwaScheme had a mailing list! In any case, my hat is off to Hara for the incredible implementation.
I'll post up that 3D framework in a bit!

ArooBaito Art

unread,
Jul 29, 2021, 11:54:40 PM (20 hours ago) Jul 29
to BiwaScheme
Alright, it's all set!


And you can also find it hosted live and running here:

https://aroobaito.itch.io/biwascheme-playcanvas-example

Let me know if you have any questions!

Thomas Elam

unread,
3:22 PM (5 hours ago) 3:22 PM
to biwas...@googlegroups.com
Aroo, thanks a lot for the update! That's awesome tech! You have left me breathless!

Yes, Hara's work is really awesome, too. Perhaps I should double down on my study of it. I had a concern that conditions might not be handled completely. If I can, I will post an example. I think I saw a case where an error like divide by zero threw the interpreter into a global error handler. In my case it left a JavaScript handler enabled, when it was not supposed to be enabled. Or something like that. Sorry, I can't remember for sure. 😶

Tom


Thomas Elam

unread,
3:22 PM (5 hours ago) 3:22 PM
to biwas...@googlegroups.com
I'll take a look after a few hours. Thanks for sharing! 😀
Tom


ArooBaito Art

unread,
3:51 PM (4 hours ago) 3:51 PM
to biwas...@googlegroups.com
Oh that is unfortunate! I can't say I've run into any problems that weren't my fault yet hahaha

And you're welcome! I left in the quality of life JS from the PlayCanvas team which includes a simple loading screen, but I have actually translated start.js, loading.js, and modules.js to scms for my own project.

It works fine, but I wouldn't recommend it unless you're just dying that the entire project aside from playcanvas.min.js and biwascheme.js are in javascript, because otherwise it's just pointless busy work hahaha

Really that's what .gitattributes *.js linguist-detectable=false is for. You don't have to re-write boilerplate and your git project still goes under the Scheme language section!

Anyway, I appreciate the compliments, and let me know if you need anything else! I'll post up my own version of Clojure's Cider with Emacs + BiwaScheme when I get around to it sometime next week!

Reply all
Reply to author
Forward
0 new messages