fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

#schemelang

0 posts0 participants0 posts today
Replied in thread

What I don’t like:

  • some stuff breaks “everything is a list” model
  • Common Lisp is not minimal, includes overlapping and legacy stuff

does #scheme address this?

@rzeta0 I would say yes, Scheme sort of addresses those issues.

Scheme’s biggest advantage is that it is minimal enough that you can understand the whole language specification top-to-bottom, inside and out. But that is also it’s greatest drawback: is that it is too minimal to be practical. So for a long time, every single Scheme implementation has a it’s own large and unique set of libraries for solving practical programming problems that were incompatible with other Scheme implementations, making the Scheme ecosystem very fragmented. The Scheme Request for Implementation (SRFI) process is meant to address this fragmentation issue. Fragmentation is still (in my opinion) a pretty big problem, though things are much better than they were 20 years ago.

The R6RS standard, as I understand it, tried to make Scheme more practical, but it started to become too Common Lisp-like in complexity so it was mostly rejected by the Scheme community — with a few notable exceptions, like the Chez Scheme compiler.

The next standard, R7RS, split the language into two parts: “R7RS small,” ratified in 2014, which is more like the original minimal core of the Scheme language, but just a few new features, in particular the define-library macro, for modularizing parts of Scheme programs into immutable environment objects. Then they took a collection of “SRFIs” and declared them to be part of the “R7RS large” language standard. The full “large” language specification is not yet fully ratified, even 11 years after the completion of R7RS “small,” but I think the SRFIs they have ratified so far already make the latest Scheme standard a very practical language. The final R7RS standard may end up being larger than Common Lisp, but that is fine with me since it can be almost completely implemented in the R7RS “small” Scheme standard.

R7RS “small” Scheme, in my opinion, is a powerful but minimal language that exists to implement other languages, but is still useful in it’s own right as a progeny of Lisp. The “R7RS large” language then adds the useful features of larger languages like Python or Common Lisp as a layer on top of the “R7RS small” language.

The current chair of the R7RS working group is Daphne Preston Kendal, and is often on Mastodon as @dpk . She can tell you if I got anything in this post wrong.

srfi.schemers.orgScheme Requests for Implementation
Replied in thread

@xameer the “R7RS small” Scheme standard has a full numerical tower built-in, including unbounded integers.

(- (+ (expt 10 100) 1) (expt 10 100))

gives you precisely the correct answer without any floating-point operations. Although macros for symbolic computation with optimization that would avoid computation of (expr 10 100) is “an exercise left to the reader.” Haskell might do the optimal computation though thanks to it’s lazy evaluation.

Replied in thread

Are you a Lisper? If yes, What made #lisp special in your view?

@lxsameer a few things:

  • absolute minimum amount of syntax, makes it very easy to understand how the computer sees each part of the program, makes it easy to implement your own parser if you want to.
  • the ability to define your own evaluator for Lisp syntax, also made considerably easier than other languages due to the minimal syntax. This also makes it easy to develop your own tooling, or to modify existing tooling for the language, which brings me to the next point…
  • macro programming: the ability to hack the Lisp compiler itself so that it can run your own evaluator. This allows you to introduce language features when and where you need them, like linting, type checking, literate programming, alternative evaluation strategies (e.g. lazy evaluation, or concurrent evaluation), etc.
  • functional programming: it is based on the mathematics of lambda calculus, which is a very elegant way of defining algorithms and computation. It is also a computer for the “untyped lambda calculus“ which can implement any other typed lambda calculus as a system of macros.
  • homoiconicity, again a feature of the minimal syntax, allows you to express programs as data, and data as programs. This is very useful for serialization and transport across multiple computers.
  • REPL-based development, which is a feature many languages have nowadays (although Lisp invented this feature), allows for rapid prototyping and easier debugging.
  • stability: Lisp languages like Common Lisp and Scheme have changed very little throughout the decades as there is no need to change them. Macro programming makes it so that you don’t need too add new language features all the time, language features become extensions you can import into your project.
Swift LispKit is a Scheme written in Swift

It is odd that I had not heard about this #Scheme implementation until very recently. I can find almost no reference to it anywhere on the scheme.org website or the r7rs.org website, although they advertise compliance with the R7RS standard.

I installed the “LispPad” app (the Mac OS front-end to Swift LispKit) and

  • it follows the modern Mac OS user interface guidelines pretty well
  • implements a large number of SRFI extensions
  • provides a very large array of libraries to extend the core features of R7RS
  • provides thorough online documentation

That said, I have found the LispPad GUI prety difficult to use, mostly because when I use the REPL, pressing enter does not execute the input, it seem like you must use the mouse to press a little “execute” button instead. The GUI seems to be designed more for use on tablets than on PCs. And I haven’t figured out how to use it from the terminal yet either.

It seem like a pretty good implementation though, and I am wondering why I haven’t heard much talk about it anywhere?

