guile

How do I create a pipe between two processes in Guile?

蓝咒 提交于 2021-02-18 18:52:02
问题 I want to create two process in Guile and send the output (stdout) from one of them as input (stdin) to the other. Using the following example, how can this be done? echo "foo bar" | wc Output: 1 2 8 回答1: Yes, you can do this using open-output-pipe : (let ((p (open-output-pipe "wc"))) (display "The quick brown fox jumps over the lazy dog.\n" p) (close-pipe p)) This is equivalent to echo "The quick brown fox jumps over the the lazy dog." | wc (including echo 's implicit newline because I'm

How do I create a pipe between two processes in Guile?

倾然丶 夕夏残阳落幕 提交于 2021-02-18 18:51:09
问题 I want to create two process in Guile and send the output (stdout) from one of them as input (stdin) to the other. Using the following example, how can this be done? echo "foo bar" | wc Output: 1 2 8 回答1: Yes, you can do this using open-output-pipe : (let ((p (open-output-pipe "wc"))) (display "The quick brown fox jumps over the lazy dog.\n" p) (close-pipe p)) This is equivalent to echo "The quick brown fox jumps over the the lazy dog." | wc (including echo 's implicit newline because I'm

Ubuntu 出现The program 'make' can be found in the following packages问题的解决方法

点点圈 提交于 2020-08-17 04:06:12
今天运行make命令时,提示如下信息: The program 'make' can be found in the following packages: * make * make-guile Try: apt install < selected package > 运行一下命令即可解决:sudo apt-get install build-essential 来源: oschina 链接: https://my.oschina.net/airship/blog/4498071

configure says guile-config not found

拥有回忆 提交于 2020-06-29 06:12:11
问题 I am trying to install libgraph on my debian stretch installation. I installed guile and other necessary packages. Also built guile from source. When I try to configure libgraph by using './configure' it says : checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking

What is define* in guile or scheme?

自古美人都是妖i 提交于 2020-04-30 05:12:36
问题 I can't find it by searching, what is define* in guile? You can find it for instance in this answer https://stackoverflow.com/a/24101699/387194 回答1: You will find it in the documentation here: Creating advanced argument handling procedures. 6.10.4.1 lambda* and define*. lambda* is like lambda, except with some extensions to allow optional and keyword arguments. library syntax: lambda* ([var…] [#:optional vardef…] [#:key vardef… [#:allow-other-keys]] [#:rest var | . var]) body1 body2 …

What is define* in guile or scheme?

半世苍凉 提交于 2020-04-30 05:12:21
问题 I can't find it by searching, what is define* in guile? You can find it for instance in this answer https://stackoverflow.com/a/24101699/387194 回答1: You will find it in the documentation here: Creating advanced argument handling procedures. 6.10.4.1 lambda* and define*. lambda* is like lambda, except with some extensions to allow optional and keyword arguments. library syntax: lambda* ([var…] [#:optional vardef…] [#:key vardef… [#:allow-other-keys]] [#:rest var | . var]) body1 body2 …

6 件你应该用 Emacs 做的事

那年仲夏 提交于 2020-03-21 01:37:15
3 月,跳不动了?>>> 下面六件事情你可能都没有意识到可以在 Emacs 下完成。此外还有我们的新备忘单,拿去,充分利用 Emacs 的功能吧。 想象一下使用 Python 的 IDLE 界面来编辑文本。你可以将文件加载到内存中,编辑它们,并保存更改。但是你执行的每个操作都由 Python 函数定义。例如,调用 upper() 来让一个单词全部大写,调用 open 打开文件,等等。文本文档中的所有内容都是 Python 对象,可以进行相应的操作。从用户的角度来看,这与其他文本编辑器的体验一致。对于 Python 开发人员来说,这是一个丰富的 Python 环境,只需在配置文件中添加几个自定义函数就可以对其进行更改和开发。 这就是 Emacs 对 1958 年的编程语言 Lisp 所做的事情。在 Emacs 中,运行应用程序的 Lisp 引擎与输入文本之间无缝结合。对 Emacs 来说,一切都是 Lisp 数据,因此一切都可以通过编程进行分析和操作。 这造就了一个强大的用户界面(UI)。但是,如果你是 Emacs 的普通用户,你可能对它的能力知之甚少。下面是你可能没有意识到 Emacs 可以做的六件事。 使用 Tramp 模式进行云端编辑 Emacs 早在网络流行化之前就实现了透明的网络编辑能力了,而且时至今日,它仍然提供了最流畅的远程编辑体验。Emacs 中的 Tramp 模式

Inserting at arbitrary position in list in Scheme

时光毁灭记忆、已成空白 提交于 2020-01-14 02:58:10
问题 I have a list with me, for example: (B D F) I want to insert an element at an arbitrary position in the list. For example, if the element is A, I want to insert it before B and if the element C, I want to insert it after B but before D. Is there any way to insert elements at an arbitrary position in a list in Scheme? 回答1: It's easy to implement a function for this: (define (insert-at new k lst) (cond ((null? lst) (list new)) ((zero? k) (cons new lst)) (else (cons (car lst) (insert-at new

Implement yield and send in Scheme

痞子三分冷 提交于 2019-12-17 16:23:12
问题 I'm trying to port yield and yield from from Python to Scheme. Here is an implementation I've done: (define (coroutine routine) (let ((current routine) (status 'new)) (lambda* (#:optional value) (let ((continuation-and-value (call/cc (lambda (return) (let ((returner (lambda (value) (call/cc (lambda (next) (return (cons next value))))))) (if (equal? status 'new) (begin (set! status 'running) (current returner)) (current (cons value returner))) (set! status 'dead)))))) (if (pair? continuation

Where are ffi symbols defined?

时光怂恿深爱的人放手 提交于 2019-12-12 06:27:55
问题 I am trying to link a file, "lib guile_2.0_la-foreign.o" in order to build guile-2.0.11 on macOS Sierra. The ld command from the make file returns more than a dozen errors similar to "_ffi_type_float", referenced from: _fill_ffi_type in lib guile_2.0_la-foreign.o ld: symbol(s) not found for architecture x86_64 where the "_ffi_type_xxx" varies in the "xxx" position. I have installed libffi with hombrew, and have told CPPFLAGS and LDFLAGS where to find the lib and include directories, but I