-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 12 SRFI-1 procedures and more thorough check of list mutability
- Loading branch information
Showing
26 changed files
with
1,068 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9aadef4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting. One idea that came to mind:
Now that you've implemented some "bang" procedures using
set-car!
andset-cdr!
, you naturally require the associated pairs to be mutable. (And not all pairs in the list, just some.)If the "bang" procedures had simply been implemented the same as the non-"bang" procedures then you wouldn't need mutability of the pair. So your implementation choice turns what might be a non-error in another implementation of the library into an error in this implementation of the library.
I don't remember this coming up in the SRFI 1 discussion (so many years ago!). The term "mutable" does not appear in the text of the SRFI specification.
9aadef4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked Racket's SRFI libraries at https://github.com/racket/srfi
The
!
routines from Olin's code are commented out, with notes that lists are immutable in Racket; the!
routines are just renamed from the non-!
versions.That makes sense for Racket; I'm not sure yet what makes sense for Gambit.
9aadef4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And Olin's original code for
filter!
(or any other!
routine that takes a predicate) is not call/cc-safe.Edit: But now I realize that all the discussion of "linear update" procedures in SRFI 1 is for this case---if a predicate captures the continuation that has a reference to one of the list arguments, then it's not programming in a "linear update" way.