unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: rm@fabula.de
Cc: guile-user@gnu.org
Subject: Re: extending FEM enginering package with Guile
Date: Mon, 5 Jan 2004 23:04:14 +0100	[thread overview]
Message-ID: <20040105220414.GA1670@www> (raw)
In-Reply-To: <200401051920.i05JKHsC023665@minerva.ceride.gov.ar>

On Mon, Jan 05, 2004 at 04:20:17PM -0300, Mario Storti wrote:
> 
>
> [...]                       But there is one point which I find too
> hard, and is the looping constructs. I think that explaining to the
> users concepts like tail-call recursion, or call/cc's is an
> overkill. I'm not speculating here, I have talked with many of them
> (those with better programming skills).  Perhaps such things may be
> used by the developers, but definitely not by the average user. There
> is the `while' special form, but even with this some simple looping
> constructs, like the following in C/C++

Well, scheme has a rather powerfull syntax facility, you can (and probably
should) write syntactic extensions that match your users needs/expectations.
With the help of macros (esp syntax-case e.a.) you can create your domain
specific "little language". After all, this is one of the reasons why
the FSF did choose scheme as their future embedable scripting language.

> while (cond0) {
>       // body1 0;
>       // ...
>       if (cond1) break;
>       // body 1
>       // ...
>       if (cond2) continue;
>       // body 2
>       // ...      
> }
> 
> are hard to write, due to the lack of `break' and `continue' in
> Scheme. I think that one can do that with catch/throw bu it also seems
> an overkill. I found some flame wars between some other Lisp dialects
> and Scheme and I anticipate that I'm not interested in starting such a
> discussion. So:

Flame wars aside, if there is a need for such a syntax it can be implemented.
Heinrich Taube (of Common Lisp Music fame) wrote a guile version of Common
Lisp's loop macro -- i think i once hacked up a guile module wrapper for it.
With that code you can do things like:

 (use-modules (clm iter))

 (define (all-squares-upto number)
   (loop for n in (iota number)
         collect (* n n)))

 (loop for language in '(perl python java cobol)
       do (format #f "~A sucks!" language))

 ;; break out of a loop
 (loop while (= (remainder (current-time ) 2) 0)
       do (format #t "Not yet ~%"))

 
etc. etc.
If you want i can try to find my wrapper and put it online.

 Ralf Mattes
> 
> Question 1: I ask simply if there is some simple way of writing code
> like this previous one in Scheme. 
> 
> Question 2: I have learned that in Scheme it is considered bad
> practice to `set!' variables, or in general to use side-effects. In
> our applications we manipulate huge structures (mainly vectors, sparse
> matrices, graphs, with sizes in the order of several hundredths MBs,
> and running for weeks), and it seems much more efficient to code this way
> (using side-effects). Am I right?
> 
> Question 3: Does anyone knows of some previous development regarding
> Guile/Scheme in a parallel environment? (I mean using message
> passing). 
> 
> Best regards,
> 
> Mario
> 
> -------------------------
> Mario Alberto Storti
> Centro Internacional de Metodos Computacionales
>   en Ingenieria - CIMEC (INTEC/CONICET-UNL)
> INTEC, Guemes 3450 - 3000 Santa Fe, Argentina
> Tel/Fax: +54-342-4511594
> e-mail: mstorti@intec.unl.edu.ar
> http://www.cimec.org.ar/mstorti, http://www.cimec.org.ar
> -------------------------
> 
> 
> 
> _______________________________________________
> Guile-user mailing list
> Guile-user@gnu.org
> http://mail.gnu.org/mailman/listinfo/guile-user


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


  parent reply	other threads:[~2004-01-05 22:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-05 19:20 extending FEM enginering package with Guile Mario Storti
2004-01-05 20:26 ` Paul Jarc
2004-01-05 21:32 ` Ken Anderson
2004-01-05 22:04 ` rm [this message]
2004-01-08  4:58 ` Keith Wright
2004-01-08  6:04   ` Paul Jarc
2004-01-08 22:13     ` Keith Wright
2004-01-09 21:31     ` Keith Wright
  -- strict thread matches above, loose matches on Subject: below --
2004-01-06 19:35 Mario Storti
2004-01-06 22:31 ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040105220414.GA1670@www \
    --to=rm@fabula.de \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).