Damus
Panicz Maciej Godek profile picture
Panicz Maciej Godek
@Panicz Maciej Godek

I like cycling, swimming, pizza, ice cream, comics, computer games and Lisp programming in Emacs.
Currently I'm developing #GRASP - the GRAphical Scheme Programming environment for Android, Desktop and Terminal, sharing #SchemeBites and #PlottingScheme

Relays (1)
  • wss://relay.ditto.pub – read & write

Recent Notes

note17a02c...
Panicz Maciej Godek profile picture
@nprofile1q...

Let me start off by saying that I'm impressed by Haskell' s type system and I've long been looking for a nice way to express types in Scheme

So I was familiar with the work by Gary Leavens https://www.cs.ucf.edu/~leavens/ui54/docs/typedscm_toc.html

or with typed-racket

And I didn't like any of them.

When I started using Kawa, it was the first time when I was really satisfied with a type system for Scheme, at least notation-wise. There are certain capabilities, like - in particular - support for generics, or more advanced type inference, that are missing from that type system. But given that type expressions are potentially macro-expanded, I don't find that to be an urgent problem.

Now, when it comes to your proposal, it doesn't address any of those issues. It doesn't provide type-inference. If I'm getting it right, it is perhaps a slightly more compact notation for a particular use of runtime assertions, but it's still much more verbose than lack of type signatures (that Haskell and ML can boast due to type inference) or what Kawa has to offer.

One advantage that I can see is that it can be used with most Scheme implementations. But it requires me to write code that I wouldn't want to write, and that I don't want to have to write.
Vassil Nikolov | Васил Николов · 5w
I, for one, like it that "multiple-value-" is spelled out in full. This kind of naming convention has advantages. Myself, I am in a different kind of trouble, trying to remember which returns multiple...
Panicz Maciej Godek profile picture
@nprofile1q... personally I'm not a fan of the concept of multiple values, but if I am to work with them, I much prefer SRFI-72-style let* forms than all alternatives that I've seen.

(Also, the code from lambda-papers doesn't even use the "let" forms - perhaps they weren't yet invented back then? and I personally find it very hard to read)
Kartik Agaram · 5w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpq4rvx632dlvqthkn3a7uacmcklf7peee89dg6hjkn9ntdlwxzg97qgwcdda Doesn't quite capture the conditional nature. Maybe when-given?
Panicz Maciej Godek profile picture
@nprofile1q...

I think that

(given (((isnt x null?))) something-something)

naturally corresponds to "given that x isn't null" in English, and

(given ((x 5)) blah)

could be read as "given x to be 5", and that those two usages from English correspond nicely to the two fundamental cases of and-let*.

Also, clearly

(given ((something (get-something)))
(do something))

shouldn't do anything when something is nothing (i.e. when it wasn't given) 🤪
1
Shane Celis · 5w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpq4rvx632dlvqthkn3a7uacmcklf7peee89dg6hjkn9ntdlwxzg97qgwcdda nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqs5arew84aktld949hmunlrnvt0cs7d5zvrkvv9wg0mfnnmh46lnqsmfr3t I like it but I'd want it as an alias because the and-let tells me more ...
Panicz Maciej Godek profile picture
I've been a keen user of the "and-let* macro defined in the SRFI-2. I've even authored its sequel, SRFI-202.

But I never really liked the name.
I mean, it does reveal that conceptually it's an amalgam of "and" and "let*. But as a word to be used in a language, it's rather clumsy.

(In this regard it resembles "multiple-value-bind" from Common Lisp. OK, it does bind multiple values, but that's not a handy word. It's as if "progn" from Common Lisp was "evaluate-forms-in-order. I mean, "progn" is already a bad name compared to Scheme's "begin", but)

In either case, today I had a small revelation. I mean, I've been thinking about the right name for "and-let*" for many years, so moments like this don't happen very often.

So, ladies and gentlemen, who - like me - are disappointed with the name of the "and-let*" macro, even though you find the macro itself useful, let me present a better alternative:

given

You're welcome.
2
Kartik Agaram · 5w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpq4rvx632dlvqthkn3a7uacmcklf7peee89dg6hjkn9ntdlwxzg97qgwcdda Doesn't quite capture the conditional nature. Maybe when-given?
Vassil Nikolov | Васил Николов · 5w
I, for one, like it that "multiple-value-" is spelled out in full. This kind of naming convention has advantages. Myself, I am in a different kind of trouble, trying to remember which returns multiple values and which returns a list: `multiple-value-list' `values-list' By the way, given my ignoranc...
Panicz Maciej Godek profile picture
I recently got back to my work on literate #GRASP, and I think things finally started to look good. I implemented a new document representation (the previous one was built from cons-cells and multiple hacks), and I have some working tests that are capable of rendering this representation to "unicode-art" strings, and I'm currently working on a new parser that would work well with that representation.

I still have a long way to go before I get a running system, and I don't think it's a very good literature, but if you're a #Scheme maniac or a fan of #LiterateProgramming and you don't find the #Java runtime environment too repulsive, I invite you to follow the work and provide your feedback:

https://github.com/panicz/grasp/blob/main/literate/grasp.org

(the document is written in #Emacs #OrgMode using its #noweb component for literate programming)
1
Panicz Maciej Godek · 7w
I tried reading Knuth's "TeX: The Program", and probably (or most certainly) that's subjective, but I find the literate GRASP document so much more engaging to read
Artyom Bologov · 7w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpq4rvx632dlvqthkn3a7uacmcklf7peee89dg6hjkn9ntdlwxzg97qgwcdda I like the plotting idea, piano roll is slightly weirder 🤔