Questions tagged [guile]
GNU Guile is the GNU project's official plugin infrastructure. Guile typically refers to the Scheme front-end which Guile provides.
245
questions
0
votes
1
answer
42
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
25
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
49
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
84
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
0
answers
30
views
NDK: header files precedence
I am cross-compiling Guile(scheme) for Android and there are some errors [undeclared identifier] in nl_langinfo.c. I suspect ndk loading its own langinfo.h(where some symbols are missing) instead from ...
0
votes
0
answers
23
views
Why can't I use my macro after (load)'ing the scm file that defines it?
I am playing with the guile support in GNU Make, and I've stumbled upon this oddity: A define-syntax macro that I define and use in "my-gmk.scm" file works as expected:
(define-syntax my/...
0
votes
1
answer
53
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:
(...
0
votes
0
answers
24
views
How to suppress echoing input when using readline
I've recently started to tinkering with small scheme programs. But I have problems when trying to read lines from standard input, as all input gets echoed to standard output. Take for instance this ...
1
vote
1
answer
72
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
97
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
40
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
131
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
139
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
99
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
88
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
47
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
278
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 ...
1
vote
1
answer
294
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
55
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
217
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
153
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
97
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
355
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
32
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
73
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
63
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
52
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
46
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
89
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
85
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
253
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
277
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
51
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<...
3
votes
1
answer
290
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
631
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 ...
0
votes
1
answer
56
views
How to use ice-9 atomic boxes with hash-table
I have a simple function that I use to cache values. I use a hash table as a cache. The cache will be accessed from different threads and I want to use atomic boxes for controlling the access from ...
0
votes
1
answer
27
views
Filtering an expression output with regexp
The bad code of main is (string-match "module" (help uri-path)) that returns an error
scheme@(guile-user) [5]> (string-match "module" (help uri-path))
`uri-path' is an object in the (web uri) ...
1
vote
1
answer
745
views
Scheme dict operations
I am looking to understanding some hashmap code in lisp, and am using python as a reference.
Are the following two roughly the same? And if so, how can I see what my dict object looks like?
# ...
0
votes
1
answer
386
views
Scheme get last command in guile
Normally in a terminal (or any other command prompt I've previously used) I'll press the up key to get the last entered command. However, when doing that in the guile interpreter, I just get:
scheme@(...
0
votes
2
answers
79
views
PEG grammar turns computer into hot-plate and never finishes
I'm trying to write a grammar so I can parse a specific type of input file. I've started with the most basic grammar possible, but guile just about melts my computer when trying to match a pattern ...
0
votes
1
answer
54
views
Evaluating code which refers to function parameters
Update: The original version of this question did not fully describe the constraints of my situation. It now includes an example with some hand-waving for the sake of simplicity as well as a testable ...
0
votes
2
answers
102
views
Dotted lists in Guile Scheme
How can I specifically check for dotted-lists in the form (a . b) Guile? The dotted-list of srfi-1 strangely returns #t also for e.g. Numbers (since when are numbers Lists too? https://www.gnu.org/...
0
votes
1
answer
112
views
Guile scheme system* with pdflatex -jobname
I'm trying to call pdflatex from a guile scheme file. This is the Guile command I'm using:
(system*
"cat" "foo.txt" "|" "pdflatex" "-jobname" "\"bar\"")
This is the error I get back after running ...
2
votes
1
answer
121
views
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 #...
1
vote
0
answers
75
views
liliypond NIL NULL NOOP symbol – or how to define a empty expression
tl;dr How to define a noop expression in lilypond?
Hello, I play the organ and sometimes need to transcribe some sheet music for it. I use lilypond for this.
For pedaling symbols I defined some ...
0
votes
1
answer
126
views
How do I turn #<unspecified> into a number in guile scheme
I'm trying to get the hang of recursion in scheme. I put together a Fibinachi function and it keeps returning unspecified instead of a number. How do I make this function return a number and to ...
1
vote
1
answer
390
views
How to read a string to get user input in GNU Guile?
I'm trying to make a Rock Paper Scissors game to help myself lean GNU Guile. I've hit a snag where I get user input, the player's choice in the game. If I set it to a string, then the game works ...
1
vote
1
answer
70
views
'Make: exec: compile: not found' Guile's Haunt build error (CentOS 8; Guile 2.0.14; Haunt 0.2.4)
The build of 'Haunt' ('make' step) fails with the following:
GEN haunt/config.go
./pre-inst-env: line 31: exec: compile: not found
'compile: not found' ?
Guile is in version 2.0.14, Haunt 0.2....
3
votes
1
answer
422
views
Define goto in scheme
As an exercise to learn call/cc and macros, I tried to define goto.
(define-syntax label
(syntax-rules ()
((_ name)
(begin
(define name)
(call/cc (lambda (c) (...
1
vote
2
answers
111
views
SRFI notational conventions
I'm reading (looking at) the Guile Reference Manual but I do not understand some notational conventions specified by SRFI.
Note that the Guile Reference Manual seems to follow the structure of the ...