rml, to random
@rml@functional.cafe avatar

"When programming in you can feel the bits sliding between your toes."
— Guy Steele

chemoelectric, to random
@chemoelectric@masto.ai avatar

For the I decided to get a little fancy:

Xiaolin Wu's line algorithm - Rosetta Code https://rosettacode.org/wiki/Xiaolin_Wu's_line_algorithm#Scheme

Also I realized that using the transparency channel meant I had no need for gamma correction! But it then did require constructing an image from parts. That’s what made it more fun, though.

rml, to random
@rml@functional.cafe avatar

of the full source bootstrap is commented well enough that you can get a sense of what's going on fwiw

https://git.savannah.nongnu.org/cgit/stage0.git/tree/stage0/stage0_monitor.hex0

rml, to random
@rml@functional.cafe avatar

idiolect of thats just a module that re-exports define, define-syntax, etc as def, def/syntax etc; call it scanty

rml, to random
@rml@functional.cafe avatar

in a toot: implemented in

;; Jason Hemann and Dan Friedman  
;; microKanren, final implementation from paper

(define (var c) (vector c))  
(define (var? x) (vector? x))  
(define (var=? x1 x2) (= (vector-ref x1 0) (vector-ref x2 0)))

(define (walk u s)  
 (let ((pr (and (var? u) (assp (lambda (v) (var=? u v)) s))))  
 (if pr (walk (cdr pr) s) u)))

(define (ext-s x v s) `((,x . ,v) . ,s))

(define (== u v)  
 (lambda (s/c)  
 (let ((s (unify u v (car s/c))))  
 (if s (unit `(,s . ,(cdr s/c))) mzero))))

