www.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=20120113; | |
h=date:from:to:subject:message-id:mail-followup-to:references | |
:mime-version:content-type:content-disposition:in-reply-to | |
:user-agent; | |
bh=s8GDfyUSXJOb1qbefbn495Cgh/AUBSxGow1hYcp+k/w=; | |
b=mnm8IGy0lxhrO5cOfG7G4QQ6nSNp4ukRars4gpoI1C2Mvx4IQZlk9AcBJyytO7sXhD | |
DbOdFhEwib2kR0aCCKF1hFOKrmhO/rhrr5rLWnhziF5pCBeH5LaELxZF6r3+0LfMz8j3 | |
tvBLPg7X3X5r3vjKa8nGBn6oTQsfxTAHNtMObAO4JsuPlBl5AWmXiLmNJmAihYgcmH0l | |
kmdYfuCTL945lfbaYpw8eRkp/BGZNeBS2EiOs7Cu8Y1RjDIizh7zhRyFgrsxWIj1egCO | |
kazOfkqCsVyXquY/FvXL8QjoLckPlqJNn7WYYarh5qUhwKkbabpfYhag7VJQ9gWVTA4Z | |
4I2A== | |
X-Received: | by 10.152.28.105 with SMTP id a9mr22598432lah.9.1437913696825; |
Sun, 26 Jul 2015 05:28:16 -0700 (PDT) | |
Date: | Sun, 26 Jul 2015 15:28:14 +0300 |
From: | "Vladimir Zhbanov (vzhbanov 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: [geda-user] The new to do |
Message-ID: | <20150726122814.GE8789@localhost.localdomain> |
Mail-Followup-To: | geda-user AT delorie DOT com |
References: | <CAM2RGhQ70Pex5aNeQ86vKHc7sKf_Vpws69__CPb2QKg6fJTeHg AT mail DOT gmail DOT com> |
<mnv04v$if0$1 AT ger DOT gmane DOT org> | |
<0A5D410F-D1EF-4FC6-AF0F-BB13218B1615 AT icloud DOT com> | |
<alpine DOT DEB DOT 2 DOT 00 DOT 1507131000330 DOT 6924 AT igor2priv> | |
<mo1rd7$oef$1 AT ger DOT gmane DOT org> | |
<20150714084906 DOT GC14371 AT localhost DOT localdomain> | |
<moheag$673$1 AT ger DOT gmane DOT org> | |
<20150720131753 DOT GA19305 AT localhost DOT localdomain> | |
<mp0moh$jq2$2 AT ger DOT gmane DOT org> | |
MIME-Version: | 1.0 |
In-Reply-To: | <mp0moh$jq2$2@ger.gmane.org> |
User-Agent: | Mutt/1.5.23 (2014-03-12) |
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 Sat, Jul 25, 2015 at 09:06:56PM +0200, Kai-Martin Knaak wrote: ... > > Anyway, the script for gschem is attached. > > Unfortunately, it is all greek, err, guile to me. But good to see that > this kind of tasks can be tackled in current gschem. The guile syntax is simple enough, any function has the following form (function-name arg1 arg2 ...) So you have just to find functions you need and get used to them. Some special forms exists, though, such as 'define', 'lambda' and 'let/let*'. 'lambda' is like a function without name. 'define' assigns name with it. Semicolons introduce comments. Say, you can write: (define add-two (lambda (x) (+ x 2)) ) ; comment here x here is an argument of the function. (+ x 2) is the body. As you can see, the calculated value of the last expression is always the returned value of any expression. If your text editor is advanced enough, it will show you where the function starts (its opening left parenthesis) and ends (the closing right one). You can abbreviate the above example as follows: (define (add-two x) (+ x 2)) I think the differences are obvious. The let/let* forms are just syntactic sugar for lambda. You can even make up your own forms. The simple 'let' is used as follows: (let ( (arg1 value1) (arg2 value2) ... ) body ) let* is the same, but any args can use previous ones to calculate their values. So you can write: (let ( (a 1) (b 2) ) (+ a b)) and this expression returns 3. '+' is also a function (procedure). Or you can write (let ( (a 1) (b (* a 2)) ) (+ a b)) This returns the same value, but b is the product of a and two. There are also various possibilities that make guile attractive, such as, e.g., tail calls, continuations, closures, which can be learned if the user will write programs scripts in guile. Cheers, Vladimir
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |