Questions tagged [guile]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
89 views

How to learn the file paths of every loaded module in a Guile program?

I am playing around with reflection in Guile (specifically, within GNU Make's guile support) and I wish to obtain the fully qualified path names of every loaded module. I've found this page in the ...
Cognitive Hazard's user avatar
0 votes
0 answers
29 views

WIX toolset 3.11.2 preserve source files timestamps

I'm struggling to maintain file timestamps in MSI installer. I'm installing few scheme source files that needs to preserve their timestamps (Guile problems) and I can't figure way to do that. Is there ...
user5704794's user avatar
0 votes
1 answer
112 views

What is #~ in scheme?

What does #~ mean in scheme (guile)? For example in this snippet from the guix source code: #~(list (string-append "prefix=" #$output))
Rikard N's user avatar
  • 429
0 votes
1 answer
96 views

How can I load a foreign library using Guile Scheme?

I want to use a function that I have written in C and compiled into a library using gcc -shared -o libsum.so sum.c, but I don't know how to load the library and call the function from the Scheme ...
Display name's user avatar
0 votes
0 answers
53 views

Why can't I use this unexported procedure?

I am missing something very basic. There is an unexported procedure in the Guix source module (guix build-system python) I want to use. I thought I could just use @@ to get it. Yet, when I try that I ...
wdkrnls's user avatar
  • 4,588
0 votes
0 answers
38 views

How to tell configure where the required version is?

I'm attempting to compile geda-gaf cloned from https://github.com/rlutz/geda-gaf.git when I do $ ./configure; I get: checking for GUILE... no configure: error: you need at least version 2.0.0 of guile ...
Brad's user avatar
  • 11
0 votes
1 answer
80 views

Why defining a recursive-display procedure in Guile causes infinite loop?

The following procedure causes an infinite loop: (define (recursive-display . args) (if (null? args) #t (begin (display (car args)) (recursive-display (cdr args))))) I'm ...
Amanda Ferrari's user avatar
0 votes
0 answers
83 views

Loading srfi in guile scheme

I found out that the srfi's already used live under /user/guile/3.0/srfi/. This is also in the load-path variable. Now I go into /user/guile/3.0/srfi/ and 'git clone github-link-to-srfi-25' but I can ...
SourBitter's user avatar
1 vote
0 answers
175 views

Guile can't find Module

I've just installed guile-lib-0.2.7.tar.gz, and checking post-install, found it at /usr/share/guile/site—which I believe is correct given: scheme@(guile-user)> (list (%library-dir) (%site-dir) (%...
hsmyers's user avatar
  • 665
0 votes
1 answer
58 views

Can I write a loop procedure in Guile?

I was trying to write a loop procedure in Guile. I came up with the following: (define loop (lambda (predicate callback) (when predicate) callback (loop predicate callback))) But ...
Amanda Ferrari's user avatar
0 votes
0 answers
51 views

How to pass MAKE variables to guile

I'm using GNU Make with Guile. How do I pass Make variables to Guile? %.txt: @echo $* $(guile (string-upcase $*)) What I want to see is this: $ make foo.txt foo FOO What I get is an error, ...
iter's user avatar
  • 4,191
3 votes
4 answers
280 views

How can I use dynamic programming in Scheme to solve the Coin Change problem?

I'm trying to learn a Lisp language and have settled on Guile and am trying to solve this problem: You are given an integer array coins representing coins of different denominations and an integer ...
Kyle Baldwin's user avatar
0 votes
2 answers
104 views

How to match any element?

This works fine: (sxml-match '(div) ((div) #t)) But this fails: (sxml-match '(div) ((,element) #t)) I am wondering how to match any element? This is a more concrete example. The following is a ...
ceving's user avatar
  • 22.2k
1 vote
1 answer
275 views

Guile Scheme - How to pass C struct value back to Guile for scripting

I'm writing a program/game where I use Guile for scripting on top of a C program. For example I have a command struct type(which is also used for move_to) in C and corresponding move_to wrapper ...
rael's user avatar
  • 11
0 votes
0 answers
23 views

Makevars cannot find libguile.h but the file exists [duplicate]

I would like to be able to use Guile from within R but I don't want RcppGuile::call_guile taking so long to initialize Guile every time. Ideally, Guile could initialize into a reusable object on the R ...
wdkrnls's user avatar
  • 4,588
2 votes
1 answer
150 views

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 ...
user1632812's user avatar
1 vote
4 answers
212 views

I'm using guile 3 and trying to customize the "print" aspect of the repl

I understand that the option (repl-default-option-set! 'print ...) is to be used and i've tried so in many variations, i grokked the idea behind customizing the prompt (repl-default-option-set! '...
Alexander Castillo's user avatar
1 vote
1 answer
54 views

Top Level or Not Dependent Scheme Macro Expansion

Is it possible to write a macro in Scheme that expands differently depending upon whether the macro was used at the top level or internally? I'm primarily interested in a solution that works in Guile ...
sidhu1f's user avatar
  • 83
0 votes
2 answers
409 views

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&...
tvman's user avatar
  • 13
0 votes
1 answer
195 views

Error starting Guile with `readline` support

I'm trying to configure Guile to use readline. Here's my ~/.guile: (use-modules (ice-9 readline)) (there was more, this one line is sufficient to have this failure) Here's a log of my interaction: ...
agam's user avatar
  • 5,104
0 votes
1 answer
92 views

Generating cond's (test expression ...) in Scheme

I've been using Guile for about a year, but am fairly inexperienced in using macros in Scheme. Although I have got some more complicated examples to work satisfactorily, I'm getting stuck on what (to ...
Phil's user avatar
  • 602
2 votes
4 answers
116 views

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?...
Gleb Gorshkov's user avatar
0 votes
1 answer
91 views

How to parse a function into another function in scheme

I am trying to create a function that takes another function as a parameter and calls the functions in a loop. The code below should get the function and the number of times the loop should execute: (...
COM's user avatar
  • 45
1 vote
1 answer
171 views

Why is my (guile) scheme macro evaluating its argument?

Within Guile, I am trying to learn define-syntax and syntax-rules. I was under the impression that scheme macros do not evaluate their arguments, but it seems like mine is doing so: (define-syntax ...
beguiler's user avatar
1 vote
1 answer
251 views

How to define two R7RS libraries in Guile

I have these two R7RS libraries, which I enter into the Guile REPL one by one: (define-library (example one) (import (scheme base)) (export f) (begin (define (f x) (+ x 1)))) (define-...
Flux's user avatar
  • 10.1k
0 votes
1 answer
134 views

Generating a complete GNU Make recipe with Guile

I am playing with the $(guile ...) support in GNU Make, but I'm having trouble generating a complete recipe from within Guile. This traditional approach works as expected: brazil: <--tab-->@echo ...
Cognitive Hazard's user avatar
2 votes
3 answers
280 views

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 (...
jcubic's user avatar
  • 63.1k
1 vote
1 answer
408 views

Running guile code as shell script - guile init file?

I am running guile code as a shell script (starting the script file with #!/usr/bin/guile etc.) -- its working as expected, but when I do this, guile does not load my guile initialization file ~/....
PaulM's user avatar
  • 295
1 vote
2 answers
236 views

Guile foreign-library-function fails

In running an example from the guile handbook I stumbled upon an error while running foreign-library-function. It fails and prints a backtrace stating dlopen failed, because of an invalid elf format ...
marober's user avatar
  • 23
2 votes
3 answers
100 views

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 ...
Poisson Aerohead's user avatar
2 votes
1 answer
56 views

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-...
rr_cook's user avatar
  • 136
0 votes
1 answer
719 views

How do I open a file relative to the source files directory in Guile Scheme?

I'm writing a Guix developer environment definition for a Python project I'm working on, it looks something like this: (use-modules (gnu packages) (gnu packages python) (gnu ...
Rovanion's user avatar
  • 4,402
2 votes
1 answer
1k views

Suppress indirect leaks caused by third party libraries

I have this very simple C code calling a scheme script with guile: /* main.c */ #include <libguile.h> int main(void) { scm_init_guile(); scm_c_primitive_load("script.scm"); ...
David Ranieri's user avatar
0 votes
1 answer
106 views

finding an alternative for a let binding of a define-syntax

I'm in the process of trying to update some old guile 1.8 code to guile 3.x. I'm struggling to find a good replacement for a particular construct. Here's an example that represents the old 1.8 code: (...
Andrew's user avatar
  • 3,995
1 vote
3 answers
401 views

How to show error message from eval in Scheme?

I'm trying to create code that evaluates expression and return error as string for error: (cond-expand (gambit) (gauche) (kawa) (guile (import (rnrs base) (rnrs exceptions) ...
jcubic's user avatar
  • 63.1k
2 votes
1 answer
196 views

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 ...
Matías Guzmán Naranjo's user avatar
0 votes
1 answer
165 views

How to write a self currying lambda macro in scheme? [duplicate]

I would like to write functions like this: (define foo (\ (a b c) (+ a (+ b c)))) get it automatically transformed into this: (define foo (lambda (a) (lambda (b) (lambda (c) (+ a (+ b c)))))) and use ...
Ricardo Mazeto's user avatar
0 votes
2 answers
642 views

If-else statement error in Scheme using guile

Total newbie to Scheme here. I've been stuck on a scheme problem for sometime now. I don't understand how to code this right. I've looked every where on this site and others, and I just can't get this ...
Cali_boy23's user avatar
0 votes
1 answer
48 views

Guile Scheme GOOPS slot accessor is not a valid generic function error

I'm learning Guile GOOPS. I have a problem with a slot accessor. The code below (use-modules (oop goops)) (define-class <person> () (name #:init-keyword #:name #:accessor person-name))...
Volodymyr Prokopyuk's user avatar
0 votes
1 answer
111 views

In guile scheme, how to share syntax between outer macro and inner macro?

In Guile scheme, I have a macro which calls another macro, and I want the call to the inner macro to reference a symbol used in the inner macro. Here is a simple example to illustrate the kind of ...
Ben's user avatar
  • 251
1 vote
1 answer
128 views

How to read only one expression at a time in Guile Scheme

I am trying to make a reader extension in Guile Scheme. When writing this reader extension, I would like to use a guile function that reads in only one expression at a time, like read-expression and ...
Charlim's user avatar
  • 531
0 votes
2 answers
80 views

How to change content of quoted value in Guile

I have an symbol that evaluates to (quote ("all")). I would like to append "tests" to the end of the list, and get (quote ("all" "tests")) but I didn't find how ...
Hugal31's user avatar
  • 1,618
0 votes
1 answer
56 views

Does Guile relax restriction on variable name convention by allowing variable names beginning with number?

For example, It seems that 1+2 can be used in Guile as a variable name: (define 1+2 4) 1+2 ;==>4
Youjun Hu's user avatar
  • 1,051
1 vote
1 answer
202 views

How to find out which guile module a binding is defined in?

For example, which module should I use when I want to use the special form define-values?
Youjun Hu's user avatar
  • 1,051
0 votes
1 answer
140 views

Return #nil in a Guile extension

I know that there are a couple of singletons around that can be used to quickly return "common" values from Guile C extension functions, like: SCM_UNSPECIFIED SCM_BOOL_F and others. I would ...
Rick77's user avatar
  • 3,141
1 vote
1 answer
457 views

How to build Guile libraries from source?

I recently switched to Slackware to learn how to use a more advanced Linux distro. It had GNU Guile 2.0 installed by default, but I built Guile 3.0 from source code. When I attempted to build guile-...
km15236's user avatar
  • 11
0 votes
1 answer
477 views

How do you get the response data as string using (web client) in guile?

I'm trying to get the response data as a string using the docs found here https://www.gnu.org/software/guile/manual/html_node/Web-Client.html. The document mentions that http-request: Returns two ...
aqui8's user avatar
  • 521
0 votes
1 answer
77 views

How to do an intersection with sxpath

What is the best way to do an intersection with sxpath? For example with the following XML: <root> <a category="cat1"> <b>some text</b> <b>foo <c>bar<...
Antoine's user avatar
  • 1,782
6 votes
1 answer
567 views

Tracing in Guile - How to trace in Guile Scheme

What are the equivalents in Guile Scheme of the (trace procedure) and (trace-let (bindings) body) tracing facilities from Chez Scheme. I've reviewed the documentation at https://www.gnu.org/software/...
Volodymyr Prokopyuk's user avatar
3 votes
1 answer
866 views

guile-config fails to run

I am trying to install libgraph in my WSL Ubuntu 20.04 installation. I installed all the necessary packages. But when I try to configure libgraph, it fails with this: $ ./configure checking build ...
divykj's user avatar
  • 596

1
2 3 4 5 6