Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!magnus.ircc.ohio-state.edu!murthy From: murthy@magnus.ircc.ohio-state.edu (Murthy S Gandikota) Newsgroups: comp.lang.lisp Subject: Is MAP meant to operate on strings? Message-ID: <1991Feb23.205613.14321@magnus.ircc.ohio-state.edu> Date: 23 Feb 91 20:56:13 GMT Sender: news@magnus.ircc.ohio-state.edu Organization: The Ohio State University Lines: 31 Originator: murthy@left.magnus.ircc.ohio-state.edu Nntp-Posting-Host: left.magnus.ircc.ohio-state.edu This could be a naive question, but what the heck I will go ahead. (map 'string #'(lambda (x) #\h) "replace every char with h") ==> "hhhhhhhhhhhhhhhhhhhhhhhhh" Whereas if I try to do (map 'string #'(lamda (x) (if (equal x #\e) #\f)) "I want to replace e with f") ==> Error: ARG not a character (this is all the error informatin my LISP machine displays) Can anyone point out why the error happens? (BTW, I have tried another way which uses an explict do loop and checks: (string= (string (char x i)) "e") and then replaces using (setf (char x i) "f") where x is the input string and i is the index, i.e. the position inside the string. Also, the DOTIMES needs to loop (LENGTH x) times to make the substitution, so after all, it is not that bad. But, I still wonder what's wrong with the using MAP) Thanks Murthy Gandikota