DBC in functional languages [Was: comparison OOP and FP] 
Author Message
 DBC in functional languages [Was: comparison OOP and FP]

Patrick Doyle escribi:

Quote:
>Well, without DBC I don't know if I'd say that something is
>"perfect" for reusable libraries.  Maybe if someone managed
>to apply DBC to functional programming, that would be
>"perfect".

WHA'???

  --  Phlip at politizen dot com                  (address munged)
======= http://www.*-*-*.com/ ~tegan/home.html =======
  --  My opinions are those of your employer  --



Sat, 07 Jul 2001 03:00:00 GMT  
 DBC in functional languages [Was: comparison OOP and FP]
Phlip escribi:

Quote:
>Patrick Doyle escribi:

>>Well, without DBC I don't know if I'd say that something is
>>"perfect" for reusable libraries.  Maybe if someone managed
>>to apply DBC to functional programming, that would be
>>"perfect".

>WHA'???

Allow me to rephrase that.

Insofar as Design By Contract is something you do _with_ a language,
not a feature of the language itself (unless, obviously, you are
Eiffel), I thought one could apply it to any language, and that some
languages might make this harder than others.

Since the functional languages try to make things easy, not hard, I
don't understand why they can't do DBC. Examples, anyone, pro or con?

Quote:
>  --  Phlip at politizen dot com                  (address munged)
>======= http://users.deltanet.com/~tegan/home.html =======
>  --  My opinions are those of your employer  --



Wed, 11 Jul 2001 03:00:00 GMT  
 DBC in functional languages [Was: comparison OOP and FP]

Quote:

> However, I'd also like to add that I don't consider a language without
> higher-order functions to be "perfect" for reuse either.  This includes
> Eiffel. (Sure, you can simulate HOFs with little classes, but then you MAWUA.
>  :-) Eiffel is also in the process of getting the capability for fairly good
> higher-order functions.

How is reuse and higher-order functions so closely coupled? Perhaps, you
can illustrate with an example.

--
Regards,
Biju Thomas



Mon, 06 Aug 2001 03:00:00 GMT  
 DBC in functional languages [Was: comparison OOP and FP]

Quote:


>> However, I'd also like to add that I don't consider a language
without
>> higher-order functions to be "perfect" for reuse either.  This
includes
>> Eiffel. (Sure, you can simulate HOFs with little classes, but
then you MAWUA.
>>  :-) Eiffel is also in the process of getting the capability for
fairly good
>> higher-order functions.

>How is reuse and higher-order functions so closely coupled?
Perhaps, you
>can illustrate with an example.

What's a HOF?

And why does Perl - a functional language that strictly enforces the
principle Design by Anarchy - have a CPAN library of many hundreds
of completely Plug-n-Play reusable modules??

  --  Phlip at politizen dot com                  (address munged)
======= http://users.deltanet.com/~tegan/home.html =======
  --  Coffee: The most important meal of the day  --



Mon, 06 Aug 2001 03:00:00 GMT  
 DBC in functional languages [Was: comparison OOP and FP]

Quote:


> How is reuse and higher-order functions so closely coupled? Perhaps, you
> can illustrate with an example.

Consider a few simpler higher-order functions such as reduction and
scan from J (derived from APL):

NB. Reduce (/)inserts the left operand (+) among the list of subarrays
        formed by splitting the right argument along the first axis:

    +/ 3 3 {reshape} 1 2 3  10 20 30 100 200 300
111 222 333

NB. Scan(\)  is like reduction, but you get the partial results:
    +\3 3 {reshape} 1 2 3 10 20 30 100 200 300
   1     2      3
 11   22    33
111 222 333

Here's some examples of scans and reductions:
   +/   NB. sum over an array
   */   NB. product over an array
   {max}/  NB. maximum over an array
   =/    NB. Parity of a Boolean array
  {ne}\ txt=''''  NB. Mark quoted strings in txt.
   ^\txt=' '  NB. Mark leading blanks in txt.

Since these work on arrays of any rank(dimension), they hide the N levels
of FOR loop that would be required in a scalar-oriented expression.

Code reuse thus acknowledges the fact that several ways of applying
functions to arrays are quite common in practice.

Bob



Tue, 07 Aug 2001 03:00:00 GMT  
 DBC in functional languages [Was: comparison OOP and FP]


Quote:


> > How is reuse and higher-order functions so closely coupled? Perhaps, you
> > can illustrate with an example.

Many methods in Dylan take methods as arguments.  Sometimes the method is
a required argument such as in the case of the 'map' method, and sometimes
the method is only an optional argument, such as for 'sort' where the
method defaults to ==, but you can supply your own comparison method if
you wish.

--

Dylan... the high-performance dynamic language
 * open-source Unix version:  http://www.gwydiondylan.org/
 * free Win32 version: http://www.harlequin.com/products/ads/dylan/



Tue, 07 Aug 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. FP in a larger scale (Re: Comparison of functional languages)

2. FP in a larger scale (Re: Comparison of functional languages)

3. OOP and classes, Was: OOP & Functional Languages

4. comparison OOP and FP (and how to put them together) was: Re: need help with haskell

5. Speed of FP languages, prospects (was Re: Benchmarking Lazy Functional Languages)

6. What language do you think is a good combination between OOP and FP

7. FP Component Libraries? (FP vs OOP)

8. OOP language comparison papers

9. comparison of OOP languages?

10. comparison of OOP languages?

11. Comparison of various functional languages?

12. Comparison of functional languages

 

 
Powered by phpBB® Forum Software