On Apr 26, 2009, at 9:43 AM, Michele Simionato wrote:

There is no end to my questions.

But you're getting close to understanding the phases :-)

Study the next library and let me know if you have questions.

Aziz,,,

(library (times)
  (export expand-time visit-time invoke-time)
  (import (rnrs) (srfi :19))

  ;;; when (times) is expanded
  ;;; one value per compilation of this library
  ;;; subsequent initialization still use the same
  ;;; value computed when (times) is compiled
  (define expand-time
(let-syntax ([isodate (lambda (x) (date->string (current-date) "~5"))])
      isodate))

  ;;; when (times) is visited
  ;;; one value per visit instance
  ;;; next time you visit this library, the value is different
  (define-syntax visit-time
    (let ([isodate (date->string (current-date) "~5")])
      (lambda (x) isodate)))

  ;;; when (times) is invoked
  ;;; one value per invoke instance
  ;;; next time you invoke this library, the value is different
  (define invoke-time
    (let ([isodate (date->string (current-date) "~5")])
      (lambda () isodate)))

  ;;; current-time is when this procedure is called
  ;;; one value per call to this procedure
  (define run-time
    (lambda ()
      (let ([isodate (date->string (current-date) "~5")])
        isodate)))

  ;;; macro-time is a macro that records when the macro is expanded
  ;;; one value per occurrence of (macro-time) in the code
  (define-syntax macro-time
    (lambda (stx)
      (let ([isodate (date->string (current-date) "~5")])
        isodate)))

  )


Reply via email to