parsing spaces to delimiter
Posted: Thu Apr 22, 2004 3:03 pm
I am a bit fusseld with this. I want to parse all spaces to an delimter.
> a
"Test "
> (repspaces a "|" 12)
invalid function in function replace : (repstr " " (- repnum x))
called from user defined function repspaces
>
What is going wrong?
Code: Select all
;Repeats a str with num
(define (repstr str num newstr)
(setq newstr "")(dotimes(x num)(setq newstr(append newstr str))))
;Replace spaces with one delimiter
(define (repspaces spacestr repstr repnum )
(dotimes(x repnum)
(setq spacestr (replace (repstr " " (- repnum x)) spacestr repstr))))
"Test "
> (repspaces a "|" 12)
invalid function in function replace : (repstr " " (- repnum x))
called from user defined function repspaces
>
What is going wrong?