mohammad@hpclmp.HP.COM (Mohammad Pourheidari) (02/08/90)
Is there a way to preserve newlines in a string that is the argument to the function read-from-string? For example given: (read-from-string "(defun foo (x y) (+ x y))") should return: (DEFUN FOO (X Y) (+ X Y)) thanks, M.
uda@majestix.liu.se (Ulf Dahlen) (02/08/90)
In article <640009@hpclmp.HP.COM> mohammad@hpclmp.HP.COM (Mohammad Pourheidari) writes: >Is there a way to preserve newlines in a string that is the argument to >the function read-from-string? > >For example given: > >(read-from-string "(defun foo (x y) > (+ x y))") > >should return: > >(DEFUN FOO (X Y) >(+ X Y)) The function READ-FROM-STRING acts like READ but takes its input from a string. In your example READ-FROM-STRING returns a list. The line breaks in the output of lists are inserted by the PRINT function. You might try the function PPRINT if you want "better looking" output. In any case, this is implementation dependent. __________ Ulf Dahlen, uda@ida.liu.se, uda@liuida.UUCP Dept of Computer & Info Science, University of Linkoping, Sweden 1981: The BBC Micro by Acorn: Standard hardware with excellent software. 1987: The Archimedes by Acorn: Excellent hardware with yesterday's software. Sad, isn't it?