Code: Select all
;Original copy/past from codepatterns
;(dolist (file-name (3 (main-args)))
; (set 'file (open file-name "read"))
; (println "file ---> " file-name)
; (while (read-line file)
; (if (find (main-args 2) (current-line) 0)
; (write-line)))
; (close file))
;
;(exit)
;
;some small edits by me. and one error on purpose
(set 'file-name "h:/output.txt")
(dolist (filename (3 (main-args)))
(set 'file (open file-name "read"))
(println "file ---> " file-name)
(while (read-line file)
;(if (find (main-args 2) (current-line) 0)
(if (find "Job:" (current-line) 0)
(write-line)))
(close file)
)
It seems perfect for a start to a tiny project i want to do.
For my convenience i didn't want to type a file name every time. I looked and thought that by replaceing the
Code: Select all
(3 (main-args))
I did sorta manage to get something to work but I'm not getting why it did not work.
I do see what the
Code: Select all
(3 (main-args))
I misspelled the symbol in the second section to because i could not get rid of it with out getting a
Code: Select all
ERR: symbol is protected in function dolist : set
edit:
1 more question the (current-line) its apparent what it does, it return the current line. but im not seeing why?
is it part of the FIND ? or some other function?
edit2:
Ok I kept looking up functions and i now see that "file-name" was/is the variable for theloop. It was expecting a list and i wasn't giving it one.