Skip to content

Commit

Permalink
Update ai-thoughts.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli authored Dec 12, 2024
1 parent c49fddf commit 00c3fbc
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions doc/ai-thoughts.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# AI's thoughts on Jou

I told an LLM (specifically, https://deepai.org/chat) about Jou
and asked to implement Jou's `memswap()` function.
I told an LLM (specifically, [deepai.org/chat](https://deepai.org/chat)) about Jou
and asked to implement Jou's `memswap()` function, defined in [stdlib/mem.jou](../stdlib/mem.jou).
Here's my first message to the LLM:

> The Jou programming language looks like Python but behaves like C. For example, the following program prints numbers 0 to 9:
>
> ```python
import "stdlib/io.jou"
def main() -> int:
for i = 0; i < 10; i++:
printf("%d\n", i)
return 0
```
> import "stdlib/io.jou"
>
> def main() -> int:
> for i = 0; i < 10; i++:
> printf("%d\n", i)
> return 0
> ```
>
> Using Jou, write a function that swaps the content of two chunks of memory. Call it `memswap()` and add a comment explaining what it does.
The AI gave me the following code which didn't compile:
The LLM gave me the following code, which contains several errors.
This is what most LLMs do when you ask them to generate Jou code.
```python
import "stdlib/io.jou"
Expand Down Expand Up @@ -63,7 +64,7 @@ def main() -> int:
After quite a lot of back and forth, it produced the following code:
```
```python
import "stdlib/io.jou"
import "stdlib/mem.jou"
Expand Down Expand Up @@ -120,13 +121,13 @@ After this, I said to the AI:
> Here's the output I get:
>
> ```
Before swap:
Array A: 1 2 3 4 5
Array B: 6 7 8 9 10
After swap:
Array A: 6 7 8 9 10
Array B: 1 2 3 4 5
```
> Before swap:
> Array A: 1 2 3 4 5
> Array B: 6 7 8 9 10
> After swap:
> Array A: 6 7 8 9 10
> Array B: 1 2 3 4 5
> ```
>
> Thank you :)
>
Expand Down

0 comments on commit 00c3fbc

Please sign in to comment.