'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 1:[1]

According to the manual, something like

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

will work.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shawn