On Thu, Jul 12, 2012 at 6:21 AM, David A. Wheeler <dwhee...@dwheeler.com> wrote:
>> New bundle time!
>
> Awesome!
>
>> First bundle: 2012-07-11-almkglor-comment-only.bundle - just
>> additional comments, plus a no-op change in modern.scm (a bugfix in a
>> part of the code that never gets called anyway)
>
> All in.
>
>> Second bundle: 2012-07-11-almkglor-SPLIT.bundle - dependent on first
>> bundle.  Implements SPLIT, as I envision it in use.  Also updates
>> example/streams.scm, to show SPLIT in action.
>
> Cool.  SPLIT was easier to implement than I expected.  I added a few tests to 
> the test suite, to test SPLIT.
>
> NB: I think we *should* have split-like functionality, but we haven't 
> committed to this particular semantic.  However, I've accepted this patch 
> anyway because this will be *GREAT* for experimentation.


Actually, just now, I found a bug:

\
  x y
  z w

===>

((x y) (z w))

--

\
  x y

===>

(x y)

---

The culprit seems to be what readblock-clean in line 260 does:  if (=
(length block) 1) ....

Currently, the solution I'm thinking of is to hack group.

line 66
(define group (cons '() '())) ; all cons cells are unique in terms of eq?

line 144:

( (eq? (car line) group) ; check our special tag group which is used
to fix SPLIT-by-itself
 ...

line 221 and on:

  ; SPLIT-at-start: ignore SPLIT if occurs first on line
  (if (eqv? (peek-char port) #\newline) ;or some other EOL marker like
(integer->char 13)
    ; specially handle \ on a line by itself so that
    ; clean doesn't unwrap it.
    (let* ((sub-read (readblock level port))
          (outlevel (car sub-read))
          (sub-expr (cdr sub-read))
      (if (and (null? sub-expr) (string=? outlevel level))
        ; blank SPLIT, just recurse *** this is a new feature:
        ; \
        ; \
        ; x
        ; ==> x, not () () x
        (readblock level port)
        ; non-blank SPLIT - insert our group tag
        ; this hack handles the case of:
        ; \
        ;   x y
        ; as otherwise the outer readblock-clean
        ; will convert one-element lists to
        ; that single element.
        (cons outlevel (cons group sub-expr))))
    ; not by itself
    (readblock-internal level port first-item?))

I need to go to work, so I'll do it some 8~12 hours from now
(notwithstanding that the code already exists, haha)

Sincerely,
AmkG

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to