#lisp

4k1r4@diaspora-fr.org

Hello, I use #Guile #Scheme implementation, and I'd like to know how do you do to get the terminal width (to store in a variable for example)?
After tried with getenv procedure:

(getenv "COLUMNS")

That return #f (unless export COLUMNS=$(tput cols) either in .bashrc or in the guile shebang's script)

#!/usr/bin/env sh
exec env COLUMNS=$(tput cols) guile -s "$0"
!#

But using this, if you resize the terminal, the value is not updated.

So I have to use:
```
(use-modules (ice-9 popen))
(use-modules (ice-9 rdelim))

(define (get-terminal-width)
(let* ([port (open-input-pipe "tput cols")]
[terminal-width (read-line port)])
(close-pipe port)
terminal-width))


May be someone has a more efficient way to get the terminal width, thanks.

#GNUser #Guile #lisp #Scheme #programming
tomgrzyb@sysad.org

#freesoftware
#lisp

ECL: Embeddable Common-Lisp

https://gitlab.com/embeddable-common-lisp/ecl

ECL stands for Embeddable Common-Lisp. The ECL project aims to produce an implementation of the Common-Lisp language which complies to the ANSI X3J13 definition of the language. -- The term embeddable refers to the fact that ECL includes a Lisp to C compiler, which produces libraries (static or dynamic) that can be called from C programs. Furthermore, ECL can produce standalone executables from Lisp code and can itself be linked to your programs as a shared library. It also features an interpreter for situations when a C compiler isn't available.