I'd like to do this but am not sure if it's possible
( case
#= start of match clause
(
(prog
(if () (EXIT THIS MATCH CLAUSE/PROG))
(otherwise you'll execute this statement)
)
)
#= end of match clause
.
.
.
I also wonder if there'
dean, I would use unless.
See this control structure below as an alternative to the prog/if
: (setq Test1 1)
-> 1
: (case Test1 (1 (unless Test2 (prinl "true"
true
-> "true"
: (setq Test2 "Nope")
-> "Nope"
: (case Test1 (1 (unless Test2 (prinl "true"
-> NIL
On Thu, Jan 19, 2017 at 7:5
Thank you very much Joe.,,,I see what you mean and don't think I've been
clear enough.
I'll try and put a better example together.
It might be because of Lisps "everything returns a value" my constructs
aren't compatible.
We'll seeback soon.
On 19 January 2017 at 13:13, Joe Bogner wrote:
> d
Ok here we are...
This is the nearest I can get in PL with my limited familarity i.e. a very
flat structure
(setq Pg_bks 7)
(setq Lns_from_top 6)
(setq Do_it T)
(case 2
(1 (prinl "in 1"))
(2
(if (> 2 Pg_blks) (setq Do_it NIL))
(if (> 6 Lns_from_top) (setq Do_it NIL))
(
Hi Dean,
> I'd like to do this but am not sure if it's possible
>
> ( case
>#= start of match clause
>(
>(prog
>(if () (EXIT THIS MATCH CLAUSE/PROG))
>(otherwise you'll execute this statement)
>)
> )
> #= end of match clause
>
Hi Alex
Thank you for confirming no return and the alternative.
Best Regards
Dean
On 19 January 2017 at 14:44, Alexander Burger wrote:
> Hi Dean,
>
> > I'd like to do this but am not sure if it's possible
> >
> > ( case
> >#= start of match clause
> >(
> >(prog
> >
I think 'unless' with 'or' might be what you're looking for.
(unless
(or
(cond1 ...)
(cond2 ...)
(cond3 ...))
(call1 ...)
(call2 ...))
'or' is short-circuited, so the conditions will be evaluated in order. If
one of the conditions is true, NIL will be returned. All the calls wil
Hi Dean,
> (setq Pg_bks 7)
> (setq Lns_from_top 6)
> (setq Do_it T)
> (case 2
>(1 (prinl "in 1"))
>(2
> (if (> 2 Pg_blks) (setq Do_it NIL))
> (if (> 6 Lns_from_top) (setq Do_it NIL))
> (if (Do_it) (prinl "yes doing a"))
> (if (Do_it) (prinl "yes doing b"))
>
On Thu, Jan 19, 2017 at 05:50:00PM +0100, Alexander Burger wrote:
> Note that (setq Do_it NIL) is (off Do_it), and you could also use an 'or' for
> the two equal consequences. Then the above becomes:
>
>(setq
> Pg_bks 7
> Lns_from_top 6
> Do_it T )
>(case 2
> (1 (pr
Hi John
Yes...you're right...I was using an (if (or (stop test 1) (stop test 2))
(do nothing) (do all the stuff)
but your "unless" is much more direct.
Hi Alex
Yes I like that a lot!
Thank you both for your further help.
Best Regards
Dean
On 19 January 2017 at 17:02, Alexander Burger wrote:
> On
11 matches
Mail list logo