Questions tagged [guile]

GNU Guile is the GNU project's official plugin infrastructure. Guile typically refers to the Scheme front-end which Guile provides.

GNU Guile is the GNU project's official plugin infrastructure. It is intended to be plugged into applications through libguile, but can also be run as a standalone Scheme interpreter.

Guile has a few front-end languages:

  • Scheme, supporting R5RS fully and some of R6RS (the default)
  • EmacsLisp
  • ECMAScript, which has some implementation, but is not completed
  • Lua, which is planned but as of yet nonexistant

Guile has support for modules outside of the core system, which allow for things that are either at SRFI status, or not implemented in Guile's core. See the list of included modules for exactly what the bundled modules do.

Guile has extensive documentation which is hosted here. It contains details on both embedding Guile into applications as well as its features at the language level.

There is also a tutorial that explains step-by-step how to use guile in a straightforward Logo-like ("turtle graphics") application.

261 questions
3
votes
1 answer

Read a line from a file

I'm trying to figure out how to read a line from a file with guile scheme. When I ask it to "read port" or "read-char port", it successfully reads. guile -c '(let ((port (open-input-file "foo.txt"))) (display (read port)) (newline) (close-port…
user6189164
  • 667
  • 3
  • 7
3
votes
1 answer

guile macro indentation in emacs

Is there something like (declare (indent defun)) for guile so indentation of user-defined macros works like defines? For example, if I write the following macro, (define-syntax my-when (syntax-rules () ((my-when condition exp ...) (if…
Rorschach
  • 31,301
  • 5
  • 78
  • 129
3
votes
1 answer

Unbound variable 'trace'

I'm trying to use the guile function trace, but every time I do, I get a possible unbound variable. scheme@(guile-user)> (define (fact1 n) (if (zero? n) 1 (* n (fact1 (- n 1))))) scheme@(guile-user)> (trace fact1) ;;; :4:0: warning: possibly…
AmaCode
  • 143
  • 1
  • 7
3
votes
2 answers

How to use console as input and output for Guile Scheme?

I understand that Scheme uses ports to perform Input and Output. While trying to learn how to get console input and output, I have come across MIT-Scheme's console-i/o-port variable. But, the guile interpreter says it is an Unbound Variable. I would…
Tarun Maganti
  • 3,076
  • 2
  • 35
  • 64
3
votes
1 answer

scheme: Wrong type argument in position

I'd really appreciate it if some-one can help with this. I've been banging my head for a day trying to get this to work. I've searched the internet and reread the manual but I just don't understand. guile << __EOF__ ( define heading-list (list 'a…
Chris Good
  • 156
  • 10
3
votes
1 answer

configure: error: GNU libltdl (Libtool) not found, see README

I'm trying to install GNU Guile so that I can later install Guix. My environment is pretty locked down, but they do allow us build tools. I've been trying to get pianobar installed for the past few days, and it works, but I get the output "Cannot…
ijustlovemath
  • 703
  • 10
  • 21
3
votes
1 answer

gnu/libtool (libltdl) installed but not found by configure script

I am trying to install guile locally on a system. It requires gnu/libtool. While installing all its dependencies, the "make check" command showed errors while installing gnu/libtool. But if I omitted the command and simply ran "make" followed by…
Python_user
  • 1,378
  • 3
  • 12
  • 25
3
votes
4 answers

decent way of nested definition in scheme

I want to define a constant foo using an auxiliary function, say, bar. And I want to hide bar inside the definition of foo, so I come with this code: (define foo (define (bar n) (+ n n)) (bar 1)) However, this definition causes syntax…
Javran
  • 3,394
  • 2
  • 23
  • 40
2
votes
2 answers

How to check if a symbol is a procedure or not

Im trying to write a macro that checks a list to see if there is a procedure call, but im not quite sure how to go about it. The first thing that comes to my head is to use the procedure? function to check, but it doesnt work. An example of what im…
Wonger
  • 285
  • 6
  • 18
2
votes
1 answer

early exiting a recursive procedure

Watching this video (11:56) It shows a recursive procedure that multiplies the numbers contained in a list The idea is that if the list contains a zero, the whole stack of recursive calls can be discarded and 0 can be returned So to save some…
user1632812
  • 431
  • 3
  • 16
2
votes
4 answers

Why do list-tail raise-exception? Why do we haven't closure property with respect to cdr?

If you evaluate (list-tail '(1 2) 3) at guile scheme. You will get an exception. It would be smarter to have an '() as answer. Overall why do we haven't closure property with respect to cdr combinator? What complications may arise? Examples to make…
2
votes
3 answers

Nested ellipsis macro doesn't work in Guile and Racket

I'm trying to create a simple nested macro. It works in my Scheme implementation, but fails to run in Guile and Racket. (define-syntax foo (syntax-rules (:c) ((_ x ...) (let-syntax ((bar (syntax-rules ::: (:c) ((_…
jcubic
  • 61,973
  • 54
  • 229
  • 402
2
votes
3 answers

Performance Impact of Creating Enclosed Procedure in Scheme During Recursion

I'm making my way through the book The Little Schemer to start to learn to think in Lisp. As you get into it and really cover the use of lambdas, the 'remove' procedure is written in the following general form, which returns a remove procedure for…
2
votes
1 answer

Need help reducing the boilerplate in my Scheme macro

I'm working in Guile Scheme. I'm making macros but I'm finding that I'm repeating a lot of boilerplate in my output. I'm fairly new to Scheme so if there's a better way to approach this than syntax-case I'm open to advice. In this macro there's only…
rr_cook
  • 136
  • 4
2
votes
1 answer

Suppress indirect leaks caused by third party libraries

I have this very simple C code calling a scheme script with guile: /* main.c */ #include int main(void) { scm_init_guile(); scm_c_primitive_load("script.scm"); SCM func = scm_variable_ref(scm_c_lookup("func")); …
David Ranieri
  • 39,972
  • 7
  • 52
  • 94