continuation-passing Questions
2
Solved
How do I convert these procedures in Scheme to CPS form?
(lambda (x y)
((x x) y))
(lambda (x)
(lambda (f)
(f (lambda (y)
(((x x) f) y))))
((lambda (x) (x x)
(lambda (x) (x x))
*This is ...
Continent asked 2/2, 2012 at 13:11
2
Solved
There's a series of examples I'm trying to do to practice Haskell. I'm currently learning about continuation passing, but I'm a bit confused as to how to implement a function like find index of ele...
Tartary asked 14/4, 2015 at 4:3
1
Solved
I am working with SICP and exercise 2.29-b gave me the opportunity to have fun with the Continuation Passing Style while traversing mobiles and branches.
To make the story short, each mobile has l...
Circadian asked 19/10, 2014 at 13:26
1
Solved
In On Lisp, p. 267, Paul Graham provides an implementation of continuation passing macros:
(setq *cont* #'identity)
(defmacro =lambda (parms &body body)
`#'(lambda (*cont* ,@parms) ,@body))
...
Piccoloist asked 13/7, 2014 at 10:24
2
Solved
I'm playing around with CPS and Control.Monad.Cont and wonder what we gain by noticing the monadic structure. For code like this:
sumOfSquares'cps :: Cont r Int -> Cont r Int -> Cont r Int
s...
Syndactyl asked 10/6, 2014 at 18:2
1
Solved
I have some code that evaluates primitive programs. Program is a list of statements (expression, block, return statement). Result of evaluation is last evaluated expression. Also evaluator should p...
Ic asked 11/5, 2014 at 14:57
1
Solved
This is from the Joy of Clojure, 2nd Edition. http://www.manning.com/fogus2/
(defn mk-cps [accept? kend kont]
(fn [n]
((fn [n k]
(let [cont (fn [v] (k ((partial kont v) n)))]
(if (accept?...
Hitormiss asked 31/1, 2014 at 10:32
1
Solved
I've been trying to understand continuations / CPS and from what I can gather it builds up a delayed computation, once we get to the end of the list we invoke the final computation.
What I don't ...
Saharan asked 1/4, 2013 at 15:24
2
Solved
Possible Duplicate:
What is the Haskell response to Node.js?
How can I watch multiple files/socket to become readable/writable in Haskell?
Is it possible to write a Haskell program t...
Obligation asked 10/12, 2012 at 23:34
1
Solved
Suppose we have a monad, defined by return, (>>=) and the set of laws. There is a data type
newtype C m a = C { unC ∷ forall r. (a → m r) → m r }
also known as Codensity. C m a ≅ m a given...
Muffler asked 25/9, 2012 at 19:27
2
Solved
I have been rewriting many OCaml standard library functions to be tail-recursive lately. Given that this has entailed straight-forward CPS transformation, I am left puzzling over why the default ve...
Chaffer asked 17/8, 2012 at 20:12
1
I'm wondering if there is a way to implement a generic "memoize" functional (as in a function with a function as input and a function as output, as python's decorators) capable of handling also cps...
Rafaelarafaelia asked 5/4, 2012 at 10:38
1
I have been trying to wrap my head around the complex typing issues with scala continuations. I've been reading all the material I can find on it, including the reference docs on the continuations ...
Weingarten asked 28/2, 2012 at 17:46
1
Solved
I am new to Scala and trying to wrap my head around continuations
I'm trying to reproduce the yield return C# statement.
Following this post, I have written the following code :
package com.compa...
Jolo asked 19/1, 2012 at 22:19
2
Solved
In The Scheme Programming Language by Kent Dybvig (4th edition) section 3.4, he describes very clearly what continuation passing style is. For the why he gives two reasons:
pass more than one re...
Limited asked 17/12, 2011 at 10:33
4
Solved
What are the differences between continuation passing style (cps) and monads.
Collation asked 24/12, 2010 at 10:58
3
Solved
Suppose I have to write some GUI code as follows:
widget1.addListener(event1 =>
handle1(event1)
widget2.addListener(event2 =>
handle2(event2)
widget3.addListener(event3 => handle3(event3))
)
...
Septuagint asked 19/5, 2011 at 16:46
4
Solved
I'm new to ocaml and tryin to write a continuation passing style function but quite confused what value i need to pass into additional argument on k
for example, I can write a recursive function t...
Iseabal asked 18/6, 2010 at 20:45
1
Solved
I ran into this code on Wikipedia:
(define (pyth x y k)
(* x x (lambda (x2)
(* y y (lambda (y2)
(+ x2 y2 (lambda (x2py2)
(sqrt x2py2 k))))))))
The article says that that code is the Continua...
Genie asked 20/2, 2011 at 18:46
3
How does CPS in curried languages like lambda calculus or Ocaml even make sense? Technically, all function have one argument. So say we have a CPS version of addition in one such language:
cps-add...
Tearoom asked 22/12, 2010 at 16:47
3
Solved
I've been following the new announcement regarding the new async feature that will be in c# 5.0. I have a basic understanding of continuation passing style and of the transformation the new c# comp...
Wilk asked 1/11, 2010 at 15:20
2
Solved
In the context of Scheme and CPS conversion, I'm having a little trouble deciding what administrative redexes (lambdas) exactly are:
all the lambda expressions that are introduced by the CPS conv...
Abby asked 23/1, 2010 at 9:21
© 2022 - 2024 — McMap. All rights reserved.