-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bottom Scheme Discussion (was: BottomScheme has read-char and write-char, but not chars) #35
Comments
My intention is that |
Related to Bottom Scheme, there is now https://github.com/jrincayc/r7rs-pico-spec |
I guess it depends on how compatible you want Bottom Scheme to be. As is, if strings of length 1 is used I don't think there is a easy way to write code that would work in both R7RS and Bottom Scheme that uses read-char and write-char. (Tho' if you add My personal opinion would be to either add characters to Bottom Scheme or use |
I tend to agree with John that characters are a data type of dubious value. Emacs Lisp was designed for a text editor and it uses only integers and strings. |
BTW a truly minimal Scheme should perhaps have only |
Hm, how about this possible set of changes to Bottom Scheme:
(I am willing to make a pull request to change to this if anyone wants me to.) |
R6RS has:
What if Bottom Scheme had Shouldn't an ultra-minimal Scheme have users write their own |
(define (display obj)
(cond ((string? obj)
(for-each write-u8 (string->u8-list obj)))
((number? obj)
(display (number->string obj)))
(else
...))) |
Well, Bottom Scheme already has byte vectors :) |
Somewhat off topic, but this is how I see various scheme(ish) specifications/implementations
I think there is definitely space in the middle for another specification. I think one interesting goal would be to make a minimal scheme that had enough features to be self-hosting, but otherwise was pretty minimal. I think Bottom Scheme is pretty close to that (I think a bit more IO including ports, |
Indeed! Subsetting and self-hosting are two areas where Scheme is especially strong. I've also toyed with a "tower" approach to Scheme, and have some interesting leads but no outcome yet. One of them is that you can make almost anything out of tagged vectors. (Where vector = general vector or homogeneous numeric vector.) If you give up pairs and make lists be vectors instead, the implementation doesn't need any other aggregate data type. You ought to enjoy https://github.com/udem-dlteam/ribbit. It's based on the "rib" data structure and has a clever GC. See also https://www.gnu.org/software/mes/ |
Hm, if it doesn't have pairs, I think we are getting into a different language than Scheme, but the results might be interesting. And yes, ribbit and mes are interesting. |
I've done a fair bit of exploration on Lisp-without-pairs, and especially Scheme-without-pairs. It works very well. It retains the essential nature of Lisp/Scheme. I'll publish a SRFI about Vector Scheme with a sample implementation when I can find the time. (I have a running interpreter written in C, but it has to be polished.) More generally, Array Lisp / Array Scheme (where lists are vectors are arrays) works fine. Making homogeneous vectors a subtype of vector works fine too. In such a Lisp, the list type is the same as the general vector type. So RnRS vectors would be lists, but SRFI 4 vectors would not be lists. Furthermore, you can add linked lists to a Vector Lisp or Array Lisp. In such a Lisp, pair and null don't belong to the "list" type, but they do belong to the "linked list" type. This works out naturally, too. Intuitively, in any Lisp, the "list" type is whichever type is created by typing unadorned parentheses The consing dot |
The icing on the cake is that you can write reams of code which are oblivious to whether the underlying list type is a linked list, a vector, or an array! Given sufficient time, I plan to exploit this to the fullest. Lots of non-functional languages have a vector type that's far more efficient and easier to use than linked lists (for which you might have to roll your own datatype). Writing a Lisp or Scheme implementation hosted on these languages, it'd be natural for vectors to be the native list type on the Lisp side to match the situation on the host side. |
Not really. You'd just make the dot an identifier with a special meaning in
In Twinjo, the ASN.1 sequence type is bound to proper lists in Lisp and vectors in other languages. Lisp vectors are bound to a protocol-specific type In the 2-Lisp language (not to be confused with Lisp 2, an early Lisp with Algol syntax, or Lisp-2, a Lisp like CL with separate function and value namespaces), the basic sequence type is called rails, and is notated |
Ah, that would work. I didn't think of that. In standard Scheme, I opened a separate issue about Twinjo's sequence types. How old is 2-Lisp and where can we find information on it? Are rails always "proper"? |
The patch removing Bottom Scheme is intended to be, as the document says, easy to compile to C or machine language, so I kept bytevectors. If you want to do without them, just use vectors instead. |
2-Lisp is described in Chapter 4 (pp. 253-571) of Brian Cantwell Smith's massive dissertation. The discussion of rails begins on p. 265. The implementation of rails in Maclisp (essentially CL) is documented on p. 714; the code is on pp. 729-730. There are occasional references to 1-Lisp, which is essentially Scheme with fexprs (spelled "imprs") and CL macros; notationally it is closer to CL ( |
Thank you for digging up the reference, very interesting! |
GNU R is prior art for "lists are general vectors". From the manual:
|
BottomScheme has
read-char
andwrite-char
, but not the char type, which would probably result in strange incompatibilities.For example, in R7RS,
(write-char (substring "abc" 1 2))
is an error, but I think as BottomScheme is specified, that is the correct way to print part of a string.If compatibility with R7RS is desired, I think using
write-string
andread-string
might be better.The text was updated successfully, but these errors were encountered: