delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to geda-user-bounces using -f |
X-Recipient: | geda-user AT delorie DOT com |
X-Original-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=gmail.com; s=20161025; | |
h=date:from:to:subject:message-id:in-reply-to:references:mime-version | |
:content-transfer-encoding; | |
bh=UBuBUGdMnVKFYqi9DjbuoKCTljXyWb4ZAG0R1vbImWY=; | |
b=Mm7U3Gi6ClXsx8v7+oqSOok/hcgu1R1LtB3KrAUqJkXKZl6g6/5ZrjZ6lsTbZfwmKj | |
Kn05Z0ADhCDnwFcDqjmqJxhJpLNJYOj5pn9K9qUAaxgrbRDPhrssA+/+7jFe+96iaATi | |
Id/FMNs1WLI/Oom1BAxT3rCwLsCwaUl/f6eNkSfMplgepPVr84SROlQs7TBD03YStGtN | |
zvsEXbIKzk59HCYpOD4aC05P9k5Ww/BlZHv/muE1sRx0UZzr3IsZ3fANFhdK2dSTSjHR | |
qCn/jZDu8nN13cILTnA9WBdzfZW4toUkxJWIAH+lAzEvkuwzS3VGmxEUqyJTHbFPXkcL | |
YOLQ== | |
X-Google-DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; |
d=1e100.net; s=20161025; | |
h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to | |
:references:mime-version:content-transfer-encoding; | |
bh=UBuBUGdMnVKFYqi9DjbuoKCTljXyWb4ZAG0R1vbImWY=; | |
b=YTGXlSiM7s/XnbLY0QFXy6m9XErhdG2Xzlum2ZQQr0JnayCOlAXgYQGrhV9M9lxztS | |
OkStGvThZhmr5ZanM0UM3i5pktIt1BndkPgqRTOyOmLwGcVPrE9f+17mGXrGlTYLANyb | |
repmPTqCXEC+uluY48W6hUCZDPFY/rGrTnqJ/8XYilzJiqzurffZ5nwgR3D7dJAP8hkY | |
LgWgImpQsnNhcXEl0DU7iJKpGtfVI9iMX/HMJTf2X+yjuzYDHM6ZrlQhvG6u1l1+qG2R | |
HZ2FfXU2NED3AdApTkCzSqCreWnFk7LhEHSdTjrVm1Nj6up6nUlxh6Knl0NCwcM+hJD7 | |
yqTQ== | |
X-Gm-Message-State: | AOAM531PKkb9R5GkBN/2cXPMW7Zz8fn6kjxiw4VhD9GWpTe0YC79HHgr |
7t2FkW3YVJn0+MbPOVtk9aOtn6Ikyoc= | |
X-Google-Smtp-Source: | ABdhPJw1QK4O8Qf/7UmQrjxHti93CVFKFmDu9e6l2pyTE5M9io75SAzbed2/0WVjWRB9irA+RKYfOA== |
X-Received: | by 2002:a2e:a586:: with SMTP id m6mr13874361ljp.387.1619464738613; |
Mon, 26 Apr 2021 12:18:58 -0700 (PDT) | |
Date: | Mon, 26 Apr 2021 22:18:32 +0300 |
From: | "dmn (graahnul DOT grom AT gmail DOT com) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com> |
To: | geda-user AT delorie DOT com |
Subject: | Re: readlink in guile (Re: [geda-user] system wide config) |
Message-ID: | <20210426221832.62f7e6bd@demon> |
In-Reply-To: | <20210422123323.469F183D3FA8@turkos.aspodata.se> |
References: | <20210417120805 DOT 37DAA824EAA0 AT turkos DOT aspodata DOT se> |
<YHrjzpKEMOvXREuY AT lepton> | |
<20210417144426 DOT E4238824EAA0 AT turkos DOT aspodata DOT se> | |
<YH4IPPe+k4MZJJkm AT lepton> | |
<20210420004032 DOT 30A6980770A6 AT turkos DOT aspodata DOT se> | |
<YH6T5zzhba9AqGX9 AT lepton> | |
<20210420143556 DOT CC46580770AF AT turkos DOT aspodata DOT se> | |
<20210420144634 DOT 1456180770AF AT turkos DOT aspodata DOT se> | |
<20210422091632 DOT 7178ff90 AT demon> | |
<20210422123323 DOT 469F183D3FA8 AT turkos DOT aspodata DOT se> | |
X-Mailer: | Claws Mail 3.17.8 (GTK+ 2.24.33; amd64-portbld-freebsd11.4) |
MIME-Version: | 1.0 |
Reply-To: | geda-user AT delorie DOT com |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | geda-user AT delorie DOT com |
X-Unsubscribes-To: | listserv AT delorie DOT com |
On Thu, 22 Apr 2021 14:33:23 +0200 (CEST) "karl AT aspodata DOT se [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com> wrote: > Dmitry: > > On Tue, 20 Apr 2021 16:46:34 +0200 (CEST) > > "karl AT aspodata DOT se [via geda-user AT delorie DOT com]" > > <geda-user AT delorie DOT com> wrote: > ... > > > (define (readlink file) > > > (let* > > > ( > > > (port (open-input-pipe (string-append "readlink -f " file))) > > > (str (read-line port)) > > > (close-pipe port) > > > ) > > > str > > > ) > > > ) > ... > > Karl, first of all, I'd like to thank you for not using the "dog's > > breakfast coding style" (TM)! :-) > > What is that ? > Is it about all thoose {str|d}angling parentheses... Yes... But never mind, I'm just kidding. I invented this term specifically to troll guile programmers. :-) When I started learning the language, it was a nightmare (just look at the "examples" in the guile reference manual). Then I developed my own coding style, which reflects something that human beings can read, understand, modify and refactor. After that learning guile became no more difficult than learning any other new language. What it looks like you can see in one of the examples I've written for lepton-schematic: https://graahnul-grom.github.io/scm/select-locked.scm.html (and in the Lepton EDA code, too :-) ). > > > Being not an expert in the bloody lisp programming language, I > > wonder does the call "(close-pipe port)" inside the "let" clause > > get executed? (It looks like a variable definition). > > No, you are right, but I can do it like this (it is nice to have > open and close close to each other): > > (define (readlink file) > (let* > ( > (port (open-input-pipe (string-append "readlink -f " file))) > (str (read-line port)) > (dummy (close-pipe port)) > ) > str > ) > ) > > but perhaps it is better doing this like: > > (define (read1pipe cmd) > (let* > ( > (port (open-input-pipe cmd)) > (str (read-line port)) > ) > (close-pipe port) > str > ) > ) Yes, that's right. > > (define (readlink file) (read1pipe (string-append "readlink -f " > file))) > > Regards, > /Karl Hammar > Regards, Dmitry. -- Lepton Electronic Design Automation https://github.com/lepton-eda/lepton-eda https://graahnul-grom.github.io
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |