This is the NeoBook Interface which establishes the input and output files and then calls the NewLisp code:
Code: Select all
SetVar "[LispCode]" "(set 'inFile (open {[PubDir]Data1.txt} {read}))"
hpwNewLispCall "[PubDir]" "[LispCode]" "[LispResult]"
SetVar "[LispCode]" "(set 'outFile (open {[PubDir]Data2.txt} {write}))"
hpwNewLispCall "[PubDir]" "[LispCode]" "[LispResult]"
hpwFileRead "[PubDir]LispCode.txt" "ALL" "[LispCode]"
hpwNewLispCall "[PubDir]" "[LispCode]" "[LispResult]"
Code: Select all
(set 'uniqueLines '())
(while (read-line inFile)
(if (not (member (current-line) uniqueLines))
(set 'uniqueLines (append uniqueLines (list (current-line))))))
(close inFile)
(map (lambda (aLine) (write-line aLine outFile)) uniqueLines)
(close outFile)
Code: Select all
(while (read-line inFile)
(if (not (member $0 uniqueLines))
(set 'uniqueLines (append uniqueLines (list $0)))))
Code: Select all
(while (read-line inFile)
(set 'myLine $0)
(if (not (member myLine uniqueLines))
(set 'uniqueLines (append uniqueLines (list myLine)))))
Instead of $0 I'm using (current-line) successfully but wondering what I should be using?
Thanks,
-- Sam