GitHubGitHub - objecthub/swift-lispkit: Interpreter framework for Lisp-based extension and scripting languages on macOS and iOS. LispKit is based on the R7RS standard for Scheme. Its compiler generates bytecode for a virtual machine. LispKit is fully implemented in Swift 5.Interpreter framework for Lisp-based extension and scripting languages on macOS and iOS. LispKit is based on the R7RS standard for Scheme. Its compiler generates bytecode for a virtual machine. Lis...
#tech#software#Lisp
Replied in thread

me, scoffing: dude there’s like a million of those. what, does yours compile on a pregnancy test?

@garbados I can’t find it now, but someone apparently wrote a #SchemeLang that compiles to Ethereum smart contracts. Being that it runs on the cryptocurrency blockchain, they called it “Pyramid Scheme.” It may have been a joke, but I think someone actually did that.

I have challenged myself to try to get my large Scheme code base to compile on any #Scheme I can find that claims to conform to the #R7RS standard. So far I can get a significant portion of it to compile on #Guile (reference), Gambit, MIT Scheme, #Gauche, and Chibi. I hope I can get it to build on Chez with the #R7RS compatability layer built-in to the Snow Fort package manager.

If you want to learn Gtk programming

No matter what language you want to use to program your Gtk app, read the Python tutorial to get started, even if you are not going to write your app in Python.

So far it has been the most comprehensive and well-written tutorials I have ever seen for Gtk, and explains important concepts even better than the official documentation does. What applies to Gtk programming Python applies to most any other programming language as well, especially scripting languages, so what you learn from this tutorial will apply to your use case as well.

Gtk is a cross-platform GUI toolkit that serves as infrastructure for Linux/BSDUnix desktop environments like Gnome, Cinnamon, MATE, and Xfce. Gtk apps can build and run on Mac OS and Windows without too much difficulty. Though Gtk is written in C it supports very a wide range of programming languages for application programming such as Python, JavaScript, Ruby, Lua, most of Lisp the Lisp family, Java, Vala, C#, even C++ if you are a masochist. Because of this, it never occurred to me that if I wanted to learn more about Gtk programming, I should read a tutorial for one specific language (Python). Now that I have read it, I wish I had known this sooner, so I am telling everyone here on the fediverse.

EDIT: I forgot to mention, you can download the entire tutorial locally as HTML, PDF, or EPUB so that you can hack offline as well!

python-gtk-3-tutorial.readthedocs.ioThe Python GTK+ 3 Tutorial — Python GTK+ 3 Tutorial 3.4 documentation
#tech#software#Linux

#SchemeLang (the Scheme programming language) is not a mainstream language, and there are a lot of drawbacks to this, mostly involving a lack of resources for everything from documentation and tutorials, to libraries and tooling. It just doesn’t have enough of an “online presence” for it to be easier to learn and use, and it is hard to find people whom you can ask questions about it. On the other hand, virtual communities form around programming languages, including #Scheme , and the fact that it is not used very often in commercial projects makes the Scheme community a very close-knit one.

It also lets you see what the world might be like without Silicon Valley tech bro culture or venture capital’s innate drive toward enshittification of everything affecting every aspect of the community around this programming language. You can find libraries of code that haven’t been updated in a decade that still work fine today. When you find a tutorial or documentation, it is not usually AI slop, or search-engine optimized clickbait, or only available behind paywalls on sites that still serve you ads after you have a subscription, or YouTube videos (if there are any) explaining the basics of how to use it interrupted every 5 minutes by the presenter doing an ad for their sponsors.

I especially like the fact that every last library or framework does not have a cute logo, or it’s own domain name, or a website in which the content is 98% marketing jargon and 2% documentation and tutorials. If #Scheme ever goes mainstream, I am going to miss this aspect of it.

Replied in thread

what are the differences between resurrected GuileEmacs that was also announced in EmacsConf2024 and Gypsum? At first glance seems like both projects have the same goal.

@ram535 thanks for asking! The goal for both projects are similar, but they are achieved in slightly different ways.

Gypsum is a clone written in Scheme, meaning it is software the behaves exactly like Emacs, but it is written from scratch in a new code base. In this case, it is also being written in a completely different programming language, Scheme instead of C. The larger goal is to have an Emacs that is backward compatible with GNU Emacs but is written in Scheme that runs on any R7RS standard compliant Scheme implementation. There is no C code in this project at all, it is purely Scheme. I would like to also target other compilers such as MIT Scheme, Gambit, Stklos, and possibly Chicken and Larceny as well, though this will be pretty difficult and rely on a lot of cond-expand code. The larger goal is to have an Emacs app platform that encourages the use of the Scheme language for creating applications and text editing work flows, regardless of the underlying compiler.

