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"))
>       (if (Do_it) (prinl "yes doing c")))
> 
> 
> I'm really after this.
> I like it because of the very flat structure, I can write the "stop" rules
> in a very natural way and One objection stops any further execution. I have
> had some very experienced programmers comment that this style is
> ugly....Maybe but I find it very easy to understand/maintain.
> 
> #fn some_fn   or in lisp (prog......)
> #   if cond1 then exit fn
> #   if cond2 then exit fn
> #   do a
> #   do b
> #   do c
> #end fn

This is a typical 'cond' case

   (cond
      ((> 2 Pg_blks) (setq Do_it NIL))
      ((> 6 Lns_from_top) (setq Do_it NIL))
      (Do_it
         (prinl "yes doing a")
         (prinl "yes doing b")
         (prinl "yes doing c") ) )


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 (prinl "in 1"))
      (2
         (cond
            ((or (> 2 Pg_blks) (> 6 Lns_from_top))
               (off Do_it) )
            (Do_it
               (prinl "yes doing a")
               (prinl "yes doing b")
               (prinl "yes doing c") ) ) ) )

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to