unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* command line args to guile
@ 2003-03-07 15:59 Rick Taube
  2003-03-07 18:12 ` Paul Jarc
  0 siblings, 1 reply; 4+ messages in thread
From: Rick Taube @ 2003-03-07 15:59 UTC (permalink / raw)


im trying to start guile and have it both eval an expr and load files 
when it starts.
is there a command switch like -c  that will eval an expression but NOT 
exit guile?
when i do guile --help i dont see it. id like to do something like:

% guile -c '(define foo 1)' -l "bar.scm" -l "bif.scm"
guile> foo
1

so that the define happens before the loading.
but the -c  switch exits.


I then tried working with the -e option that takes a function but i 
guess i do not understand
how to notate a lambda expr from the shell:

% guile -e '(lambda args (display args))'
ERROR: Unbound variable: #{\(lambda\ args\ \(display\ args\)\)}#

im not sure how to notate it so that guile reads it as a lambda  expr 
and calls it.
any help would be appreciated!
best,
rick taube




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: command line args to guile
  2003-03-07 15:59 command line args to guile Rick Taube
@ 2003-03-07 18:12 ` Paul Jarc
  2003-03-07 19:21   ` Rick Taube
  2003-03-07 22:56   ` Marius Vollmer
  0 siblings, 2 replies; 4+ messages in thread
From: Paul Jarc @ 2003-03-07 18:12 UTC (permalink / raw)
  Cc: guile-user

Rick Taube <taube@uiuc.edu> wrote:
> when i do guile --help i dont see it. id like to do something like:
>
> % guile -c '(define foo 1)' -l "bar.scm" -l "bif.scm"
> guile> foo
> 1

You can do this:
$ guile -c '(define foo 1) (load "bar.scm") (load "bif.scm")'
But I don't know how to start the REPL from Scheme code.

If your shell does process substitution, you could avoid -c, so that
guile will start the REPL as usual:
$ guile -l <(echo '(define foo 1)') -l bar.scm -l bif.scm

> I then tried working with the -e option that takes a function but i
> guess i do not understand
> how to notate a lambda expr from the shell:
>
> % guile -e '(lambda args (display args))'
> ERROR: Unbound variable: #{\(lambda\ args\ \(display\ args\)\)}#

-e takes a *name* of an existing function, not an expression that
evaluates to a function.  It's not what you want here.  This works:
$ guile -c '(display (program-arguments)) (newline)'
(guile)

And this will print the arguments, and then start the REPL:
$ guile -e display -- args ...
(guile args ...)guile> 


paul


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: command line args to guile
  2003-03-07 18:12 ` Paul Jarc
@ 2003-03-07 19:21   ` Rick Taube
  2003-03-07 22:56   ` Marius Vollmer
  1 sibling, 0 replies; 4+ messages in thread
From: Rick Taube @ 2003-03-07 19:21 UTC (permalink / raw)
  Cc: guile-user

thank you for the nice workaround, unfortunately my shell does not do 
the < substution so i cant use the method you suggest.  Guile could 
really use an additional switch that evals an expr but does not quit!  
I guess ill have to generate a file with my expressions and then -l 
that.



> If your shell does process substitution, you could avoid -c, so that
> guile will start the REPL as usual:
> $ guile -l <(echo '(define foo 1)') -l bar.scm -l bif.scm
>
> id like to do something like:
>
> % guile -c '(define foo 1)' -l "bar.scm" -l "bif.scm"
> guile> foo
> 1

On Friday, Mar 7, 2003, at 12:12 America/Chicago, Paul Jarc wrote:

> Rick Taube <taube@uiuc.edu> wrote:
>> when i do guile --help i dont see it. id like to do something like:
>>
>> % guile -c '(define foo 1)' -l "bar.scm" -l "bif.scm"
>> guile> foo
>> 1
>
> You can do this:
> $ guile -c '(define foo 1) (load "bar.scm") (load "bif.scm")'
> But I don't know how to start the REPL from Scheme code.
>
> If your shell does process substitution, you could avoid -c, so that
> guile will start the REPL as usual:
> $ guile -l <(echo '(define foo 1)') -l bar.scm -l bif.scm
>
>> I then tried working with the -e option that takes a function but i
>> guess i do not understand
>> how to notate a lambda expr from the shell:
>>
>> % guile -e '(lambda args (display args))'
>> ERROR: Unbound variable: #{\(lambda\ args\ \(display\ args\)\)}#
>
> -e takes a *name* of an existing function, not an expression that
> evaluates to a function.  It's not what you want here.  This works:
> $ guile -c '(display (program-arguments)) (newline)'
> (guile)
>
> And this will print the arguments, and then start the REPL:
> $ guile -e display -- args ...
> (guile args ...)guile>
>
>
> paul
>
>
> _______________________________________________
> Guile-user mailing list
> Guile-user@gnu.org
> http://mail.gnu.org/mailman/listinfo/guile-user
>



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: command line args to guile
  2003-03-07 18:12 ` Paul Jarc
  2003-03-07 19:21   ` Rick Taube
@ 2003-03-07 22:56   ` Marius Vollmer
  1 sibling, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2003-03-07 22:56 UTC (permalink / raw)
  Cc: guile-user

prj@po.cwru.edu (Paul Jarc) writes:

> You can do this:
> $ guile -c '(define foo 1) (load "bar.scm") (load "bif.scm")'
> But I don't know how to start the REPL from Scheme code.

Try

  $ guile -c '(begin (define foo 1) (top-repl))'
  guile> foo
  1
  guile>

The function top-repl will run the normal repl.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-07 22:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-07 15:59 command line args to guile Rick Taube
2003-03-07 18:12 ` Paul Jarc
2003-03-07 19:21   ` Rick Taube
2003-03-07 22:56   ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).