Guest User

Untitled

a guest
Jul 11th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. Red[
  2. author: "Nędza Darek"
  3. ]
  4. str: "a1bcvcvba2mcbncva3z"
  5. find str "a"
  6.  
  7. iterator: copy #()
  8. find-next: func [
  9. str candidate
  10. /local
  11.  
  12. ][
  13. iterator/candidate: candidate
  14. iterator/__series: str
  15. iterator/value: find iterator/__series iterator/candidate
  16. iterator/next: func [][
  17. iterator/__series: next iterator/value
  18. iterator/value: find iterator/__series iterator/candidate
  19. iterator
  20. ]
  21. iterator
  22. ]
  23. probe it: find-next str "a"
  24. comment {
  25. #(
  26. candidate: "a"
  27. __series: "a1bcvcvba2mcbncva3z"
  28. value: "a1bcvcvba2mcbncva3z"
  29. next: func [][
  30. iterator/__series: next iterator/value
  31. iterator/value: find iterator/__series iterator/candidate
  32. iterator
  33. ]
  34. )
  35. }
  36. ; comment section has only changing part of the map
  37.  
  38. probe it/next
  39. comment {
  40. __series: "1bcvcvba2mcbncva3z"
  41. value: "a2mcbncva3z"
  42. }
  43. probe it/next
  44. comment {
  45. __series: "2mcbncva3z"
  46. value: "a3z"
  47. }
Add Comment
Please, Sign In to add comment