On this page:
tee-pipe

Tee Pipe

Haiwei Zhou <highfly22@gmail.com>

 (require (planet haiwei/tee-pipe:1:=0/tee-pipe))

procedure

(tee-pipe in handler ...)  list?

  in : input-port?
  handler : (-> input-port? any)
Returns a list of handler results.

Examples:

> (tee-pipe (open-input-string "123\nabc\nABC")
            port->string
            port->lines)

'("123\nabc\nABC" ("123" "abc" "ABC"))

> (tee-pipe (open-input-string "123\nabc\nABC")
            port->string
            port->lines
            port->bytes)

'("123\nabc\nABC" ("123" "abc" "ABC") #"123\nabc\nABC")

> (tee-pipe (open-input-string "123\nabc\nABC")
            port->string
            port->lines
            string-length)

(list

 "123\nabc\nABC"

 '("123" "abc" "ABC")

 (exn:fail:contract

  "string-length: contract violation\n  expected: string?\n  given: #<input-port:pipe>"

  #<continuation-mark-set>))