Mystery solved! The answer to your OP is that the reason anyone can trust ChatGPT for code is that they use a much better model than the one you're using! GPT-3.5 is ancient and way behind GPT-4. In fact, there are now tens of organisations who have developed model classes way ahead of GPT-3.5.
> the reason anyone can trust ChatGPT for code is that they use a much better model than the one you're using! GPT-3.5 is ancient and way behind GPT-4.
Testing that theory now using Bing Copilot GPT-4.
Failed.
unmatched close parenthesis Line: 11, Column: 11, File-Position: 408
Input is:
Translate this to Common Lisp.
def solve(graph):
a = 0
while a < len(graph):
for b in range(len(graph)):
if b > a and graph[a].intersection(graph[b]):
graph[b] = graph[a] | graph[b]
graph.pop(a);a-=1
break
a+=1
return graph
a = [{1, 2}, {4, 5}, {1, 3}, {1, 4}]
print((solve( a )))
Output is:
(defun solve (graph)
(let ((a 0))
(loop while (< a (length graph)) do
(loop for b from 0 below (length graph) do
(when (and (> b a) (intersection (nth a graph) (nth b graph)))
(setf (nth b graph) (union (nth a graph) (nth b graph)))
(setf graph (remove-if (lambda (x) (equal x (nth a graph))) graph))
(decf a)
(return))))
(incf a))
graph))
(let ((a (list (list 1 2) (list 4 5) (list 1 3) (list 1 4))))
(format t "~a~%" (solve a)))