[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Executing part of the code instead of another
From: |
tomas |
Subject: |
Re: Executing part of the code instead of another |
Date: |
Wed, 7 Oct 2020 16:01:50 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, Oct 07, 2020 at 03:48:51PM +0200, Christopher Dimech wrote:
> It would be better if you explain to me this progn stuff
>
> Have tried an example like this
>
> (setq na 8)
> (setq nb 13)
> ( if (> nb na)
> progn (
> (message "nb > na condition [condition is true]")
> (message "nb > na condition [condition is true]")
> )
No. Written in Lisp, it's
(progn
(thing 1)
(thing 2)
...)
In C (and in conventional maths, you'd write it as you did
above).
Note that it's the same way as you write (message "foo")
[you don't write message("foo"), as you'd do in C or
Python or what not).
Progn is a form to bundle a sequence of forms, which are
evaluated one after the other. The value of progn is
that of the last form evaluated (that's the -n), as opposed
to prog1, which would do the same as progn, but return the
value of its first form.
Cheers
- t
signature.asc
Description: Digital signature
- Re: Executing part of the code instead of another, (continued)
- Re: Executing part of the code instead of another, Gregory Heytings, 2020/10/07
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Emanuel Berg, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Stefan Monnier, 2020/10/07
- Re: Executing part of the code instead of another, Robert Pluim, 2020/10/07
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another,
tomas <=
- Re: Executing part of the code instead of another, Christopher Dimech, 2020/10/07
- Re: Executing part of the code instead of another, Leo Butler, 2020/10/08
- RE: Executing part of the code instead of another, Drew Adams, 2020/10/07
- Re: Executing part of the code instead of another, Douglas Lewan, 2020/10/18