Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (explode-string str)
- (local
- (
- (define (operator o) (or (string=? o "+")
- (string=? o "-")
- (string=? o "*")
- (string=? o "/")))
- ;explode-string: string string (listof strings)-> (listof strings)
- ;Übersetzt einen string in einzelne Symbole und zusammenhängende Zahlen
- (define (explode-string2 str akk akk2)
- (cond
- [(empty? str) (append akk2 (list akk ))]
- [(operator (first str)) (if (string=? akk "")
- (explode-string2 (rest str) akk (append akk2 (list (first str))))
- (explode-string2 (rest str) "" (append akk2 (list akk)(list(first str)))))]
- [else (explode-string2 (rest str) (string-append akk (first str)) akk2)]
- )
- )
- )
- (explode-string2 (explode str) "" empty)
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement