タグ

ブックマーク / gist-slide.appspot.com (1)

  • マクロと限定継続

    限定継続(shift/reset)shiftはresetまでの継続をとる (reset (+ (shift k (k 1)) 2)) ; => 3 ; k = (fn [x] (+ x 2)) 実装shiftは継続コンテキストを返す resetはcallによる継続渡し形式に変換 callは継続を適用する (macroexpand (quote (reset (+ (shift k (k 1)) 2)))) (cont.core/call + (fn* [G__3646] (cont.core/call (new cont.core.Context (fn* [k] (k 1))) (fn* [G__3647] (cont.core/call (G__3646 G__3647 2) (fn* [G__3645] G__3645)))))) 例非決定性計算 (defn amb [& xs] (

  • 1