schemeguile

Is there a way to run guile function from command line


So I have a simple file.scm file with following code in it:

#!/usr/bin/guile -s 
!#
(define (printer arg)
  (display arg))

I know you can execute it inside guile repl by doing a (load "file.scm"), and then by invoking the function like (printer "this").

Is there is any way to run that function through the command-line terminal such as guile "file.scm" (printer "this") ?


Solution

  • According to the manual, something like

    guile -l file.scm -c '(printer "this")'
    

    will work.