Skip to content

Instantly share code, notes, and snippets.

View Print maximum powers of b
#include <stdio.h>
int powers_recursive(int b, int l){
if(l>0){
for(int i=0; i<b-1; ++i){
int p = powers_recursive(b, l-1);
printf("%d", p);
}
powers_recursive(b,l-1);
return l;
View glinv.hs
{--
This file is a slight extension of Sigfpe's "Quick and dirty reinversion of control":
http://blog.sigfpe.com/2011/10/quick-and-dirty-reinversion-of-control.html
I only added input capabilities: yieldInput + modification to yield
and of course the lines in imperative (i.e. our re-captured "main loop") which have to do with getting input.
--}