継続に関するtaniminaのブックマーク (13)

  • [Scheme-reports] Fwd: Comments on draft 6 about call/cc

    Alex Shinn alexshinn at gmail.com Mon Feb 20 02:36:08 EST 2012 Previous message: [Scheme-reports] Comments on draft 6 Next message: [Scheme-reports] Fwd: Comments on draft 6 about call/cc Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Forwarding to the list. Thank you very much for your comments, Oleg! I'll reply separately. -- Alex ---------- Forwarded message ---------- From: <ol

  • An argument against call/cc

    We argue against call/cc as a core language feature, as the distinguished control operation to implement natively relegating all others to libraries. The primitive call/cc is a bad abstraction -- in various meanings of `bad' shown below, -- and its capture of the continuation of the whole program is not practically useful. The only reward for the hard work to capture the whole continuation efficie

  • Continuations and Delimited Control

    Introduction to programming with shift and reset Implementations of delimited control in OCaml, Haskell and Scheme A substructural type system for delimited continuations Streams and Iteratees How to remove a dynamic prompt: static and dynamic delimited continuation operators are equally expressible An argument against call/cc Generators: yield = exceptions + non-determinism Generic Zipper: the co

  • KMP's PFAQ: UNWIND-PROTECT vs Continuations (page 3)

    Kent’s Original Complaint This original document was later updated. Click on the above tabs to see the updates. Problem Description The thesis of this article is that Scheme is mis-designed in that it does not seriously allow for the implementation of unwind-protect. The community of Scheme designers has rejected my repeated calls over the years to fix this problem. The The Revised5 Report on the

  • Three Dogmas of Scheme

    Three Dogmas of Scheme (Recursion, Single name space and Continuation) R6RS にざっと目を通して一番驚いたのはそれまでの表示意味論が捨てられてしまっていることでした。 しかし 表示意味論 を捨てるなら以下に並べる Scheme 三つのドグマも捨てられなきゃ嘘だろう、ということでコメントしてみます。 Recursion (再帰) Scheme は何でも再帰です。 後で示すように、一見 iteration のような格好をしている構文ですら、 一旦末尾再帰に置き換えられてから実行されます。 つまり Scheme はその仕様に iteration を持ちません。 これが関数型プログラミングと関係の深い表示意味論からの要請であったことは容易に想像がつきます。 しかし、表示意味論が捨てられた今、反復制御構造に recursion

  • composable-continuations-tutorial

    Composable continuations are a means of inverting control by reification of continuation segments. This sounds like a horrible mouthful of jargon to express a disgustingly complex concept, but it's actually not. This is why. We shall begin by introducing two new special forms, reset and shift.[1] (reset expression) sets up a special continuation, or mark on the stack, and evaluates expression. Thi

  • 思考実験: returnを関数と思ってみる話 - d.y.d.

    21:07 09/03/26 zipWithN twitterでいけがみさんが張ってらした論文が面白かったです。 map f [a1, a2, ..., an] ==> [f a1, ..., f an] zipWith f [a1, ..., an] [b1, ..., bn] ==> [f a1 b1, ..., f an bn] zipWith3 f [a1, ..., an] [b1, ..., bn] [c1, ..., cn] ==> [f a1 b1 c1, ..., f an bn cn] ... zipWith7 f [a1, ..., an] [b1, ..., bn] ... [g1, ..., gn] ==> [f a1 b1 … g1, ..., f an bn … gn] Haskell98 の標準ライブラリの関数ですけど、 1引数関数 f と1つのリスト as

    tanimina
    tanimina 2010/02/22
    first-class return = first-class continuation (cf. first-class label = first-class continuation→http://d.hatena.ne.jp/lemniscus/20100210/1265802932 )
  • delimited continuation - ocaml-nagoya

    限定継続とは? † 継続は「その後の計算」を表現したものです。対して、限定継続は「特定の範囲のその後の計算」を表現したものです。つまり、継続がグローバルな「その後」とイメージするならば、ローカルな継続が限定継続という感じです。 限定継続を扱う演算子には主にshift/resetのペアとprompt/controlのペアがあります。それぞれ静的な演算子、動的な動的な演算子と呼ばれます。(その理由はschmeとかのdynamic bindingとかと関係あるらしいけど、よくわかりません)

    tanimina
    tanimina 2010/02/22
    部分継続(限定継続)に関するリンク集
  • Scheme:なぜSchemeにはreturnが無いのか

    あるいは、なぜcall/ccがプリミティブなのか、に関する一考察 (Shiro: 「なんでも継続」に入れようかと思ってたネタだけど、 あっちがいつ書けるかわからんので、忘れないようにこっちにまとめとく) (話の流れがあるので、誤りの修正以外のコメントは途中ではなく、一番下にお願いします) returnはどこだ? Aliceは、リストlisと述語手続きpredを取り、lisの各要素に順にpredを適用して、 predが真の値を返したら直ちにその要素を返すような関数findを 書くことを考えた。 (findは便利なので、実はsrfi-1に定義されてるけど、 Aliceはまあ自分の勉強のために書いてみることにしたと思いねえ)。 AliceはPerlなら良く知っている。Perlならこんな感じで書けるはず。 sub find { ($pred, $lis) = @_; foreach $elt (@

    Scheme:なぜSchemeにはreturnが無いのか
  • call/ccと古典論理のカリー・ハワード対応 - 再帰の反復blog

    「直観主義論理のカリー・ハワード対応」の続き。 call/ccと継続 call/ccというのは、gotoを強力にしたものだと思っておけば良い。ただしScheme以外のプログラミング言語では、あまり見かけない機能。 例えばブロック構造から抜け出すための命令がある言語を考える。どのブロックから抜け出すかはラベルで指定する。またラベルはギリシャ文字で表すことにする。とりあえず次のような感じになるだろう。jumpの部分を実行するとブロックから抜け出す。 :α{ ... ... jump α; ... // ここは実行されない }でも、ブロック自体が値を持っている(値を返す)ようにした方が汎用的になる。例えば、次のプログラムはflagが真ならxに1が代入され、偽なら2が代入される。 x = :α{ ... ... if (flag) { jump α 1; } ... 2; }値を返すにしても返さな

  • CiteSeerX

    About CiteSeerX is an evolving scientific literature digital library and search engine. @2007-2024 The Pennsylvania State University

    tanimina
    tanimina 2010/02/15
    ラムダ計算にcall/ccを追加すると古典論理に対応する
  • 2008-04-17

    callcc と shift/reset についてわかるとこだけ書いてみます。 継続 callcc という操作は、現在から実行終了まで、継続をまるごと取り出します。例題。 p [1] + callcc {|k| [2] + k.call([3]) } #=> [1, 3] callcc では callcc がリターンしてから実行終了するまでの継続 k が取り出せます。k.call([3]) で継続が呼ばれると、いきなり「callcc が [3] を返した瞬間」に実行が飛びます。つまりこんな感じ。 p [1] + [3] あとは自明ですね。"[2] +" のあたりは無視されます。 部分継続 shift という操作は、現在から reset まで、継続の一部だけを取り出します。この継続の一部を部分継続といいます。例題。 p [1] + reset { [2] + shift {|k| [3] +

    2008-04-17
  • 部分継続について本気出して考えてみた - (new Hatena).blog()

    以前何度か部分継続について書いたことがあるんですが、当時は表面的な振る舞いを観察して何となく分かった気になった程度の拙い説明しか出来ませんでした。 その上、最近のプログラミングでもほとんど活用しておらず、改めて理解し直す必要を感じてきた次第です。 そこで今回は、部分継続の概念的な理解を目指し、基礎的な事柄を中心にまとめていきたいと思います。 基的に PLT Scheme (MzScheme) の評価モデルに即して書いていくため、Scheme 一般に当てはまる話になっていない部分もあるかも知れません。その点ご了承ください。 Redex と継続 Scheme の評価モデルにおいて、 (+ 1 (+ 2 0))という式を評価するとき、まず (+ 2 0)の部分が評価され、その結果の値に対して (+ 1 [])という残りの計算が行われます。 ここで角括弧で示した部分を reducible exp

    部分継続について本気出して考えてみた - (new Hatena).blog()
  • 1