I didn't have time to get into this SRFI back when it was being discussed.I happened to have an application that could benefit from it, so I dug myself in for the past few weeks. Overall, I'm quite happy with the concept, the compose-ability, & the laziness.I found & fixed lots of bugs to make it work better on my own Scheme as well as chibi.I forked chibi and added my commits to https://github.com/jimrees/chibi-scheme . I have made no other commits to that fork unrelated to (srfi 159) / (chibi show).
(srfi 130) dependency: the sample implementation relies on (chibistring) which isn't quite (srfi 130):
The show sample implementation relies on:(string-cursor-next str (string-cursor-end str)) ==> (string-cursor-end str)...being able to call substring-cursor (substring/cursors) with only two arguments....being able to call substring (from (scheme base)) with only two arguments....being able to call string-cursor{<,<=,=,>=,>}? without the first string argument.I was able to add a compatability layer to get around these dependencies for myself. These have not been committed by my fork.
The documented test case for space-to shows an incorrect number of spaces.Given the rule that columns are zero-based, the length of the followingstring should be 6.(show #f "a" (space-to 5) "b")
padded vs padded/left vs padded/right code vs. documentThere is still confusion here.Document says padded means padded/left.Code & tests say padded means padded/right.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; forked vs. fn-forkedDocumentation says forked.
Documentation discrepancies:1) The third test case (numeric/si 608 " ") is missing a base,sticking 1000 or 1024 both work.
2) The code rounds to one extra decimal place. One test exampledepends on rounding to 1 place, while the last two depend on roundingto two places.
3) The "micro" character in the SRFI document for the last two testcases are actually U+03BC, Greek Letter Mu. The sample implementationuses "micro" U+00B5.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; state variable WRITER, defaults to WRITTEN per the documentation.But this implies WRITTEN serves as a default implementation forwriting, but the exact opposite is true. WRITTEN applies the valueof WRITER, which defaults to #f, or WRITTEN-DEFAULT.It would be safer to say that WRITTEN applies the WRITER variable, whosedefault is implementation-specific.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; state variable DECIMAL-SEP, the doc says it defaults to "."This is not quite accurate. It defaults to #f.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; numeric default behavior with unusual radix'es:(numeric foo 10 #f) invokes (number->string foo 10) which for aninexact real is required by R7RS to print a minimal number of decimalplace to unabiguously represent the value.So, then it follows that (numeric foo radix) (with precision == #f) shouldgenerate distinct strings for distinct inexact values of foo for every radix.;; 1) number->string fails to do this in chibi for radix 10(import (srfi 144))(number->string (fladjacent 1.0 0.0)) ==> "1.0"(number->string (fladjacent 1.0 2.0)) ==> "1.0"
;; 2) numeric fails to do this for all the other radixes(show #f (numeric (fladjacent 1.0 0.0) 9)) ==> "1.0"(show #f (numeric (fladjacent 1.0 2.0) 9)) ==> "1.0"