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
2
votes
1 answer

Linking guile to Rcpp

I am trying to link guile to an Rcpp file. It seems like things compile but there is an error when loading: sourceCpp("test_2.cpp", rebuild = TRUE, showOutput = TRUE) /usr/lib/R/bin/R CMD SHLIB --preclean -o 'sourceCpp_2.so' 'test_2.cpp' g++-10…
2
votes
1 answer

In guile scheme, how to prevent renaming when calling macro from another macro?

; Having this definition that creates identifier `self' (define-syntax alambda (lambda (stx) (syntax-case stx () [(alambda lambda-list . body) (with-syntax ([name (datum->syntax #'alambda 'self)]) #'(letrec ([name (lambda…
user7038168
2
votes
1 answer

My lisp macro stops working in latest guile

I have macro that I've written in 2010, it was for managing structures like in Common Lips using Alists (here is whole file including functions https://jcubic.pl/struct.txt). (define-macro (defstruct name . fields) "Macro implementing structures…
jcubic
  • 61,973
  • 54
  • 229
  • 402
2
votes
1 answer

Alter REPL to display username, hostname and current working directory?

In Guile's REPL the prompt is scheme@(guile-user)>, but I want it to show my-name@hostname(current-working-directory)>. Is there a way to do this?
2
votes
1 answer

How to output a comment using display

I'm using scheme to output some s-expressions to a port and I would really like to add comments to the stream I'm writing. As the ; character will comment everything after I'm unsure how to actually do this, a comment is not an s-expression so…
edoput
  • 1,212
  • 9
  • 17
2
votes
1 answer

scheme read function's behavior

I can't understand this scheme read function's behavior. gosh> (null? '()) #t gosh> (null? (read)) '() #f gosh> (define a (read)) '() a gosh> a '() gosh> (null? a) #f I expected (null? (read)) is #t(true) when I inputted '(). Not only Gauche, but…
sai
  • 55
  • 5
2
votes
1 answer

How to have objects print nicely in Guile scheme repl

I'm using GOOPS in Guile Scheme 2.2.3. If I have code like: (use-modules (oop goops)) (define-class () (e0 #:init-value 0.0 #:init-keyword #:e0) (e1 #:init-value 0.0 #:init-keyword #:e1) (e2 #:init-value 0.0 #:init-keyword…
tkf
  • 997
  • 1
  • 7
  • 16
2
votes
1 answer

GNU guile: function registered with scm_c_define_gsubr: how can i handle an optional parameter?

I've defined a guile C function: static SCM myfun(SCM arg1,SCM opt_arg2) { return SCM_BOOL_T; } registered with scm_c_define_gsubr ("myfun", 1, 1, 0, myfun); there is one optional argument. How can I detect if opt_arg2 has been used…
Pierre
  • 34,472
  • 31
  • 113
  • 192
2
votes
1 answer

How to fix libguile/stime.c on macOS Sierra build of guile-2.0.11?

enter link description hereThe build of guile-2.0.11 stops with the following error, Undefined symbols for architecture x86_64: "_clock_getcpuclockid", referenced from: _scm_init_stime in libguile_2.0_la-stime.o ld: symbol(s) not found for…
John
  • 31
  • 3
2
votes
1 answer

Check whether a symbol is bound

In Emacs Lisp (boundp 'symbol) returns t if symbol is bound to some value, nil otherwise. Is there an equivalent procedure in Guile Scheme?
Ernest A
  • 7,526
  • 8
  • 34
  • 40
2
votes
1 answer

How does one create a C function pointer from a Scheme function in Guile?

I am trying to write a wrapper for a C library that contains a function which takes another function to achieve polymorphism (i.e. a generic function). I would like to write my wrapper such that it takes a Scheme function and passes it to the…
2
votes
0 answers

Disabling compiler optimzations in Guile

In Guile, how do I disable optimizations in the bytecode compiler, so that I can get better debugging information (such as the local variables of each and every procedure)?
Demi
  • 3,535
  • 5
  • 29
  • 45
2
votes
1 answer

How to create cairo surface in guile

I have this code guile> (cairo-pdf-surface-create "foo.pdf" 100.0 100.0) ; and get this error standard input:29:1: In procedure cairo-pdf-surface-create in expression (cairo-pdf-surface-create "foo.pdf" 100.0 ...): standard input:29:1: Wrong type…
jcubic
  • 61,973
  • 54
  • 229
  • 402
2
votes
1 answer

Guile scheme cond ERROR: Wrong type to apply

It is not clear to me why this cond gives Wrong type to apply error. scheme@(guile-user) [12]>(cond ((equal? "i" "i") => (display "yay"))) yay ERROR: In procedure #: ERROR: Wrong type to apply: # scheme@(guile-user) [12]>(cond ((string= "i" "i") =>…
user1265564
  • 147
  • 4
2
votes
1 answer

How to run a guile Scheme script using shebang notation?

I have created a guile Scheme script using shebang notation. Here is the code: #!/usr/local/bin/guile \ -e main -s !# (define (fact-iter product counter max-count) (if (> counter max-count) product (fact-iter (* counter…
Tarun Maganti
  • 3,076
  • 2
  • 35
  • 64