home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / sources / 2574 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.8 KB

  1. Path: sparky!uunet!mcsun!ub4b!news.cs.kuleuven.ac.be!blekul11!frmop11!barilvm!vms.huji.ac.il!wisipc.weizmann.ac.il!menora.weizmann.ac.il
  2.  dov
  3. Newsgroups: alt.sources
  4. Subject: Re: med -- expression evaluator and stream-based math processor
  5. Message-ID: <1992Nov18.131601.6986@wisipc.weizmann.ac.il>
  6. From: dov@menora.weizmann.ac.il (Dov Grobgeld)
  7. Date: Wed, 18 Nov 1992 13:16:01 GMT
  8. Sender: news@wisipc.weizmann.ac.il
  9. References: <1992Nov16.160145.7707@athena.mit.edu>
  10. Organization: Weizmann Institute of Science, Computation Center.
  11. Lines: 29
  12.  
  13. scs@adam.mit.edu (Steve Summit) writes:
  14. :
  15. : It will be noted that med is an awful lot like awk, much less
  16. : flexible in general, but optimized for performing arithmetic on
  17. : columns of numbers.  Purists will claim that med is superfluous
  18. : and unnecessary, because it can't do anything awk can't do; they
  19. : are in fact correct.  (med was originally a throwaway, I brought
  20. : it to its current, mostly "finished" state only because I was
  21. : doing a lot of manipulation of data files on some MS-DOS machines
  22. : lacking awk.)
  23. :
  24. [Lot's of stuff and source deleted.]
  25.  
  26. But MS-Dos has got Perl. Here's my Perl variant of the same program:
  27.  
  28. perl -ne 's/^\s+//; @c=split; print $c[2] . " " . sqrt($c[0]^2+$c[1]^2)' in.dat
  29.  
  30. I make these kind of filters all of the time to do coordinate
  31. transformations in my research.
  32.  
  33. Why reinvent the wheel when the wheel is a swiss motor chain-saw?
  34. --
  35.                                                         ___   ___
  36.                                                       /  o  \   o \
  37. Dov Grobgeld                                         ( o  o  ) o   |
  38. The Weizmann Institute of Science, Israel             \  o  /o  o /
  39. "Where the tree of wisdom carries oranges"              | |   | |
  40.                                                        _| |_ _| |_
  41.  
  42.