Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
0 votes
2 answers
105 views

I'm trying to implement iteration using continuations fun stringChars string = let val len = size string fun nextChar index kEndOfString kReadChar = if len = index then ...
chebert's user avatar
0 votes
1 answer
72 views

I am learning the concept of continuations. I thought a good idea was to trace the typical factorial code when written with the continuation form. I want to know if my understanding is correct. Code: ...
kesarling's user avatar
  • 2,318
0 votes
0 answers
50 views

What I want to achieve is 2 loops (anim1 and anim2), while anim2 contains nested loop internalAnim2 The output of the following code should be: anim1 - 4 times (= a1Max) and 5 times (=a2Max) those 3 ...
nie podam's user avatar
0 votes
1 answer
211 views

Even though it's already tail-recursive, It's still interesting to see a CPS version of it. Here's the standart fold_left: let rec myFoldLeft f acc list = match list with | [] -> acc | h :: ...
utSabbath's user avatar
0 votes
1 answer
143 views

I am trying to do continuation passing style for a simple programming language made with antlr. Typically you would have an eval procedure that takes as arguments the expression to be evaluated as ...
Plegeus's user avatar
  • 402
2 votes
1 answer
587 views

Now that ES6 supports Proper Tail Call, and since according to Wikipedia, "In any language which supports closures and proper tail calls, it is possible to write programs in continuation-passing ...
CidTori's user avatar
  • 418
2 votes
1 answer
237 views

As I understand suspend function transforms to function with additional Continuation parameter and when block from suspendCoroutineUninterceptedOrReturn returning COROUTINE_SUSPENDED value - suspend ...
mobiledev Alex's user avatar
2 votes
1 answer
89 views

I read lots of article already on how to translate call/cc into equivalent CPS style and kinda know the basic already but currently I don't understand how racket perform transformation with call/comp (...
Trung0246's user avatar
  • 689
0 votes
2 answers
106 views

I was playing around with recursion and looking at the benchmark of different implementation. function plusOne(xs) { if (xs.length <= 0) return [] return [xs[0], ...plusOne(xs.slice(1))] } ...
Jason Yu's user avatar
  • 310
0 votes
1 answer
374 views

I'm just learning CPS and I'm trying to pass the following program to this style mirror Void = Void mirror (Node x left right) = Node x (mirror right) (mirror left) From what I understand I have to ...
Márquez's user avatar
  • 101
3 votes
1 answer
504 views

In TS 4.5 tail call optimization was added for recursive generics. The following snippet computes Fibonacci numbers (in unary) up to F12, but for F13 it fails with the usual "Type instantiation ...
polkovnikov.ph's user avatar
0 votes
2 answers
606 views

I am trying to understand continuation passing style conversion. I am trying to build a Scheme to C compiler and I want to use continuation passing style. Whether or not continuation passing style is ...
chez93's user avatar
  • 157
0 votes
1 answer
39 views

Suppose I have a higher order language defined with the (rough) BNF (using Lisp notation): c ::= constants v ::= variables e ::= c | v | (if e e e) | (e e_1 e_2 ... e_n) | (fn [v_1 v_2 ... v_n] e) In ...
bzm3r's user avatar
  • 4,664
1 vote
1 answer
221 views

I'm trying the "defunctionalize the continuation" technique on some recursive functions, to see if I can get a good iterative version to pop out. Following along with The Best Refactoring ...
Joseph Sible-Reinstate Monica's user avatar
0 votes
2 answers
170 views

I'm having an issue with a recursive function that runs into a stack overflow on larger data sets so I've attempted to rewrite the function to use continuous recursion but to say I'm new to this would ...
Scott Wilson's user avatar

15 30 50 per page
1
2 3 4 5
12