File: table.scm

package info (click to toggle)
snd 26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,028 kB
  • sloc: ansic: 291,903; lisp: 260,506; ruby: 71,134; sh: 3,293; fortran: 2,342; csh: 1,067; makefile: 294; cpp: 294; python: 87; xml: 27; javascript: 1
file content (29 lines) | stat: -rwxr-xr-x 808 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(define (no-dashes-or-cr str)
  (do ((len (length str))
       (newstr "")
       (last-ch #\-)
       (i 0 (+ i 1)))
      ((= i (- len 1)) 
       newstr)
    (let ((ch (string-ref str i)))
      (if (and (or (not (char=? ch #\-))
		   (char-alphabetic? last-ch))
	       (not (char=? ch #\newline)))
	  (set! newstr (string-append newstr (make-string 1 ch))))
      (set! last-ch ch))))

(let ((ctr 0))
  (call-with-input-file 
      "snd-test.scm"
    (lambda (file)
      (let loop ((line (read-line file #t)))
	(set! ctr (+ ctr 1))
	(or (eof-object? line)
	    (let ((len (length line)))
	      (if (and (> len 30)
		       (string=? ";;; ---------------- test "
				 (substring line 0 26)))
		  (format () "~A ~48,1T[~D]~%" (no-dashes-or-cr line) ctr))
	      (loop (read-line file #t))))))))

(exit)