www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/16/03:51:54

Date: Fri, 16 Sep 1994 00:20:02 -0400
From: davis AT amy DOT tch DOT harvard DOT edu ("John E. Davis")
To: djgpp AT sun DOT soe DOT clarkson DOT edu, sands AT clipper DOT ens DOT fr
Subject: RE: User defined functions

>1) use an existing language.  Thanks to DJ, John Davis and Guarionex Morales
>   for suggesting bc, slang and tcl respectively.  At first glance slang seems
>   to me to offer more: it resembles bc but has many more features; it can be
>   embedded easily into a program; like bc what you type is byte compiled, so
>   fairly fast.  Unlike bc it only has finite precision arithmetic, but for
>   me that's an advantage: it's all I want and is faster than infinite
>   precision arithmetic.  Recursive function definitions aren't allowed,
>   unlike bc ( am I right John? ).  I haven't looked closely at tcl but John

No.  They are allowed.  Simply declare the function first:

    define factorial ();
    
    define factorial (n)
    {
       if (n <= 1) return 1;
       return n * factorial (n - 1);
    }

--John

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019