From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!feed2.news.rcn.net!rcn!feed3.news.rcn.net!not-for-mail Sender: jsa@rigel.goldenthreadtech.com Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request References: <49dc98cf.0408110556.18ae7df@posting.google.com> From: jayessay Organization: Tangible Date: 29 Aug 2004 11:08:18 -0400 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: DXC=@ao9VTQ>? kevin.cline@gmail.com (Kevin Cline) writes: > You can not judge the readability of a program by testing whether a > naive programmer can understand the program line by line. Would you > consider a book on multivariate calculus to be poorly written because > it was not immediately understandable by the average high-school > graduate? Concise mathematical notation makes it possible to reason > about mathematical objects at a high level. > So, instead of "limit(e->0) [f(x + e) - f(e)] / e", we write "f'(x)" I tend to agree with you here. Paul Graham has some interesting things to say about this stuff: http://www.paulgraham.com/power.html [Actually, he has insightful things to say about a lot of stuff...] With Common Lisp you could (actually this has been done...) define some macros creating a small domain specific language for differentiation and integration. Then you could do things like: (d/d? (3*x + (cos x)/x) x) ==> # (((cos x) - (x * (- (sin x)))) / (x ^ 2)) + 3 where the function returned is the compiled (yes, to machine code) form of the derivative.[1] So, you could then write something like this: (defun apply-derivative (fn &key (of 'x) to) (funcall (d/d? fn of) to)) (apply-derivative ((x ^ 2) + 2) :to 3) ==> 6 For functions the system doesn't know how to differentiate (or more likely integrate), you could punt off to a typical iterative approximater. > Similarly, writing applications concisely at a high level of > abstraction makes it easier for programmers experienced in the domain > to modify the application to meet new requirements. This is definitely true. This is why domain specific languages are so potent, but unless you are using something like Common Lisp they tend not to be built because the effort is much too high to make them cost effective [2]. > The Boost::spirit parser library for C++ is an excellent example of > the power of C++ templates... But this is what I don't understand. Why would anyone with this point of view hamstring themselves by using something so inexpressive as C++??? /Jon 1. The actual input form resulting in the compiled function here would be (lambda (x) (+ 3 (/ (- (cos x) (* x (- (sin x)))) (expt x 2)))) 2. See: Greenspun's tenth law -- 'jay' - a n t h o n y at romeo/november/charley com