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

Named let in Scheme

I am attempting to write a loop in Scheme using named let. I would like to be able to break out of the iteration early based on various criteria, rather than always looping right at the end. Effectively, I would like to have while, break and…
andro
  • 901
  • 9
  • 20
0
votes
1 answer

Guile Scheme read-line reading past EOF

Using guile 1.8 or guile 2, the following code reads past EOF, seemingly for a few extra lines, then stops. The effect this has in the larger program of which this is an extract is to seemingly corrupt the previously read data. Am I using read-line…
andro
  • 901
  • 9
  • 20
0
votes
1 answer

How to write to a file in append mode -scheme R5RS?

(call-with-output-file "b.txt" (lambda (output-port) (display "hello, world" output-port))) How to open the b.txt in append mode. So that, my results will be appended in the text file. I have found some answer in the following. But that's not what…
vishnu
  • 891
  • 2
  • 11
  • 20
0
votes
2 answers

How to Write scheme shell results to a file?

I am executing some commands in guile shell. I want the results of the command written to a file. I tried something like this: some command | nc localhost abc >> file.txt But did not work for me.
vishnu
  • 891
  • 2
  • 11
  • 20
0
votes
3 answers

Custom Scheme indexing function returns list-external value

I'm a newbie to scheme programming and I was writing small codes when I encountered the following issue and couldn't reason about it satisfactorily. (define (at_i lst i) (if (eq? i 0) (car lst) (at_i (cdr lst) (- i 1)…
Misgevolution
  • 825
  • 10
  • 22
0
votes
1 answer

How to install srfi modules in local copy of guile

I have guile installed in /home/jcubic on shared hosting where I don't have root access and when I have this: (use-modules (srfi srfi-1) (srfi srfi-26) (srfi srfi-43) (srfi srfi-60) (rnrs bytevectors) (ice-9 binary-ports) (srfi…
jcubic
  • 61,973
  • 54
  • 229
  • 402
0
votes
1 answer

Scheme can't find function inside macro while compile

I have sample code like this: #!/usr/bin/guile -s !# (define (process body) (list 'list (map (lambda (lst) (list 'quote (car lst))) body))) (defmacro macro (body) (list 'quote (process…
jcubic
  • 61,973
  • 54
  • 229
  • 402
0
votes
1 answer

Set Guile as default Geiser REPL in Emacs?

How do I configure Emacs to set Guile as the default Scheme implementation?
0
votes
3 answers

open telnet using shell and passing commands

I am new to linux and shell scripting. I want to connect to localhost and interact it. #! /bin/bash (exec /opt/scripts/run_server.sh) when i execute this bash script, it starts listening on a port. Listening on port xxxxx Now i want to issue…
vishnu
  • 891
  • 2
  • 11
  • 20
0
votes
0 answers

lisp-scheme doesn't return an accurate result

I'm new to scheme and I was a little surprised to see what the compiler returns for (- 112 (* 56 (- 3 1.1))) Obviously the answer is 5.6, but I get 5.60000000000001 on my machine (guile) and 5.6000000000000085 using an online compiler…
mrtnmgs
  • 1,402
  • 14
  • 26
0
votes
1 answer

How to expand macros in guile scheme?

I'm trying to write let over lambda defmacro/g! in guile scheme. I have this: (use-modules (srfi srfi-1)) (define (flatten x) (let rec ((x x) (acc '())) (cond ((null? x) acc) ((not (pair? x)) (cons x acc)) …
jcubic
  • 61,973
  • 54
  • 229
  • 402
0
votes
2 answers

How to define recursive cond macro with if form in lisp?

I want to implement cond (using lisp macros in guile) with if, this my attempt: (define-macro (cond . clauses) (if (pair? clauses) (let ((first (car clauses)) (rest (cdr clauses))) `(if ,(car first) (begin …
jcubic
  • 61,973
  • 54
  • 229
  • 402
0
votes
1 answer

Storing Procedure in a Pair (Scheme/Guile)

I am working in Guile, and need to use a procedure that is stored in a pair. If I store car in the following examples: (define pairA (cons 1 car)) (define pairB '(1 . car)) .. I can only evaluate the procedure from the first expression. The second…
0
votes
2 answers

Unable to understand the error in Guile Scheme Code

I am trying to print a Pascal's Triangle on terminal using Guile Scheme. What is Pascal's Triangle? Here is the script: #!/usr/local/bin/guile \ -e main -s !# (define (fact-iter product counter max-count) (if (> counter max-count) …
Tarun Maganti
  • 3,076
  • 2
  • 35
  • 64
0
votes
0 answers

Guile syntax-rules matching confusion on elipsis and improper list in the GNU manual

I'm having difficulty following along with some of the GNU guile manual's documentation on macros (https://www.gnu.org/software/guile/manual/guile.pdf) : In section 6.10.2.1 (pg 259 on Patterns), there's a section talking about how improper lists…
xdl
  • 1,080
  • 2
  • 14
  • 22