swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling equations as objects


From: Jayshree Sarma
Subject: Re: Handling equations as objects
Date: Fri, 21 Aug 1998 10:51:04 -0400 (EDT)

Thanks for the suggestion, it does seem complicated. I will borrow the
book and explore if I want to use the C interpreter.

Jayshree

On Wed, 19 Aug 1998, Benedikt Stefansson wrote:

> This is an interesting problem,
> 
> I haven't found a solution for it myself, but the first idea that pops
> into my head is that one of the texbooks that I used when I was learning
> C contained code for a C interpreter written in C:
> 
>       C : The Complete Reference 
>       Herbert Schildt
>       Paperback - 912 pages 3rd edition (March 1995) 
>         Osborne McGraw-Hill; ISBN: 0078821010 
> 
> By the way the book itself is clearly and well written but according to
> most good C programmers both misleading and dangerous, professional
> programmes have apparently immortalized poor Herbert by coining the term
> "bullschildt" for a horribly wrong assertion (about a programming
> language) which is nonchalantly presented as fact. In other words, don't
> spend your hard earned money on this book, but borrow it from the
> library. 
> 
> Anyway, I think the C interpreter works. One could wrap an object around
> this code (or perhaps some even simpler expression parser if one can be
> found), and put in features to read the equations from strings or from
> files. Basically it would behave like an ObjectLoader or InFile object: 
> 
>       +readExpressionFromString: (char *) s;
>       +readExpressionFromFile: (FILE *) f;
> 
> The tricky part is to pass in the values for the equation arguments, the
> cleanest way would probably be a another wrapper, (? <FunctionValues>)
> subclassed from List maybe, which could contain an arbitrary long array
> of values, where the order and number of arguments would probably have
> to be known at compile time. Then the Expression object could have a
> method such as:
> 
>       +(double) evaluateExpressionWith: (id <FunctionValues>) v;
> 
> I hope that this idea prompts someone to cry 'overkill' and come up with
> a neater solution...and I think a solution could be very useful indeed.
> 


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]