WEBVTT captioned by sachac 00:00:01.060 --> 00:00:05.639 Hi, EmacsConf 2025. My name is Ramin Honary, 00:00:05.640 --> 00:00:07.559 and I'd like to talk to you today 00:00:07.560 --> 00:00:10.399 about my project called Schemacs 00:00:10.400 --> 00:00:12.079 which I presented last year. 00:00:12.080 --> 00:00:13.879 Back then it was called "Gypsum" 00:00:13.880 --> 00:00:18.319 and the name has since changed. 00:00:18.320 --> 00:00:20.239 So my name is Ramin Honary. 00:00:20.240 --> 00:00:24.999 I'm an Emacs enthusiast, have been since 2017 or so. 00:00:25.000 --> 00:00:27.759 I'm a full stack software developer. 00:00:27.760 --> 00:00:29.300 I love Haskell, Scheme, 00:00:29.301 --> 00:00:31.433 anything functional programming related, 00:00:31.434 --> 00:00:32.959 and of course Emacs. 00:00:32.960 --> 00:00:36.199 I started learning Scheme about three years ago, 00:00:36.200 --> 00:00:37.999 and this is my third time presenting 00:00:38.000 --> 00:00:40.799 at EmacsConf. 00:00:40.800 --> 00:00:46.479 So the Schemacs project that I'm talking to, 00:00:46.480 --> 00:00:48.159 I'm talking about to you today, 00:00:48.160 --> 00:00:50.279 was originally called "Gypsum". 00:00:50.280 --> 00:00:53.359 The reason I did not call it "Schemacs" 00:00:53.360 --> 00:00:58.119 was that the name "Schemacs" was taken on GitHub. 00:00:58.120 --> 00:00:59.567 But in the past year, 00:00:59.568 --> 00:01:02.119 I was able to get the permission 00:01:02.120 --> 00:01:04.479 of the author of GitHub's Schemacs 00:01:04.480 --> 00:01:08.840 project to name my project the same thing, 00:01:08.841 --> 00:01:11.320 even though it's a very similar project. 00:01:11.321 --> 00:01:14.719 So I changed the name. 00:01:14.720 --> 00:01:19.700 Let me see if I can quickly show the screen. 00:01:19.701 --> 00:01:24.959 So yeah, I have archived the old project. 00:01:24.960 --> 00:01:27.719 It's still there, but there's an explanation in 00:01:27.720 --> 00:01:30.167 the readme file and a screen grab 00:01:30.168 --> 00:01:31.599 of the conversation I had 00:01:31.600 --> 00:01:36.119 with the original author of GitHub Schemacs. 00:01:36.120 --> 00:01:38.679 My Schemacs is not on GitHub at all. 00:01:38.680 --> 00:01:43.879 It's only on Codeberg. So please don't get confused. 00:01:43.880 --> 00:01:45.999 But yes, I received permission 00:01:46.000 --> 00:01:50.199 to change the name and so I did. 00:01:50.200 --> 00:01:52.839 And I would like to give a quick shout-out to 00:01:52.840 --> 00:01:57.239 user "Tusharhero" for helping me with that. 00:01:57.240 --> 00:02:02.639 This person really helped make that name change happen. 00:02:02.640 --> 00:02:07.199 So back to the slides. NOTE The scope of the project 00:02:07.200 --> 00:02:11.319 And so now I'd like to clarify the scope of the project. 00:02:11.320 --> 00:02:13.000 I don't think I quite made it clear 00:02:13.001 --> 00:02:14.919 well enough last year, 00:02:14.920 --> 00:02:18.400 but... Although I'm definitely cloning 00:02:18.401 --> 00:02:20.167 the Emacs Lisp programming language, 00:02:20.168 --> 00:02:25.267 the actual scope of the Schemacs project 00:02:25.268 --> 00:02:29.759 is to make an Emacs-like app platform for Scheme. 00:02:29.760 --> 00:02:32.959 I don't consider Emacs to be a text editor. 00:02:32.960 --> 00:02:38.199 I consider Emacs to be a Lisp app platform. 00:02:38.200 --> 00:02:39.839 So it's similar to something like the 00:02:39.840 --> 00:02:48.539 World Wide Web, or Microsoft's .NET app platform, or Java. 00:02:48.540 --> 00:02:52.559 These are all examples of app platforms. 00:02:52.560 --> 00:02:55.119 I would like Schemacs to make it easy 00:02:55.120 --> 00:02:59.399 for not only people to use it for 00:02:59.400 --> 00:03:03.479 things like editing text or, you know, for 00:03:03.480 --> 00:03:06.439 using your computer through a command line 00:03:06.440 --> 00:03:10.599 or manipulating your Git repository. 00:03:10.600 --> 00:03:13.159 I'd also like you to be able to create simple 00:03:13.160 --> 00:03:16.119 GUIs or TUIs using Scheme. 00:03:16.120 --> 00:03:19.319 So that's also one of the goals of this project. 00:03:19.320 --> 00:03:23.079 It will of course have an Emacs-like text editor, 00:03:23.080 --> 00:03:24.999 and I will clone Emacs Lisp. 00:03:25.000 --> 00:03:29.879 So hopefully GNU Emacs users 00:03:29.880 --> 00:03:32.779 will feel comfortable moving over to Schemacs 00:03:32.780 --> 00:03:35.679 because they'll be able to use your init. 00:03:35.680 --> 00:03:40.399 You'll be able to use your init.el file. 00:03:40.400 --> 00:03:43.239 So configuring and scripting Schemacs 00:03:43.240 --> 00:03:44.479 should be done in Scheme. 00:03:44.480 --> 00:03:47.679 I'd like to encourage scripting in Scheme 00:03:47.680 --> 00:03:51.199 and creating new workflows and macros in Scheme. 00:03:51.200 --> 00:03:54.267 It will support Emacs Lisp depending on 00:03:54.268 --> 00:03:59.319 how much of the Emacs Lisp interpreter I can clone. 00:03:59.320 --> 00:04:03.039 That will be supported but not encouraged. 00:04:03.040 --> 00:04:06.319 But you should still be able to run your init.el. 00:04:06.320 --> 00:04:08.839 And I would like it to be good enough, 00:04:08.840 --> 00:04:09.999 this Emacs Lisp interpreter 00:04:10.000 --> 00:04:12.999 should be good enough to run packages from ELPA. 00:04:13.000 --> 00:04:15.879 Although it will probably be some time 00:04:15.880 --> 00:04:17.559 before it will be able to run 00:04:17.560 --> 00:04:24.759 something as large as Org Mode or Magit. NOTE Difference with Robin Templeton's project (Guile-Emacs) 00:04:24.760 --> 00:04:27.439 It is slightly different from the Guile-Emacs project. 00:04:27.440 --> 00:04:30.333 This is the work of Robin Templeton 00:04:30.334 --> 00:04:32.219 who presented last year. 00:04:32.220 --> 00:04:36.033 Guile-Emacs links the Guile runtime 00:04:36.034 --> 00:04:38.500 into the Emacs executable. 00:04:38.501 --> 00:04:41.580 It's not a Scheme application. Emacs, 00:04:41.581 --> 00:04:44.200 the core of Emacs is written in C. 00:04:44.201 --> 00:04:48.120 Guile, the core of Guile is written in C. 00:04:48.121 --> 00:04:53.700 What Robin Templeton has done is, at the C level, linked 00:04:53.701 --> 00:04:56.833 "libguile.so" into Emacs and then provided 00:04:56.834 --> 00:04:59.500 a programming layer where you can 00:04:59.501 --> 00:05:04.759 call the Scheme interpreter from Emacs Lisp 00:05:04.760 --> 00:05:11.279 so that you can run Scheme programs from within Emacs 00:05:11.280 --> 00:05:13.919 without having to launch a separate process 00:05:13.920 --> 00:05:18.039 and communicate over a channel such as a socket. 00:05:18.040 --> 00:05:19.839 You won't need "SLIME" or anything. 00:05:19.840 --> 00:05:23.419 The Guile interpreter is just right there inside of Emacs. 00:05:23.420 --> 00:05:25.999 But my project is not like this at all. 00:05:26.000 --> 00:05:28.879 Schemacs is written completely from the ground up 00:05:28.880 --> 00:05:34.999 in R7RS-compliant Scheme. And because it's R7RS-compliant, 00:05:35.000 --> 00:05:37.999 it's not bound to any one particular Scheme implementation, 00:05:38.000 --> 00:05:39.879 although Guile is the reference implementation. 00:05:39.880 --> 00:05:42.359 One goal of this project is to be able to run 00:05:42.360 --> 00:05:49.719 Schemacs on any R7RS-compliant Scheme implementation. NOTE Progress made since last year 00:05:49.720 --> 00:05:56.259 The work that I've done this past year mostly is internal. 00:05:56.260 --> 00:06:00.939 There's not much that you can see on the surface. 00:06:00.940 --> 00:06:04.519 But the most... One of the most important things that I 00:06:04.520 --> 00:06:06.839 did was I rewrote the parser in R7RS Scheme, 00:06:06.840 --> 00:06:07.919 so it no longer depends on 00:06:07.920 --> 00:06:11.999 the Guile regular expressions library. 00:06:12.000 --> 00:06:14.959 The parser now also provides source locations, 00:06:14.960 --> 00:06:18.939 so if an error occurs in Emacs Lisp, 00:06:18.940 --> 00:06:20.567 there will be a stack trace 00:06:20.568 --> 00:06:23.633 and it will show you where in the source code 00:06:23.634 --> 00:06:28.319 the error occured. This was not possible last year. 00:06:28.320 --> 00:06:30.860 And because it no longer depends on Guile, 00:06:30.861 --> 00:06:34.520 I can make it work on multiple Scheme implementations. 00:06:34.521 --> 00:06:36.820 So far, I've been able to get it to run on 00:06:36.821 --> 00:06:38.920 the Chibi Scheme interpreter 00:06:38.921 --> 00:06:41.280 and the Gauche Scheme interpreter, as well as 00:06:41.281 --> 00:06:44.279 Guile, which is the reference implementation. 00:06:44.280 --> 00:06:48.559 For a short time, it did work also on Chez Scheme, 00:06:48.560 --> 00:06:53.179 the Chez Scheme compiler, using Gwen Weinholt's "Akku," 00:06:53.180 --> 00:06:59.299 which is a program that translates R7RS Scheme to R6RS Scheme. 00:06:59.300 --> 00:07:04.519 And with that translation, because Chez Scheme 00:07:04.520 --> 00:07:07.319 is pretty strictly an R6RS compiler, 00:07:07.320 --> 00:07:11.519 the translation allows you to run R7RS programs. 00:07:11.520 --> 00:07:15.219 But due to some change, I'm not sure where, 00:07:15.220 --> 00:07:17.119 it may have been changed in the Schemacs source code, 00:07:17.120 --> 00:07:19.639 or it may have been a change to Akku, 00:07:19.640 --> 00:07:21.239 but it no longer builds on Chez. 00:07:21.240 --> 00:07:28.039 It did at one point. I'd like to try to fix that. NOTE Portable React-like GUI 00:07:28.040 --> 00:07:30.719 The second most important thing that I've worked on is a 00:07:30.720 --> 00:07:36.439 portable React-like GUI. And so React, 00:07:36.440 --> 00:07:40.999 for anyone who has done web programming, 00:07:41.000 --> 00:07:46.839 is a very popular framework for programming web applications. 00:07:46.840 --> 00:07:48.233 And I've provided something 00:07:48.234 --> 00:07:49.599 very similar to that in Scheme now. 00:07:49.600 --> 00:07:54.679 So it works. I have constructed a DOM data structure 00:07:54.680 --> 00:07:59.079 in Scheme. It's just an ordinary Scheme data structure. 00:07:59.080 --> 00:08:01.519 It works like the web's "Document Object Model" 00:08:01.520 --> 00:08:03.960 or the "DOM" data structure. 00:08:03.961 --> 00:08:09.999 And then this Scheme DOM data structure can be rendered 00:08:10.000 --> 00:08:13.059 using any GUI framework that is convenient 00:08:13.060 --> 00:08:16.239 for the Scheme implementation that you're targeting. 00:08:16.240 --> 00:08:18.879 And you should be able to implement 00:08:18.880 --> 00:08:22.919 also rendering to a CLI as well. 00:08:22.920 --> 00:08:24.600 The current reference implementation 00:08:24.601 --> 00:08:27.759 is using a framework called Guile-GI. 00:08:27.760 --> 00:08:30.639 This is the "GObject Introspection" framework. 00:08:30.640 --> 00:08:31.967 It's a very simple 00:08:31.968 --> 00:08:36.119 GObject Introspection framework for Guile, 00:08:36.120 --> 00:08:40.979 and it binds to GTK3 on Linux. 00:08:40.980 --> 00:08:42.919 There's a similar framework called G-Golf 00:08:42.920 --> 00:08:48.359 which I'd like to begin using as well, also for Guile. 00:08:48.360 --> 00:08:53.739 G-Golf seems to be a bit more well-maintained, a bit... 00:08:53.740 --> 00:08:57.799 It has better features. G-Golf may be a 00:08:57.800 --> 00:09:00.039 better rendering backend for the reference 00:09:00.040 --> 00:09:06.039 implementation, but I would like to provide both. NOTE Demo 00:09:06.040 --> 00:09:07.933 I will give a demo of this now. 00:09:07.934 --> 00:09:12.999 Unfortunately not a whole lot 00:09:13.000 --> 00:09:18.139 to see compared to last year. 00:09:18.140 --> 00:09:20.639 First thing I'd like to show is 00:09:20.640 --> 00:09:24.279 that I now have a Makefile. You can look inside 00:09:24.280 --> 00:09:28.400 this Makefile and if you're able to read a Makefile, 00:09:28.401 --> 00:09:31.967 you can see that I have several targets now available. 00:09:31.968 --> 00:09:35.000 You can build Schemacs for Guile, 00:09:35.001 --> 00:09:36.667 you can build Schemacs for Gambit, 00:09:36.668 --> 00:09:40.333 or Stklos, or Chicken, or Chez, 00:09:40.334 --> 00:09:42.900 although none of these (except for Guile) 00:09:42.901 --> 00:09:51.167 currently works. These targets will actually 00:09:51.168 --> 00:09:56.000 build the source code, but then you would have to 00:09:56.001 --> 00:09:59.433 load it into the REPL separately. 00:09:59.434 --> 00:10:02.467 There are targets for launching 00:10:02.468 --> 00:10:06.467 a Gauche REPL and a Chibi REPL. 00:10:06.468 --> 00:10:10.867 You can also run the Emacs Lisp tests 00:10:10.868 --> 00:10:13.067 in Gauche and Chibi. 00:10:13.068 --> 00:10:19.079 You can also start a Guile REPL through this Makefile. 00:10:19.080 --> 00:10:27.499 So I will do that right now in the shell. 00:10:27.500 --> 00:10:31.833 (...make the text larger...there we go...) 00:10:31.834 --> 00:10:38.479 OK, so we have this directory of the source code. 00:10:38.480 --> 00:10:44.559 Let's just begin by running "guile.sh". 00:10:44.560 --> 00:10:52.600 This will launch a REPL and you can load "main-guile". 00:10:52.601 --> 00:10:59.719 This will launch the GUI. This is the basic 00:10:59.720 --> 00:11:04.800 proof of concept GUI that uses Guile-GI. 00:11:04.801 --> 00:11:10.519 So it may be hard to see. 00:11:10.520 --> 00:11:14.559 I cannot change the size of the text yet. 00:11:14.560 --> 00:11:17.333 I've implemented the M-: feature 00:11:17.334 --> 00:11:24.067 where you can eval in a minibuffer some Scheme code. 00:11:24.068 --> 00:11:34.439 (string-append "hello" ...) 00:11:34.440 --> 00:11:38.279 It outputs the result in the buffer. 00:11:38.280 --> 00:11:40.959 This is basically the "*Messages*" buffer. 00:11:40.960 --> 00:11:42.619 And that's all the more that I have. 00:11:42.620 --> 00:11:45.479 This is the same state it was in last year. 00:11:45.480 --> 00:11:48.699 It hasn't changed a whole lot since back then. NOTE Additional changes 00:11:48.700 --> 00:11:52.819 But I have made additional changes. 00:11:52.820 --> 00:12:05.379 So first of all, you can run 00:12:05.380 --> 00:12:10.200 (let me just go back into the Guile)... you can 00:12:10.201 --> 00:12:16.619 run the Emacs Lisp interpreter tests, so "elisp-tests". 00:12:16.620 --> 00:12:18.919 As you can see, it gives you a stack trace. 00:12:18.920 --> 00:12:22.039 So this is an error that I've been able to reproduce. 00:12:22.040 --> 00:12:24.599 I know exactly what the cause of this error is. 00:12:24.600 --> 00:12:27.599 It is not finding a variable 00:12:27.600 --> 00:12:30.319 because the closure is not correctly 00:12:30.320 --> 00:12:35.199 capturing its environment. So there should be a variable 00:12:35.200 --> 00:12:38.719 in the closure, but that variable has not been captured 00:12:38.720 --> 00:12:43.459 and so it is causing an error. 00:12:43.460 --> 00:12:48.080 It is currently loading "byte-run.el". 00:12:48.081 --> 00:12:49.820 Let me show you what code that is here. 00:12:49.821 --> 00:12:53.500 So I've copied into the source repository 00:12:53.501 --> 00:12:58.760 for Schemacs some of the Elisp code from GNU Emacs. 00:12:58.761 --> 00:13:04.420 So I have this "subr.el". 00:13:04.421 --> 00:13:09.860 This declares most of the core of Emacs Lisp 00:13:09.861 --> 00:13:12.860 that's not written in C. 00:13:12.861 --> 00:13:18.999 There's also "byte-run.el". Schemacs Emacs Lisp can now 00:13:19.000 --> 00:13:24.379 evaluate this. This is where functions like "defun" are 00:13:24.380 --> 00:13:28.359 defined, and "defmacro". So as you can see, 00:13:28.360 --> 00:13:30.799 defun itself is a defmacro defined right here. 00:13:30.800 --> 00:13:34.859 It's written in Emacs Lisp itself, 00:13:34.860 --> 00:13:37.719 defined in terms of defalias. 00:13:37.720 --> 00:13:40.239 So I can evaluate "byte-run", 00:13:40.240 --> 00:13:42.739 I can evaluate "macroexp", 00:13:42.740 --> 00:13:46.019 and the failure occurs somewhere in "subr.el". 00:13:46.020 --> 00:13:48.959 Although if you look at the stack trace, 00:13:48.960 --> 00:13:51.159 it doesn't provide all the necessary information. 00:13:51.160 --> 00:13:56.439 So it appears to be happening in byte-run.el. 00:13:56.440 --> 00:14:00.619 Really, it's an error that's occurring inside of a macro, 00:14:00.620 --> 00:14:05.799 and the macro call site is somewhere in subr.el. 00:14:05.800 --> 00:14:08.639 Anyway, take note of this stack trace. 00:14:08.640 --> 00:14:12.019 This was run from within Guile. NOTE Other Scheme implementations 00:14:12.020 --> 00:14:14.199 Now what I've done this past year 00:14:14.200 --> 00:14:19.479 is make it work on other Scheme implementations. 00:14:19.480 --> 00:14:23.833 Use "make" to launch a Gauche REPL. 00:14:23.834 --> 00:14:25.999 Now I'm inside of Gauche. 00:14:26.000 --> 00:14:27.233 This is the command that 00:14:27.234 --> 00:14:30.079 you would use to launch a Gauche REPL. 00:14:30.080 --> 00:14:38.199 And I can load the same program (load "elisp-tests.scm"). 00:14:38.200 --> 00:14:42.759 You get the exact same result as Guile. 00:14:42.760 --> 00:14:45.799 So we have two different Scheme implementations 00:14:45.800 --> 00:14:46.799 producing the same result. 00:14:46.800 --> 00:14:53.079 Let's try "make" a Chibi REPL. This is Chibi Scheme. 00:14:53.080 --> 00:15:00.219 And you can (load "elisp-tests.scm"). 00:15:00.220 --> 00:15:04.080 Chibi is a bit slower, but you get the exact same result. 00:15:04.081 --> 00:15:07.400 So we have three different Scheme implementations 00:15:07.401 --> 00:15:11.539 all running Emacs Lisp, 00:15:11.540 --> 00:15:14.039 and all producing the same result. 00:15:14.040 --> 00:15:14.767 I think that's... 00:15:14.768 --> 00:15:17.099 I'm fairly proud of that accomplishment. 00:15:17.100 --> 00:15:21.200 I was able to get the code written to the point 00:15:21.201 --> 00:15:24.879 where it actually runs on multiple implementations. 00:15:24.880 --> 00:15:30.599 You can also try making it for other Scheme compilers 00:15:30.600 --> 00:15:35.959 like "schemacs-mitscheme" for example, 00:15:35.960 --> 00:15:40.019 but this will fail. 00:15:40.020 --> 00:15:46.679 You can try building it for "schemacs-chez", 00:15:46.680 --> 00:15:51.800 Let's try Chez... there we go. 00:15:51.801 --> 00:15:54.233 And it will use Akku, 00:15:54.234 --> 00:15:58.000 and it will fetch the necessary dependencies. 00:15:58.001 --> 00:16:03.433 But it fails, and I haven't been able to 00:16:03.434 --> 00:16:05.959 debug that quite yet. 00:16:05.960 --> 00:16:13.139 Stklos fails for a similar reason. 00:16:13.140 --> 00:16:21.699 Gambit... Chicken still doesn't build all the way yet. 00:16:21.700 --> 00:16:27.120 The Makefile at least has places for it. 00:16:27.121 --> 00:16:30.967 If anyone can help me out and get Schemacs to compile 00:16:30.968 --> 00:16:32.733 on these other Scheme implementations, 00:16:32.734 --> 00:16:34.000 I'd appreciate it. 00:16:34.001 --> 00:16:35.467 I can probably figure it out myself, 00:16:35.468 --> 00:16:37.000 but that will take more time. 00:16:37.001 --> 00:16:40.120 And let me just show you quickly 00:16:40.121 --> 00:16:41.720 the test program. 00:16:41.721 --> 00:16:44.500 Basically this is the Emacs Lisp test program 00:16:44.501 --> 00:16:48.580 that I was just running, and it produces an error. 00:16:48.581 --> 00:16:53.220 All it does is it loads these files here in this order, 00:16:53.221 --> 00:16:55.180 and it fails right around here. 00:16:55.181 --> 00:16:58.319 So it's able to load these two. 00:16:58.320 --> 00:17:01.360 And yeah, that's what I've accomplished 00:17:01.361 --> 00:17:06.199 on the Emacs Lisp side of things. NOTE GUI framework 00:17:06.200 --> 00:17:09.119 The next thing I want to show you is the GUI framework 00:17:09.120 --> 00:17:13.199 that I've written, which I'm fairly proud of so far. 00:17:13.200 --> 00:17:15.833 So this is the GUI framework 00:17:15.834 --> 00:17:19.919 (oops, I better launch it again, OK...) 00:17:19.920 --> 00:17:22.600 and let me show you the tests. 00:17:22.601 --> 00:17:25.700 So here in the tests, you can start to see 00:17:25.701 --> 00:17:29.067 some examples of how you use it. 00:17:29.068 --> 00:17:31.833 So here is a "counter" test, and this is kind of like 00:17:31.834 --> 00:17:35.940 the "hello world" of reactive programming frameworks, 00:17:35.941 --> 00:17:38.000 where you have a state variable, 00:17:38.200 --> 00:17:41.659 sometimes called an "observable." 00:17:41.660 --> 00:17:43.439 I'm calling it "number", 00:17:43.440 --> 00:17:47.838 and it uses "=" to check if the state has updated. 00:17:49.000 --> 00:17:52.820 If an update occurs and the new value is different 00:17:52.821 --> 00:17:55.032 from the old value according to the "=" function, 00:17:55.033 --> 00:17:59.232 then trigger a state update in the GUI as well. 00:17:59.233 --> 00:18:03.099 Initialize to 0, bound to "number". 00:18:03.100 --> 00:18:06.132 I have a "button" function which creates a simple button. 00:18:06.133 --> 00:18:07.832 It takes a label and an action. 00:18:07.833 --> 00:18:10.865 Right here you see the "div" command. 00:18:10.866 --> 00:18:13.039 This is what creates a "div". 00:18:13.040 --> 00:18:18.999 Using the properties, I describe that this div is a 00:18:19.000 --> 00:18:22.599 push-button and the "on-button-push" is an action. 00:18:22.600 --> 00:18:25.265 The action is to update the variable "number" 00:18:25.266 --> 00:18:30.399 using whatever function or lambda was provided to it. 00:18:30.400 --> 00:18:31.965 And then the content that you see on screen, 00:18:31.966 --> 00:18:34.033 that you will see on screen when it runs, 00:18:34.034 --> 00:18:38.667 is here. You create a "div-pack cut-vertical". 00:18:38.668 --> 00:18:43.233 You declare two buttons and then you declare 00:18:43.234 --> 00:18:46.800 this "use-vars" which will take the content 00:18:46.801 --> 00:18:48.833 of this variable here, this observable, 00:18:48.834 --> 00:18:51.733 and place it into the GUI next to the buttons here. 00:18:51.734 --> 00:18:54.233 So what you will see on screen is 00:18:54.234 --> 00:18:57.067 a "plus" button which increments, 00:18:57.068 --> 00:18:59.320 here is the "increment" function, 00:18:59.321 --> 00:19:02.779 a "minus" button which decrements, 00:19:02.780 --> 00:19:05.479 and then the content of the variable that is 00:19:05.480 --> 00:19:09.699 being incremented and decremented. 00:19:09.700 --> 00:19:11.865 The advantage of these reactive frameworks is that 00:19:11.866 --> 00:19:13.065 with very few lines of code 00:19:13.066 --> 00:19:16.032 you can create fairly complex interfaces. 00:19:16.033 --> 00:19:18.599 The less code you have to write, 00:19:18.600 --> 00:19:21.232 the fewer chances you have to make mistakes. 00:19:21.233 --> 00:19:23.967 So let's just run this program. 00:19:23.968 --> 00:19:33.292 This was the "counter-test." 00:19:33.293 --> 00:19:35.199 And that is the debug window. Here's the "counter." 00:19:35.200 --> 00:19:38.452 I'm sorry it's not much larger than this. 00:19:38.453 --> 00:19:41.132 But here's the "plus" button, the "minus" button, 00:19:41.133 --> 00:19:43.919 and here's the "number", 0. 00:19:43.920 --> 00:19:49.792 And I can increment or decrement as much as I like. 00:19:49.793 --> 00:19:51.100 So yeah, that's kind of the hello world 00:19:51.101 --> 00:19:55.239 of reactive programming. (I'll reboot the REPL...) 00:19:55.240 --> 00:19:58.599 The next thing I want to show you is this layout test. 00:19:58.600 --> 00:20:02.192 And I'll just run the test first. 00:20:02.193 --> 00:20:05.019 So here we have basically 00:20:05.020 --> 00:20:08.539 a tiling window manager kind of thing, 00:20:08.540 --> 00:20:11.279 where you can resize the tiles 00:20:11.280 --> 00:20:12.933 and then by clicking on these buttons here, 00:20:12.934 --> 00:20:16.939 you can change the layout. 00:20:16.940 --> 00:20:20.167 So you can do two on the right, 00:20:20.168 --> 00:20:27.100 two up above, or three up above. So, yeah. 00:20:27.101 --> 00:20:30.267 Those tiling windows, as you can see, 00:20:30.268 --> 00:20:33.000 once I work this branch into the main branch of Schemacs, 00:20:33.001 --> 00:20:35.273 I can use that to implement 00:20:35.274 --> 00:20:38.265 the split window functionality for Schemacs, 00:20:38.266 --> 00:20:42.466 the editor. So here's what this split... 00:20:42.466 --> 00:20:44.865 Here's the layout test that you just saw. 00:20:44.866 --> 00:20:46.732 Let me make it a bit smaller 00:20:46.733 --> 00:20:48.199 so that it all fits on one screen. 00:20:48.200 --> 00:20:51.365 So basically we have the "button" command again, 00:20:51.366 --> 00:20:54.132 and then these are the button actions 00:20:54.133 --> 00:20:56.999 which basically just changes the layout, 00:20:57.000 --> 00:21:01.459 and then I have the layout. So this layout is a "div." 00:21:01.460 --> 00:21:04.919 The first div just places three buttons in a row. 00:21:04.920 --> 00:21:07.532 The next layout is a div within a div. 00:21:07.533 --> 00:21:12.999 So we have one div which places the button 00:21:13.000 --> 00:21:18.632 called "two right" buttons, and the div above it, 00:21:18.633 --> 00:21:21.492 which places the "three in a row" button 00:21:21.493 --> 00:21:22.660 or the "two above" buttons. 00:21:22.661 --> 00:21:26.000 And here's the next... So there's three different 00:21:26.001 --> 00:21:30.600 layouts, and clicking on one of their associated buttons 00:21:30.601 --> 00:21:32.100 will just change the layout. 00:21:32.101 --> 00:21:33.433 As you can see, very little code 00:21:33.434 --> 00:21:38.500 to create a somewhat complex user interface. 00:21:38.501 --> 00:21:42.867 That's the advantage of using reactive or declarative 00:21:42.868 --> 00:21:44.233 UI programming paradigms. 00:21:44.234 --> 00:21:47.232 So yeah, this has not been merged into Schemacs 00:21:47.233 --> 00:21:48.700 at the time of this recording, 00:21:48.701 --> 00:21:51.519 but will be soon hopefully. NOTE Wrapping up 00:21:51.520 --> 00:21:55.165 So yeah, I think I've already gone on for 20 minutes. 00:21:55.166 --> 00:21:59.139 So I guess I'll just end my presentation here. 00:21:59.140 --> 00:22:00.465 I have lots more to talk about. 00:22:00.466 --> 00:22:03.979 I guess I will say one last thing before I go: 00:22:03.980 --> 00:22:07.065 that I would very much like for others 00:22:07.066 --> 00:22:09.199 to try and contribute to this project. 00:22:09.200 --> 00:22:14.232 I will do my best to try and help teach anybody 00:22:14.233 --> 00:22:16.832 or work with anybody, especially even 00:22:16.833 --> 00:22:18.599 if you don't have much experience with Scheme. 00:22:18.600 --> 00:22:22.759 I'd like to help everybody try to contribute. 00:22:22.760 --> 00:22:26.239 Basically I want to get this proof of concept working. 00:22:26.240 --> 00:22:30.673 I want to get a stable user interface up and running, 00:22:30.674 --> 00:22:33.065 and then we can start working on 00:22:33.066 --> 00:22:36.699 improving the Emacs Lisp interpreter all together. 00:22:36.700 --> 00:22:41.065 There are close to 1,400 built-in functions 00:22:41.066 --> 00:22:43.659 which need to be implemented. 00:22:43.660 --> 00:22:44.965 We don't need to get all of them 00:22:44.966 --> 00:22:48.465 in order to be able to run probably most of ELPA, 00:22:48.466 --> 00:22:50.865 but as much as possible. 00:22:50.866 --> 00:22:54.799 We would like to clone Emacs Lisp and I need help. 00:22:54.800 --> 00:23:02.579 So get a hold of me. My project is on Codeberg. 00:23:02.580 --> 00:23:06.919 Well, (oh, I can't show this here), 00:23:06.920 --> 00:23:14.113 but I will end it there. Thank you for listening.