LeftPad in Scheme
Press + to interact
(define leftPad(lambda (inputStr paddedLength ch)(let ((padd (- paddedLength (string-length inputStr))))(string-append(if (> padd 0)(make-string padd ch)"")inputStr))))(display(leftPad "1" 1 #\.))(display #\newline)(display(leftPad "2" 2 #\.))(display #\newline)(display(leftPad "3" 3 #\.))(display #\newline)(display(leftPad "4" 4 #\.))(display #\newline)(display(leftPad "5" 5 #\.))(display #\newline)(display(leftPad "hello" 7 #\.))(display #\newline)(display(leftPad "foo" 6 #\.))(display #\newline)(display(leftPad "foo" 3 #\.))(display #\newline)(display(leftPad "foobar" 3 #\.))(display #\newline)(display(leftPad "foo" 6 #\?))(display #\newline)