chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Keep `csi` open after reading from pipe


From: .alyn.post.
Subject: Re: [Chicken-users] Keep `csi` open after reading from pipe
Date: Mon, 20 Jan 2014 19:38:40 -0701

I believe the typical way to do this is to include the file after
you load csi:

  $ cat my-input-file.scm
  (define (doit)
    (display "hello world")
    (newline))
  $ csi
  #;1> (include "my-input-file")
  ; including my-input-file.scm ...
  #;2> (doit)
  hello world
  #;3>

If you don't want to type (include ...) every time you load csi, you
can (load ...) it in your ~/.csirc file.  In the event of a syntax
error in that file, you can use |csi -n| to start csi without loading
your ~/.csirc.  Since this is a common scenario, you may want to
continue in the event of an error in your input file.  The example
below emulates the default Chicken Scheme exception handler, but
continues the interpreter:

  $ cat ~/.csirc
  (handle-exceptions
    exn
    (with-output-to-port
      (current-error-port)
      (lambda ()
        (print-error-message exn)
        (print-call-chain)))
    (load "my-input-file"))
  $ cat my-input-file.scm
  (define (doit)
    (display "hello world"
    (newline))
  $ csi

  Error: (line 4) unterminated list, starting in line 1

          Call history:
          ...
  #;1> (doit)


On Mon, Jan 20, 2014 at 08:41:32PM -0500, Quint Guvernator wrote:
> Hello All,
> 
> I am not subscribed to this list, so please CC me if you respond.
> 
> I am trying to find a way to keep the chicken scheme interpreter open
> even after it finishes running my input file (via a unix pipe) so I
> can play with the functions I define in the interpreter. Is there a
> simple solution?
> 
> Cheers,
> Quint
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users

-- 
my personal website: http://c0redump.org/



reply via email to

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