I'm trying to add a continuation mark inside a function, but I want
that the new mark to be visible after the functions returns. (Mostly
for curiosity, not an actual problem.)

I want something like this:

;--
#lang racket/base

(define (display-cm-x)
  (displayln
   (continuation-mark-set->list
    (current-continuation-marks) 'x)))

(define (add-cm-x v)
  '???)

(define-syntax-rule (with-cm-x v body ...)
  (with-continuation-mark 'x v
    body ...))

(let ()
  (display-cm-x) ;==>()
  (with-cm-x 7
    (display-cm-x)) ;==>(7)
  (display-cm-x) ;==>()
  (add-cm-x 7)
  (display-cm-x) ;actual==>(), expected==>(7)
  )
;--

The last line prints (), but I wish it prints (7).

Gustavo
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to