~ chicken-core (chicken-5) 7ce8688f0b948c0385c6b5109e172fcb3be43dd6


commit 7ce8688f0b948c0385c6b5109e172fcb3be43dd6
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Wed Jan 20 22:22:29 2016 +1300
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Tue Mar 8 22:52:34 2016 +1300

    Drop filename argument handling from "read-lines"

diff --git a/extras.scm b/extras.scm
index a9421f83..6a12683b 100644
--- a/extras.scm
+++ b/extras.scm
@@ -90,24 +90,16 @@
 				(loop (fx+ i 1)) ] ) ) ) ) ) ) ) ) ) ) ) )
 
 (define read-lines
-  (lambda port-and-max
-    (let* ((port (if (pair? port-and-max) (##sys#slot port-and-max 0) ##sys#standard-input))
-	   (rest (and (pair? port-and-max) (##sys#slot port-and-max 1)))
-	   (max (if (pair? rest) (##sys#slot rest 0) #f)) )
-      (define (doread port)
-	(let loop ((lns '())
-		   (n (or max 1000000000)) ) ; this is silly
-	  (if (eq? n 0)
-	      (##sys#fast-reverse lns)
-	      (let ((ln (read-line port)))
-		(if (eof-object? ln)
-		    (##sys#fast-reverse lns)
-		    (loop (cons ln lns) (fx- n 1)) ) ) ) ) )
-      (if (string? port)
-	  (call-with-input-file port doread)
-	  (begin
-	    (##sys#check-input-port port #t 'read-lines)
-	    (doread port) ) ) ) ) )
+  (lambda (#!optional (port ##sys#standard-input) (max most-positive-fixnum))
+    (##sys#check-input-port port #t 'read-lines)
+    (let loop ((lns '())
+	       (n (or max 1000000000))) ; this is silly
+      (if (or (eq? n 0))
+	  (##sys#fast-reverse lns)
+	  (let ((ln (read-line port)))
+	    (if (eof-object? ln)
+		(##sys#fast-reverse lns)
+		(loop (cons ln lns) (fx- n 1))))))))
 
 (define write-line
   (lambda (str . port)
diff --git a/manual/Unit extras b/manual/Unit extras
index 23ff690b..c1f2b142 100644
--- a/manual/Unit extras	
+++ b/manual/Unit extras	
@@ -163,9 +163,10 @@ characters per line. {{read-line}} returns a string without the terminating newl
 
 <procedure>(read-lines [PORT [MAX]])</procedure>
 
-Read {{MAX}} or fewer lines from {{PORT}}. {{PORT}}
-defaults to the value of {{(current-input-port)}}. {{PORT}} may optionally be
-a string naming a file. Returns a list of strings, each string representing a line read, not including any line separation character(s).
+Read {{MAX}} or fewer lines from {{PORT}}. {{PORT}} defaults to the
+value of {{(current-input-port)}}. Returns a list of strings, each
+string representing a line read, not including any line separation
+character(s).
 
 
 ==== read-string
diff --git a/types.db b/types.db
index c0e7bbda..670d9bee 100644
--- a/types.db
+++ b/types.db
@@ -1529,7 +1529,7 @@
 (chicken.io#read-buffered (#(procedure #:enforce) chicken.io#read-buffered (#!optional input-port) string))
 (chicken.io#read-byte (#(procedure #:enforce) chicken.io#read-byte (#!optional input-port) *))
 (chicken.io#read-line (#(procedure #:enforce) chicken.io#read-line (#!optional input-port (or false fixnum)) (or eof string)))
-(chicken.io#read-lines (#(procedure #:enforce) chicken.io#read-lines (#!optional (or input-port string) fixnum) (list-of string)))
+(chicken.io#read-lines (#(procedure #:enforce) chicken.io#read-lines (#!optional input-port fixnum) (list-of string)))
 (chicken.io#read-string (#(procedure #:enforce) chicken.io#read-string (#!optional (or fixnum false) input-port) string))
 (chicken.io#read-string! (#(procedure #:enforce) chicken.io#read-string! ((or fixnum false) string #!optional input-port fixnum) fixnum))
 (chicken.io#read-token (#(procedure #:enforce) chicken.io#read-token ((procedure (char) *) #!optional input-port) string))
Trap