[ prog / sol / mona ]

prog


Marvin Minsky - The Beauty of the Lisp Language

58 2020-10-07 02:35

Lets reimplement this "the LISP way"
//(let ((*print-base* 10)) (print (1+ (read))))

#include <iostream>
#include <string>
#include <gmpxx.h>
std::string lispread(void){ std::string a;getline(std::cin,a);return a;}
mpz_class tonum(std::string x,int base){mpz_class a;a.set_str(x,base);return a;}
mpz_class inc1(mpz_class a){return a+1;}
void printbase(int base){ std::cout << inc1(tonum(lispread(),10));}
int main(){
printbase(10);
}

301


VIP:

do not edit these