(define (unit s/c) (cons s/c mzero))  
(define mzero '())

(define (unify u v s)  
 (let ((u (walk u s)) (v (walk v s)))  
 (cond  
 ((and (var? u) (var? v) (var=? u v)) s)  
 ((var? u) (ext-s u v s))  
 ((var? v) (ext-s v u s))  
 ((and (pair? u) (pair? v))  
 (let ((s (unify (car u) (car v) s)))  
 (and s (unify (cdr u) (cdr v) s))))  
 (else (and (eqv? u v) s)))))

(define (call/fresh f)  
 (lambda (s/c)  
 (let ((c (cdr s/c)))  
 ((f (var c)) `(,(car s/c) . ,(+ c 1))))))

(define (disj g1 g2) (lambda (s/c) (mplus (g1 s/c) (g2 s/c))))  
(define (conj g1 g2) (lambda (s/c) (bind (g1 s/c) g2)))

(define (mplus $1 $2)  
 (cond  
 ((null? $1) $2)  
 ((procedure? $1) (lambda () (mplus $2 ($1))))  
 (else (cons (car $1) (mplus (cdr $1) $2)))))

(define (bind $ g)  
 (cond  
 ((null? $) mzero)  
 ((procedure? $) (lambda () (bind ($) g)))  
 (else (mplus (g (car $)) (bind (cdr $) g)))))  
rml, to programming
@rml@functional.cafe avatar

"The focus of my research is applying , in particular , to low-level problems — the type of situations that usually call for or #c"

— highly recommended talk on programming with serialized data from @vollmerm @

https://www.twitch.tv/videos/1803057942

ramin_hal9001,
@ramin_hal9001@emacs.ch avatar

@rml @theruran @vollmerm
I love how the minimal interpreter (without the compiler) on x86_64 Linux is only 346800 bytes. That is small and minimal. But the Chez compiler is best-in-class, producing the among the fastest and smallest binaries of any Lisp.

That said, Guile's licensing and it's use in , and it's extensive collection of libraries and SRFI support, make a superior choice for practical applications (IMHO). Also now I know of someone working on porting the "PreScheme" compiler from Scheme48 (a Scheme subset with no garbage collector) to Guile for use in building low-level performance binaries: https://gitlab.com/flatwhatson/guile-prescheme

> "I promise I'll convince everyone here that types are good by the end of this talk"

As a Haskeller, I do not need convincing at all. One thing that got me to even pay attention to however was a conversation with a friend, William Byrd -- by the way, who's dissertation is in relational logic programming from the University of Indiana under Dan Friedman, same school as the presenter in this video -- explained to me that the power of Scheme comes from both it's minimalism, but also it's macro system which you can use to implement any type system you might want. Byrd told me he is frustrated by the world kind of gravitating toward the Hindley Milner type checking algorithm used by OCaml, F#, Haskell, Typed-Racket, Coalton, Carp, and PreScheme, as if it is the end-all-be-all of type systems.

So anyway, Will Byrd convinced me how cool it is being able to use any type system at all in Scheme. Hindley-Milner, CSP, Pi Calculus, Calculus of Constructs, Separation Calculus, Location Calculus (which I just now learned about!), or maybe even more exotic constraints systems modeled on physics -- use whatever is best for your problem domain.

ramin_hal9001, to linux
@ramin_hal9001@emacs.ch avatar

Guix maintainers Janneke Nieuwenhuizen @janneke and Ludovic Courtès @civodul have announced just today that their "seed" C compiler "Mes" is now in production in Guix OS. Mes can, after several boostraping stages eventually compile GCC which in turn compiles Linux, Guile, and Guix. The bootstrap program (as I understand it) is written in Guile Scheme, and compiles to a 357 byte binary. Now when you do guix pull you will see that the entirety of the core operating system (some 22,000 expressions) all depend on that single 357-byte bootstrap program. The idea is to eliminate the footprint of trusted binaries that build the software for the OS and compiler toolchain -- the famous "Trusting Trust" problem outlined by Ken Thompson which he presented while receiving his Turing Award. Thanks to their hard work, we now have an operating system for which every stage of the build can be verified by a human. https://guix.gnu.org/blog/2023/the-full-source-bootstrap-building-from-source-all-the-way-down/

Nix OS people do not need to feel left out, a new issue on the Nix OS GitHub page has announced that they will begin a similar project. https://github.com/NixOS/nixpkgs/pull/227914

dthompson, to gamedev

We are 1 month away from the next Lisp Game Jam! Make a dating sim in Emacs Lisp. Or make a Souls-like in Chicken Scheme (aka Chicken Scheme for the Souls.) Or make a kart racer in Fennel. Or make a post-apocalyptic action platformer in Common Lisp. Or make a roguelike in Racket. Or make a farming sim in Guile. Or make a strand type game in Clojure.

https://itch.io/jam/spring-lisp-game-jam-2023

rml, to random
@rml@functional.cafe avatar

"Something I'm curious about working on is an imperative dependently typed programming language that uses linear types and to keep the mutation in line. Something I have to admit is that I'm not actually interested in . I'm simply interested in ."

chemoelectric, to random
@chemoelectric@masto.ai avatar

The same program as before, but this time in or :

Euler method - Rosetta Code https://rosettacode.org/wiki/Euler_method#Ol

rml, to random
@rml@functional.cafe avatar

An Efficient for the Gradually Typed Calculus

abcdw, to random
@abcdw@fosstodon.org avatar

Tomorrow will be trying out @dthompson's Haunt hackable static site generator.

It's written in Scheme, should be quite minimalistic and very flexible.

Stream starts 8 a.m. UTC.

https://trop.in/stream

https://dthompson.us/projects/haunt.html

rml, to random
@rml@functional.cafe avatar

Wow, Marc Nieper-Wisskirchen's new macros tutorial looks epic... perhaps the first detailed deep dive since JRM's famous syntax-rules primer for the merely eccentric. content :chart-with-upwards-trend:

https://raw.githubusercontent.com/mnieper/scheme-macros/main/README.org

aziz, to random

I released the code of petit-cloud, check out the quickstart @ https://github.com/letloop/petit-cloud#quickstart

Happy coding

rml, to random
@rml@functional.cafe avatar

the one good thing to come out of covid is a whole slew of great courses were shared online. just found Jeremy Siek's lectures from the famous IU course here:

https://www.youtube.com/watch?v=6TdcSAJb3wI

rml, to random
@rml@functional.cafe avatar

Layering: The Architecture of Programs

Gerald Sussman for #Scheme '21 @ #SIGPLAN

rml, to random
@rml@functional.cafe avatar

Source info propagation with macro expansion
https://blog.practical-scheme.net/gauche

"#Gauche tracks source code location information and shows it in the stack trace. However, what if the source is generated by macros? In 0.9.12, the macro expander re-attached the original source info to the outermost form of the macro output. However, if a runtime error occurred in constructed code other than the outermost one, stack trace couldn't find the info and had to show '[unknown location]'. It was annoying especially when the code was the result of nested macro expansions, that you didn't get a clue about where the error came from."

#scheme #lisp

ramin_hal9001, to programming
@ramin_hal9001@emacs.ch avatar

I've been learning about Delimited Continuations lately, because I have recently learned that several programming language theory heavyweights, including Oleg Kiselyov, now believe the classic continuation control construct, e.g. "call/cc" in the language, were big mistake that make program optimization needlessly difficult, though I don't fully understand why this would be the case. Unfortunately, "call/cc" is encoded in the Scheme language standard, so compiler authors need to come up with work-arrounds -- who knew at the time of the first revision (1975) it would be a bad idea?

Delimited Continuations solve the problems inherent in continuations (again, I don't understand why), and are composable, meaning it is easy to write modular pieces of code using continuations in isolation that can all be made to fit nicely together with a few simple high-order functions.

So fortunately for me, there is already a good implementation, so I can probably figure it all out by just reading the code and studying the type definitions: https://hackage.haskell.org/package/CC-delcont

Here is the research paper by R. Kent Dybvig, Simon Peyton Jones, and Amr Sabry describing the implementation: https://legacy.cs.indiana.edu/~sabry/papers/monadicDC.pdf

Here is a primer on Delimited Continuations which I found helpful: https://gist.githubusercontent.com/sebfisch/2235780/raw/c1d9340e26fcf8b334d994c173d9c26fa8f4129f/gistfile1.md

rml, to random
@rml@functional.cafe avatar

What are some ideal bugs for teaching lisp debugging?

rml,
@rml@functional.cafe avatar

@screwtape @svetlyak40wt @galdor @ldbeth

I think they are pretty similar actually, with the major differences imo being that implementations typically reify stack frames as continuations, allowing you to step through program execution live without necessarily needing a macrostepper, while offers the SLIME/Sly experience on top of countless battle hardened tools & techniques developed over decades, with of course the downsides of a dynamic lexical environments and lack of hygiene that can lead to particularly funky debugging situations.

Most schemes have let-syntax, which I believe is like macrolet but with syntax-objects, which is another distinguishing difference. Syntax-objects are like records with an AST & source location information. It's worth noting that Robert Smith said that Common 's lack of a means to perform transformations over locations is one of the biggest obstacles to improving 's user experience: https://twitter.com/stylewarning/status/1574868014855380992

But overall, scheme systems are typically very bare bones, you're often expected to roll ad-hoc debugging tools that I believe common lisp ships with. But the attraction of this is that our systems are easy to decompose and mold into whatever you need, and tools you simply can't imagine elsewhere (because of lack of first-class continuations) simply fall out the bottom once you get the hand of it. But I'll admit, moving from to pure scheme was at times daunting and very challenging, whereas I could pretty much pick up racket and roll with it.

abcdw, to opensource
@abcdw@fosstodon.org avatar

Today I received the first payment for the Free and Open Source Software work. It's of course is not a sustainable business yet, but a good step towards.

Ask me anything.

rml, to random
@rml@functional.cafe avatar

#guix tip of the day:
upstream server issues got you retriggering a command until the download succeeds? fire up a #guile repl and have it automate the process for you with just a few lines of #scheme.

ramin_hal9001,
@ramin_hal9001@emacs.ch avatar

@rml @jeko
I have only recently started my jounrey of replacing with , nice to know it will only take 1.5 years.

rml, to scheme
@rml@functional.cafe avatar

"Using the compiled code is around 470x faster than our current interpreter, at least for this simple arithmetic loop."

The project on replacing their compiler backend with scheme
https://www.unison-lang.org/whats-new/jit-announce/

ArneBab, to python French
@ArneBab@rollenspiel.social avatar

@SReyCoyrehourcq note the links there. What got me from to Scheme is http://www.phyast.pitt.edu/~micheles/scheme/aps/index.html — this taught me a lot off great background; py2guile was how I made the practical progression, recreating what I missed and learning to love the additional options I got from .

Nowadays I write most of my hobby code in : https://www.draketo.de/english/wisp — examples: https://www.draketo.de/software/advent-of-wisp-code-2021 🙂

You may want to use code from https://hg.sr.ht/~arnebab/wisp/browse/examples i.e. doctests.scm
@bond @cwebber

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • InstantRegret
  • magazineikmin
  • thenastyranch
  • modclub
  • everett
  • rosin
  • Youngstown
  • slotface
  • ethstaker
  • mdbf
  • kavyap
  • osvaldo12
  • DreamBathrooms
  • anitta
  • Durango
  • ngwrru68w68
  • tester
  • khanakhh
  • love
  • tacticalgear
  • cubers
  • GTA5RPClips
  • Leos
  • normalnudes
  • provamag3
  • cisconetworking
  • JUstTest
  • All magazines