Path: utzoo!attcan!uunet!clyde.concordia.ca!mcgill-vision!bloom-beacon!eru!luth!sunic!liuida!uda From: uda@majestix.liu.se (Ulf Dahlen) Newsgroups: comp.lang.lisp Subject: Re: preserving newlines in strings Message-ID: <1662@majestix.liu.se> Date: 8 Feb 90 11:29:07 GMT References: <640009@hpclmp.HP.COM> Organization: CIS Dept, Univ of Linkoping, Sweden Lines: 27 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?