Welcome to the CHICKEN Scheme pasting service

Haunted function added by Reid on Wed Aug 26 20:31:44 2026

(define (exec cmd #!optional
              (input "")
              (reader (cute read-string #f <>)))
  (let-values (((pout pin pid)
                (cond-expand
                  (chicken-6
                    (let ((proc (cond ((string? cmd) (process cmd))
                                      ((list? cmd) (process (car cmd) (cdr cmd)))
                                      (else (error "The command must be a list or a string")))))
                      (values (process-output-port proc)
                              (process-input-port proc)
                              (process-id proc))))
                  (chicken-5
                    (cond ((string? cmd) (process cmd))
                          ((list? cmd) (process (car cmd) (cdr cmd)))
                          (else (error "The command must be a list or a string")))))))
    (cond-expand
      (chicken-6 (write-string input pin))
      (chicken-5 (write-string input #f pin)))
    (close-output-port pin)
    (let ((output (reader pout)))
     (close-input-port pout)
     output)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which procedure can be used to check whether its argument is a string?
Visually impaired? Let me spell it for you (wav file) download WAV