3 ms·
callCC is my favorite goto weirdness. import Control.Monad.Cont import Data.Function (fix) main = for 0 (<3) (+1) $ \i -> do liftIO (print
by Tarean 9y ago
callCC is my favorite goto weirdness.
import Control.Monad.Cont
import Data.Function (fix)
main = for 0 (<3) (+1) $ \i -> do
liftIO (print i)
for z p s body = do
(jmp, i) <- label z
when (p i) $ do
body i
jmp (s i)
label start = callCC (\cont -> return (fix $ \jmp cur -> cont (jmp, cur), start))
Guess you could do this in javascript via trampolining?