[Haskell-cafe] GPT & Haskell
William Yager
will.yager at gmail.com
Sat Apr 1 03:36:37 UTC 2023
On Fri, Mar 31, 2023 at 7:27 PM Mig Mit <migmit at gmail.com> wrote:
> How is it going to benefit anyone though? English, like all natural
> languages, is terrible for describing algorithms.
>
The other day, I asked ChatGPT to solve a boring but non-trivial
programming problem I had:
> I have a png file which contains a bunch of 5x7 bitmap font characters.
Write a python program which reads in the png, and then for each character
in the png, extracts the 35 bits of each character and assembles them into
an integer. The final output should be a list of integers, each integer
containing a binary representation of each character in the font.
It did this basically perfectly. It wasn't precisely matched to my format,
but only because I was ambiguous in the problem statement. I gave it a
little more context about the image format and it did it exactly right on
the second try.
I also asked it to write an inverse function of this, which it did
perfectly in Python, and did pretty well in Rust, although with a small and
understandable bug.
Very useful!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20230331/fef9c720/attachment.html>
More information about the Haskell-Cafe
mailing list