So, here's another way to get B4X code from Codex (the model trained on generating programming code from Github).
What I want is code that does the following: Generate a B4X sub that gets a subset of items from a list.
Can I be tricky to get Codex that is designed to generate Python code to access its knowledge about B4X and generate the sub?
Prompt:
1. Create a string variable called b4x_code.
2. Assign a value to the string that contains B4X code.
3. The B4X code is a sub to get a subset of items from a list.
[CODE lang="b4x" title="GPT-3 Generating B4X Code within a Python String"]b4x_code = """
Sub GetSubset(list As List, start As Int, end As Int) As List
Dim result As List
result.Initialize
For i = start To end
result.Add(list.Get(i))
Next
Return result
End Sub
"""
"""
1. Create a string variable called b4a_code.
2. Assign a value to the string that contains B4A code.
3. The B4A code is a sub to get a subset of items from a list.
"""
b4a_code = """
Sub GetSubset(list As List, start As Int, end As Int) As List
Dim result As List
result.Initialize
For i = start To end
result.Add(list.Get(i))
Next
Return result
End Sub
"""
"""
1. Create a string variable called b4j_code.
2. Assign a value to the string that contains B4J code.
3. The B4J code is a sub to get a subset of items from a list.
"""
b4j_code = """
Sub GetSubset(list As List, start As Int, end As Int) As List
Dim result As List
result[/CODE]
Not bad! Other than using "end" as a parameter name. It is interesting that it tried giving B4A and B4J variations.