Skip to content

Commit

Permalink
make code fit into smaller screens
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 25, 2024
1 parent 572c0bf commit da38ea4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/docs/scheme-intro/input-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ You can simplify this function by using `for-each` higher order procedure.

```scheme
(define (write-lines lst . rest)
(for-each (lambda (line) (apply write-line line rest)) lst))
(for-each (lambda (line)
(apply write-line line rest))
lst))
```

You can use this with `call-with-output-file`:
Expand All @@ -245,7 +247,8 @@ You can use this with `call-with-output-file`:
(write-lines beatles port))))
(read-lines "test-3.scm")
;; ==> ("John Lennon" "Paul McCartney" "Ringo Starr" "George Harrison")
;; ==> ("John Lennon" "Paul McCartney"
;; ==> "Ringo Starr" "George Harrison")
```

You can also write to standard output when you omit the port:
Expand Down

0 comments on commit da38ea4

Please sign in to comment.