Questions tagged [guile]
GNU Guile is the GNU project's official plugin infrastructure. Guile typically refers to the Scheme front-end which Guile provides.
261
questions
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 ...
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 ...
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))
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 ...
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 ...
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
...
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 ...
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 ...
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) (%...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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! '...
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 ...
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&...
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:
...
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 ...
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?...
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:
(...
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 ...
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-...
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 ...
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 (...
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 ~/....
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 ...
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 ...
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-...
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 ...
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");
...
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:
(...
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)
...
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 ...
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 ...
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 ...
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))...
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 ...
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 ...
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 ...
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
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?
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 ...
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-...
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 ...
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<...
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/...
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 ...