home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7428 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  1.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!reed!mjeffery
  2. From: mjeffery@reed.edu (Mark Jefferys)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: In 5.0, are we gonna get...
  5. Message-ID: <1992Dec15.051950.1679@reed.edu>
  6. Date: 15 Dec 92 05:19:50 GMT
  7. Article-I.D.: reed.1992Dec15.051950.1679
  8. References: <1992Dec14.043835.23009@reed.edu> <1992Dec14.161234.21332@news.eng.convex.com>
  9. Organization: Reed College, Portland, OR
  10. Lines: 28
  11.  
  12. In article <1992Dec14.161234.21332@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
  13. % From the keyboard of mjeffery@reed.edu (Mark Jefferys):
  14.  
  15. % :1) an equivalent of lisp's mapcar?  For an instance:
  16. % :
  17. % :    map(/(\d+)/, "asdf 23fjk4", "qwerty", "123 ")
  18.                   ^ forgot the `g'        
  19. % :
  20. % :   would return ("23", "4", "123").
  21.  
  22. % I'd like to use
  23. %     grep(/(\d+)/g, "asdf 23fjk4", "qwerty", "123 ")
  24. % but that doesn't work for two reasons:
  25. %     1) i haven't been able to tickle grep's expr into an array context
  26. %     2) it returns the original elt, not the expr result
  27.  
  28. That's why I want something like mapcar.  I come across enough cases
  29. where I've wanted one, but had to write some ugly replacement.  I
  30. thought about it awhile, and decided that it's the sort of thing that
  31. should be built-in.
  32.  
  33.  
  34. Mark
  35. -- 
  36. Mark Jefferys        Internet: mjeffery@reed.edu
  37.