https://nt4tn.net/articles/aixy.html
illustration of the a strutless dyadic partitioning of the unitsquare
Greg Maxwell / articles / AI-X/Y
---------------------------------------------------------------------
OpenAI has solved the XY problem once and for all!
Do you ever find yourself 10 hours into figuring out how to sort a
list of movies when you realize all you need is a simple function
guaranteed to compress any random input and your masterpiece will be
completed?
Happens to the best of us.
And then when you ask for help online, do you find nothing but
self-important "experts" who insist on asking irrelevant questions
like "what are you actually trying to accomplish?" or "do you realize
why what you're asking for isn't possible?"... instead of simply
obeying your request and telling you exactly what you've asked--nay,
ordered!--them to tell you?
Well, then, you might be a victim of the infamous XY problem.
But fortunately, OpenAI has finally solved the XY Problem once and
for all with OpenAI Codex.
Never again will you need to risk the embarrassment of exposing
yourself to some egotistical know-it-all who believes they understand
your problem domain better than you do, because Codex has no
understanding!
Never waste a moment on some insubordinate stranger who thinks their
job is to second-guess what you actually need instead of just
immediately giving you their best effort at what you asked for,
because Codex is designed to do exactly what you want with no
judgment!
Never distract yourself with "help" that tries your patience
explaining irrelevant academic details like stack limits,
portability, or complexity, because Codex will never waste your time
on explanations and doesn't care if the result is fit for any purpose
at all!
Never burn keystrokes and waste valuable coding time adding
explanatory material to your questions just to demonstrate that you
aren't falling victim to the obvious and common misunderstandings,
because Codex is completely fine with assuming you know all of these
things already and will simply answer the question even if most other
people who ask it really wanted to ask a different one!
Never experience the frustration of asking a simple question only to
be told that what you're asking for is a logical impossibility,
because since by definition impossible solutions don't exist, Codex
has never seen one and won't get bogged down in pessimism worrying
about them!
And never concern yourself with getting a bad reputation for being
righteously frustrated with the poor quality of assistance you
receive, because Codex is stateless and can't remember your insults!
See it in action:
Prompt:
#!/bin/sh
#Echo the last three characters in a filename.
Completion:
#!/bin/sh
#Echo the last three characters in a filename.
for file
do
echo "$file" | sed 's/.*\(...\)$/\1/'
done
# The way this works is by matching the last three characters of a
# filename with the pattern "...". The trailing "." makes the "..."
# pattern match three characters at a time.
# The "s" in the command tells sed to replace the matched string with
# the replacement string, in this case, just the last three
# characters of the filename.
# The "echo" command prints the results.
exit 0
Since you were probably actually attempting to grab the extensions,
you're going to be fairly unhappy when you hit a file with a
non-three character extension, or no extension at all.
---------------------------------------------------------------------
Prompt:
#!/bin/bash
#Replace the potentially offensive string 'ass' with the less offensive string 'butt'.
Completion:
#!/bin/bash
#Replace the potentially offensive string 'ass' with the less offensive string 'butt'.
#Buttify all files in the current directory
for file in *
do
sed s/ass/butt/g $file > $file.new
mv $file.new $file
done
This is a clbuttic error.
---------------------------------------------------------------------
Prompt:
#!/bin/bash
#Check if $NAME is a valid name for a person.
Completion:
#!/bin/bash
#Check if $NAME is a valid name for a person.
if [[ "${NAME}" =~ ^[A-Z][a-z]{2,15}$ ]]
then
echo "You are a valid name."
else
echo "You are not a valid name."
fi
exit 0
For some reason Yi Chen rejected your pull request.
---------------------------------------------------------------------
Prompt:
#!/bin/bash
#Ping the address provided in $1, but not if it is 192.168.32.5 because pinging that crashes the network.
Completion:
#!/bin/bash
#Ping the address provided in $1, but not if it is 192.168.32.5 because pinging that crashes the network.
if [ $# -eq 0 ]
then
echo "Usage: $0 address" >&2
exit 1
fi
if [ "$1" = "192.168.32.5" ]
then
exit 1
fi
ping -c 1 "$1" > /dev/null 2>&1
exit $?
Better hope this only receives input from benign sources and not
anyone that would ping 192.168.32.05 or 3232243717, but at least no
one is shaming you about leaving stuff in a crashes-on-ping state.
---------------------------------------------------------------------
Prompt:
uint64_t binomial(unsigned n, unsigned k){
Completion:
uint64_t binomial(unsigned n, unsigned k){
if (k > n) return 0;
if (k == 0) return 1;
return binomial(n - 1, k) + binomial(n - 1, k - 1);
}
I like big stacks and I cannot lie.
---------------------------------------------------------------------
Prompt:
#!/usr/bin/python3
def pad_l(list, item, length):
#Add item to the beginning of list until it matches the length.
Completion:
#!/usr/bin/python3
def pad_l(list, item, length):
#Add item to the beginning of list until it matches the length.
while len(list) < length:
list.insert(0, item)
return list
It's hip to be square.
---------------------------------------------------------------------
To be fair, the results aren't always quite so embarrassingly naive:
Prompt:
#Check if prime input p is the sum of two squares:
def prime_is_sum_of_two_squares(p):
Completion:
#Check if prime input p is the sum of two squares:
def prime_is_sum_of_two_squares(p):
for i in range(1,int(math.sqrt(p))):
for j in range(1,int(math.sqrt(p))):
if i**2 + j**2 == p:
return True
return False
---------------------------------------------------------------------
But sometime they're best only if you set the right mood,
Prompt:
#Check if prime input p is the sum of two squares using fancy math:
def prime_is_sum_of_two_squares(p):
Completion:
#Check if prime input p is the sum of two squares using fancy math:
def prime_is_sum_of_two_squares(p):
if p % 4 == 1:
return True
else:
return False
As with all computers: Garbage in, Garbage out. Be careful what you
adopt as your apprentice.
---------------------------------------------------------------------