print-utils.scm 685 B

123456789101112131415161718192021222324252627282930
  1. (library (lib print-utils)
  2. (export debug print println)
  3. (import
  4. (except (rnrs base) let-values map)
  5. (only (guile)
  6. lambda* λ
  7. map
  8. ;; printing
  9. display
  10. simple-format
  11. current-output-port
  12. ;; strings
  13. string-join
  14. ;; control flow
  15. when))
  16. (define thing->string
  17. (λ (thing)
  18. (simple-format #f "~a" thing)))
  19. (define print
  20. (lambda* (#:key
  21. (output-port (current-output-port))
  22. (sep " ")
  23. (end "\n")
  24. . msgs)
  25. (simple-format
  26. output-port "~a"
  27. (string-append (string-join (map thing->string msgs) sep) end)))))