@lispwitch ‘s “GuileEmacs” is not a clone, but a fork of both GNU Emacs and GNU Guile, meaning it modifies the existing GNU Emacs code base and some of the Guile source base, replacing some of the C source code in GNU Emacs with other C source code from Guile. Then, the Emacs Lisp interpreter written in C is replaced with an Emacs Lisp interpreter written in Guile Scheme. This allows Emacs Lisp to be JIT compiled using Guile’s JIT compiler, and also make use of all of the Guile software ecosystem to extend Emacs. This is incredibly useful, because there is quite a lot of Guile software, including things like web servers and game engines, and soon it could all be available for use by Emacs programmers. It will probably also be production ready much sooner than my Gypsum project because it only needs to implement the core of Emacs Lisp to work. However, it relies on language features specific to Guile to achieve this, so it is not fully R7RS standards compliant, and will not work on other Scheme implementations.

I tried using Marc Nieper-Wißkirchen’s Scheme pattern matcher

It’s called (rapid match), and it is part of the “Rapid Scheme” compiler project, which is a Scheme compiler written in portable, standards-compliant R7RS “small” Scheme.

It is tiny, only 300 lines of code, and compiles almost instantly. But it lacks features that other pattern matchers might have, especially matching on record data types, becuase the R7RS “small” standard does not provide any mechanism for introspection of record data. Also it cannot assign a whole pattern to a single variable, you can only match variables to elements inside of the pattern, which is unfortunate.

But it is efficient, and it gets the job done. It will probably cover 80% of all use cases. It’s best features are portability and it’s small footprint. I have decided to use it in my Gypsum software.

I also discovered that unfortunately Guile Scheme does not fully implement the R7RS standard for library definitions, it is missing the (export (rename from-sym to-sym)) declaration syntax. But I was able to work around it and get (rapid match) to build on Guile.

I am presenting for #EmacsConf2024

The presentation is live now, and I am available for questions in the “Big Blue Button” chat room. Feel free to ask me questions here on ActivityPub.

The project is an implementation of #EmacsLisp written in portable #R7RS standard #Scheme programming language. The reference implementation is written in #GuileScheme

@daviwil hey, thanks for mentioning my talk in your latest live stream! (I watched it but wasn’t able to comment in the chat.) I hope I can answer everyone’s questions tomorrow when my presentation goes live. I haven’t made as much progress on my “Gypsum” project as I had hoped, but I think I have a solid foundation on which we (me and anyone who wants to contribute) can build.

I am also really looking forward to @lispwitch presentation.

It was nice to see @cwebber and @dpk there as well.

https://www.youtube.com/watch?v=RsW7PWhS_vg

Monadic programming in R7RS Scheme

This is my article on how to solve practical programming problems in the Scheme language using monads, a concept originally introduced to the world of software engineering by the Haskell programming language. Because the Scheme language is not purely a Lambda Calculus computer the way Haskell is, and does not do static type checking, monads are not as necessary to Scheme programmers as they are to Haskell programmers, but can still come in handy.

Monads let you code procedures (without using macros) that do not use strictly procedural programming semantics. They let you model alternative semantics like concurrent programming, or lazy evaluation. I go over two examples: of a procedural but monadic pretty printer, and list monad implementation which demonstrate a simple concurrent programming semantics.

https://tilde.town/~ramin_hal9001/articles/scheme-monads.html

tilde.townRamin Honary: Scheme Monads
Replied in thread

“Question for lispers with experience: If you should start to learn a LISP style language today, which one do you pick up? Why?”

@syntaxerror The R7RS “Small” Scheme standard is roughly 80 pages, so you can learn about all of the language features very quickly. I love it because of it’s minimalism, it is my preferred language.

My take on it is that the “Small” Scheme standard is perfectly designed to construct larger programming languages with more features. One such language is R7RS “Large” Scheme, but you could theoretically use it to implement Common Lisp, Python, JavaScript, or any other language.

The R7RS “Large” standard is still being discussed (10 years after “small” was ratified), but it relies heavily on the “Scheme Request For Implementation“ (SRFI) process to fill out features. The larger portion of the R7RS “Large” standard is already ratified and published, so it is still useful even though it is not complete.

There are many Scheme implementations, but I recommend Guile, as it is almost completely R7RS-Small compliant, and has a ton of other useful features that come with it out of the box. So if you need, for example, a quick web server, or a way to search your filesystem, Guile has modules for that.

Another good batteries-included Lisp is Racket, which is a larger language built on top of Chez Scheme (an R6RS Standard Scheme implementation). You can easily install the R7RS Scheme language pack on Racket and write your code in Scheme as you read through the R7RS standard document.

Both Guile and Racket/CS (Chez Scheme) not only have many useful features, but compile to binary code that runs extremely fast for a high-level language.

Also, if you haven’t already, try to learn to use Emacs.

#tech#software#Lisp

1994 Indiana U., Robert G. Berger: “The Scheme Machine”

This paper describes the design and implementation of the Scheme Machine, a symbolic computer derived from an abstract Scheme interpreter. The derivation is performed in several transformation passes. First, the interpreter is factored into a compiler and an abstract CPU. Next, the CPU specification is refined so that it can be used with the Digital Design Derivation system. Finally, the DDD system assists in the transformation into hardware. The resulting CPU, implemented in field programmable gate arrays and PALs, is interfaced to a garbage-collecting heap to form a complete Scheme system.