home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / prolog / 2419 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.5 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!uicvm.uic.edu!u35395
  2. Organization: University of Illinois at Chicago
  3. Date: Thu, 21 Jan 1993 15:48:35 CST
  4. From: C. M. Sperberg-McQueen <U35395@uicvm.uic.edu>
  5. Message-ID: <93021.154835U35395@uicvm.uic.edu>
  6. Newsgroups: comp.lang.prolog
  7. Subject: Re: Help !!
  8. References: <1iv7leINNsc4@rave.larc.nasa.gov> <lenn.726916615@du9ds4>
  9.  <j_hamer-210193105028@john-ha.cs.aukuni.ac.nz>
  10. Lines: 20
  11.  
  12. > How do you go about writing an elegant, efficient solution?  For a start,
  13. > DO NOT TRY TO WRITE IT AS A LOGIC PROGRAM!  What you want is a *function*
  14. > from a list of integers to an integer (no backtracking to multiple
  15. > solutions, or solving for either argument is needed).  Therefore, your
  16. > solution should be written in a functional style.  Most students would have
  17. > little trouble in coming up with the following functional solution (in
  18. > Pascal):
  19.  
  20. If you wanted to write it in Pascal, why didn't you just compile it
  21. in Pascal?  Heiner's program may well run longer than yours.  On the
  22. other hand it is shorter, and much easier to see that it is correct.
  23. Since my machines spend far more time waiting for my keystrokes than
  24. they do working, I see no reason to worry about making code run faster
  25. unless it is now running too slow.  Sufficient unto the day is the
  26. evil thereof; why should I worry about trivial 'inefficiencies' like
  27. those you see in Heiner's code, until they are making my work
  28. unacceptably slow?
  29.  
  30. -C. M. Sperberg-McQueen
  31.  University of Illinois at Chicago
  32.