loop.scm 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ;;; foof-loop.sls ---
  2. ;; Copyright (C) 2009, 2010 Andreas Rottmann <a.rottmann@gmx.at>
  3. ;; Author: Andreas Rottmann <a.rottmann@gmx.at>
  4. ;; This program is free software, you can redistribute it and/or
  5. ;; modify it under the terms of the new-style BSD license.
  6. ;; You should have received a copy of the BSD license along with this
  7. ;; program. If not, see <http://www.debian.org/misc/bsd.license>.
  8. ;;; Commentary:
  9. ;;; Code:
  10. #!r6rs
  11. (library (arguile loop)
  12. (export
  13. loop
  14. lazy-loop
  15. =>
  16. for
  17. until
  18. where
  19. let-values
  20. while
  21. listing
  22. listing-reverse
  23. appending
  24. appending-reverse
  25. listing!
  26. listing-into!
  27. summing
  28. multiplying
  29. maximizing
  30. minimizing
  31. initial
  32. up-from
  33. down-from
  34. to
  35. by
  36. in-list
  37. in-lists
  38. in-vector
  39. in-vector-reverse
  40. in-string
  41. in-string-reverse
  42. in-port
  43. in-file
  44. )
  45. (import
  46. (rnrs)
  47. (only (rnrs mutable-pairs) set-cdr!)
  48. (srfi :8 receive)
  49. (srfi :45 lazy)
  50. (arguile lib syn-param)
  51. (arguile lib private include))
  52. (define-syntax define-aux
  53. (syntax-rules ()
  54. ((_ id ...)
  55. (begin
  56. (define-syntax id
  57. (lambda (x)
  58. (syntax-violation #f "invalid use of auxiliary keyword" x 'id)))
  59. ...))))
  60. (define-aux
  61. for
  62. to
  63. by
  64. where
  65. until
  66. while
  67. initial)
  68. (include-file/downcase ((arguile loop) loop))
  69. )