I tried it on three "dead" languages: - a bubble-sort in Pop-2 - a system of linear equations solver in IMP-80 - the array concatenation example in SNOBOL 4 from Rosetta Code. It got the first one right -- despite 'array' access being written 'subscr(index, array)' -- and the second one almost right -- mistaking an nxn array for a 2n array. It got the third one (which I had stripped of comments) right too. It's impressive. And it's impressive because it's clearly NOT based on analysing a large corpus of code in the language you give it (because there IS no corpus of Pop-2 and the available corpus of IMP is both limited and very sparsely commented. Not much SNOBOL either. On Wed, 15 Mar 2023 at 20:07, Tim Mackinnon <tim@testit.works> wrote:
Of course everyone is talking about ChatGPT, and I saw a post to ExplainCode and didnât expect it to understand Smalltalk, so was impressed that it does! Presumably the Tonel Smalltalk code on GitHub has helped along with numerous articles?
Try it out: https://whatdoesthiscodedo.com/
I gave this simple example: (1 to: 100 by: 3) reject: [:i | i isOdd]
And got this (neat eh):
The code above is written in the programming language Smalltalk.
It creates a collection of numbers from 1 to 100, incrementing by 3 at each step. This is done using the "to:by:" construct where the starting value is 1, the ending value is 100, and the increment is 3.
The resulting collection is then filtered using the "reject:" method, which takes a block of code as an argument. In this case, the block checks whether each element (denoted by the variable i) is odd by using the "isOdd" method. If an element is odd, it will be rejected from the collection.
So, the final result is a collection of all even numbers from 1 to 100, incrementing by 3 at each step. Share this explanation with colleagues: whatdoesthiscodedo.com/g/a0ec56e