How to make a scheme program accept inputs
Posted: Sat Nov 11, 2017 3:58 am
I have the following program
and I would like it to accept inputs, that I type for example: (my-function '((1 34 3 98 9 76 45 4) (54 546 548 60)))
and then it executes the program and outputs the result
Thanks in advance
Code: Select all
(define (cat . nums) (apply string-append (map number->string nums)))
(define (my-compare a b) (string>? (cat a b) (cat b a)))
(map (lambda (xs) (string->number (apply cat (sort xs my-compare))))
'((1 34 3 98 9 76 45 4) (54 546 548 60)))
and then it executes the program and outputs the result
Thanks in advance