It is interesting for sure. Here is another example that has a little bit more 'substance'.
First thing to note, this code does not work, so don't bother trying it.

I took the code and simply formatted it, and this is what it looks like.
;============================================================================
; string-split.lsp
;============================================================================
;
; This program provides a function, `string-split`, for splitting a string
; into a list of substrings at arbitrary delimiters.
;
; The `string-split` function accepts two arguments:
;
; * A string to split into substrings.
; * A delimiter that indicates where the split should occur.
;
; The return value is a list of strings.
;
; Example:
;
; (string-split "abc|def|ghi" "|")
; => ("abc" "def" "ghi")
;
; (string-split "a/bc/def" "/")
; => ("a" "bc" "def")
;
(defun string-split (str delimiter)
(cond
((member delimiter str)
(cons
(substr str 1 (vl-position delimiter str))
(string-split (substr str (+ (vl-position delimiter str) 1)) delimiter)
)
)
(t str)
)
)
A few things key take-aways I noticed:
- First, I specified not to use the 'let' function because this AI is regularly recognizing and using (let) from general LISP, but autoLISP does not recognize the let function.
- Clearly, the AI understood what I was asking it to do. Somehow, it even decided to comment about what the program should do, and how to use it, which was fascinating to me. This is a machine..
- The AI falsely uses the member function as a way to determine whether or not the delimiter is found within the string, as member expects a list not a string as input. It makes the same mistake with 'vl-position' which also expects a list. Despite these mistakes, it clearly knows what it is trying to do.
- The AI uses recursion here, something I really never would have even cared to think about doing.
A few modifications to this code like making the 'member' and 'vl-position' function to work as the AI thought they should, this code would likely execute properly. Crazy.
EDIT:
I modified the code slightly, to use WCMATCH and VL-STRING-SEARCH instead, and then a little bit of list manipulation correction, and it does indeed work. Not necessarily the best way to do the task, that title probably goes to Lee Mac's recursive version, but still impressive considering the fundamental solution was automatically generated from a text prompt in plain English.
(defun string-split (str delimiter)
(cond
((wcmatch str (strcat "*" delimiter "*"))
(append
(list (substr str 1 (vl-string-search delimiter str)))
(string-split (substr str (+ (vl-string-search delimiter str) (+ (strlen delimiter) 1))) delimiter)
)
)
(t (list str))
)
)
Cheers!