chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[chicken-users] further match-lambda* weirdness


From: Leonardo Valeri Manera
Subject: [chicken-users] further match-lambda* weirdness
Date: Fri, 14 Mar 2008 13:38:02 +0100

This code works correctly in csi, but the first case errors out when
compiles to an .so, even with -run-time-macros

(use posix utils match)

;;; Reads a list of lines for a pipe.
;;; Returns the output of the pipe, as a list of strings.
;;; Usage is the same as the chicken (process) function.
(define read-pipe
  (match-lambda*
   [((? atom? commandline))
    (call-with-input-pipe commandline read-lines)]
   [((? atom? command) ((? atom? args) ...))
    (let-values ([(input output pid) (process command args)])
      (process-wait pid)
      (close-output-port output)
      (with-input-from-port input read-lines))]
   [((? atom? command) ((? atom? args) ...) ((? atom? env) ...))
    (let-values ([(input output pid) (process command args env)])
      (process-wait pid)
      (close-output-port output)
      (with-input-from-port input read-lines))]))

In csi I get:

#;1> (load "utility-functions")
; loading utility-functions.so ...
#;2> (read-pipe "ls")
Error: unbound variable: command

        Call history:

        <syntax>                (read-pipe "ls")
        <eval>          (read-pipe "ls")
        utility-functions.scm: 24   with-input-from-pipe                        
<--

Gbwah? :(

Cheers,
Leo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]