home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / sci / math / symbolic / 2998 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.2 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!mm-mac25.mse.uiuc.edu!gaylord
  2. From: gaylord@ux1.cso.uiuc.edu (Richard J. Gaylord)
  3. Newsgroups: sci.math.symbolic
  4. Subject: Re: Rootterdam Competition in Mathematica Journal
  5. Message-ID: <BxvDMD.4Gv@news.cso.uiuc.edu>
  6. Date: 17 Nov 92 16:54:11 GMT
  7. Article-I.D.: news.BxvDMD.4Gv
  8. References: <BxtJGM.472@news.cso.uiuc.edu>
  9. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  10. Organization: University of Illinois
  11. Lines: 25
  12. X-Xxdate: Tue, 17 Nov 92 10:55:53 GMT
  13. X-Useragent: Nuntius v1.1.1d12
  14. X-Xxmessage-Id: <A72E803946029B19@mm-mac25.mse.uiuc.edu>
  15.  
  16.  
  17. it has been pointed out to me by Victor at wri that the splitFast
  18. function can be 'elegantized' by dropping the Block structure (which also
  19. gives it a bit more speed).
  20.  
  21.  
  22. > splitFastandElegant[lis_, parts_] := 
  23.    Inner[Take[lis,{#1,#2}]&,
  24.            Drop[#1,-1]+1,
  25.            Rest[#1],
  26.            List]&[ FoldList[Plus,0,parts] ]
  27.  
  28.  
  29. comparing this to my program
  30.  
  31. split[lis_, parts_] :=
  32.   Map[Take[lis, #]&,
  33.        Drop[Thread[List[# + 1, RotateLeft[#]]]&
  34.                       [FoldList[Plus,0,parts]], -1] ] 
  35.  
  36. i have to agree with victor that the top program is really nice looking
  37. (i like using Inner).  
  38.  
  39.  
  40. 'in gustibus non disputandum'
  41.