home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / hp48 / 5590 < prev    next >
Encoding:
Text File  |  1992-11-07  |  2.1 KB  |  42 lines

  1. Newsgroups: comp.sys.hp48
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!purdue!mentor.cc.purdue.edu!noose.ecn.purdue.edu!en.ecn.purdue.edu!blair
  3. From: blair@en.ecn.purdue.edu (Marc E Blair)
  4. Subject: Re: (up/dn)MATCH Q's...
  5. Message-ID: <1992Nov5.221914.16695@en.ecn.purdue.edu>
  6. Organization: Purdue University Engineering Computer Network
  7. References: <Bx5Aoy.L7A@ireq.hydro.qc.ca> <STEVEV.92Nov3113953@miser.uoregon.edu> <1992Nov3.220518.9744@tamsun.tamu.edu>
  8. Date: Thu, 5 Nov 92 22:19:14 GMT
  9. Lines: 31
  10.  
  11. In article <1992Nov3.220518.9744@tamsun.tamu.edu> apj6796@tamsun.tamu.edu (Albert Paul Jimenez III      ) writes:
  12. >
  13. >
  14. >
  15. >3) anyone got any more documentation on this thing? 
  16. >   hopefully including a way to specify which occurance to substitute in for
  17. >   (# of possible subs is on lvl 1 after the MATCH cmd) so i can do simple communative swapping on say, just the 2nd _AND_ in '(A AND B) OR (C AND D)' instead of haveing to swap the whole thing with << { '&1 AND &2' '&2 AND &1' } ?MATCH DROP >>
  18. >
  19. >A bit of non-cents from me to you...
  20.  
  21. Well, I have found a couple of neat things using the match command...
  22. I always wanted to do Laplace Transforms using the match command, but had some trouble
  23. because I wanted to know exactly WHAT was substituted.  (I don't remember why now)
  24. Say I had 'X^2+Y^2' and did a { '&A^2' '&A*&A' } and wanted to know what &A was
  25. after the substitution (which I believe occurs one at a time, putting a ONE on
  26. the stack if a substituion was made (Useful for do-until-done matching)) So I did
  27. this.
  28. 'X^2+Y^2'
  29. { '&A^2' '&A*&A' '&A==MYPROG' }
  30. MATCH?
  31. Where MYPROG was a program that looked at level one on the stack,
  32. which happened to be &A! (X in this case).  This way, I could 
  33. check to see if I should transform '1/&A^2' using rules for
  34. '1/S^2' or 1/(S+2)^2.  MYPROG also has to return two equal values to the stack
  35. so that the equality can become true and a substitution will occur.
  36. (Or two unequal values if you decide that the substituion is not
  37. appropriate.) Let me know if you find this helpful or need further help
  38. understanding what I tried to say.  Happy matching!
  39.  
  40. Marc Blair
  41. blair@en.ecn.purdue.edu
  42.