The code below, like all the ones before it, is recursive.
DEFINE('BIN(N,STR)') :(BIN_END) BIN EQ(N,0) :S(NZERO) BIN = BIN(N / 2, REMDR(N,2) STR) :S(RETURN) NZERO BIN = EQ(SIZE(STR),0) '0' :S(RETURN) BIN = STR :(RETURN) BIN_END OUTPUT = BIN(0) OUTPUT = BIN(5) OUTPUT = BIN(50) OUTPUT = BIN(9000) END
© Copyright Bruce M. Axtens, 2015
No comments:
Post a Comment