> (setf str {abc1111abc222})
"abc1111abc222"
> (replace {a(bc)} str (push $1 lst -1) 0)
"abc1111abc222"
;why ?
;(push $1 lst -1) will return lst then lst replace {a(bc)} ???
;
> (setf lst nil)
nil
> (replace {a(bc)} str (println (push $1 lst -1)) 0)
("bc")
("bc" "bc")
"abc1111abc222"
> (replace {a(bc)} str $1 0)
"bc1111bc222"
I think it's because your first replace expression is trying to replace the found string with a list:
Quote
If all arguments are strings, replace replaces all occurrences of str-key in str-data with the evaluated exp-replacement, returning the changed string. (newLISP Reference Manual)
So this won't do anything:
(replace "(a)bc" "abcabc" (list $1) 0)
;-> abcabc
whereas this will:
(replace "(a)bc" "abcabc" (upper-case $1) 0)
;-> AA
OMG
Quote
If all arguments are strings
include exp-replacement evaluated !!!!!!