Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aabbtree77/directed-graph-chatgpt
ChatGPT4-o1 language comparison w.r.t. coding a directed graph.
https://github.com/aabbtree77/directed-graph-chatgpt
borgo chatgpt clojure comparison directed-graph fsharp gleam grain immutability inko roc starlark-go
Last synced: 28 days ago
JSON representation
ChatGPT4-o1 language comparison w.r.t. coding a directed graph.
- Host: GitHub
- URL: https://github.com/aabbtree77/directed-graph-chatgpt
- Owner: aabbtree77
- License: mit
- Created: 2024-12-12T17:11:53.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-01-07T00:29:00.000Z (29 days ago)
- Last Synced: 2025-01-07T01:23:14.592Z (29 days ago)
- Topics: borgo, chatgpt, clojure, comparison, directed-graph, fsharp, gleam, grain, immutability, inko, roc, starlark-go
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## ChatGPT Prompt
Create a directed graph in X. Nodes (vertices) can hold arbitrary data. Edges define relationships between nodes. The graph supports generic operations like adding nodes, adding edges, and finding neighbors. The example graph use in TypeScript:
```typescript
const graph = new Graph();// Add nodes
const alice = graph.addNode("Alice");
const bob = graph.addNode("Bob");
const charlie = graph.addNode("Charlie");// Add edges
graph.addEdge(alice, bob); // Alice -> Bob
graph.addEdge(bob, charlie); // Bob -> Charlie
graph.addEdge(alice, charlie); // Alice -> Charlie// Get neighbors
console.log("Neighbors of Alice:", graph.getNeighbors(alice).map((n) => n.data));// Print the graph
graph.printGraph();
```## Go, TypeScript, C#, Dart, Kotlin, Python3, and Rust
ChatGPT writes correct, human-readable code.
## Java, Clojure, Starlark-Go, and F#
ChatGPT does not produce correct code on the first run, but it self-corrects after another prompt or two.
`Program_evenmore_idiomatic.fs` took about five iterations to get it right. I prompted it not to rely on any maps and lists, use recursive data structures, recursive functions, immutability. The latter is not easy at all, I fear we are all overreacting with the FP.
## Roc and Gleam
ChatGPT totally hallucinates here, does not even warn a user that these languages have changed since the last time ChatGPT saw them. It does not browse and self-update.
One could mention here [Borgo](https://github.com/borgo-lang/borgo) and [Inko](https://github.com/inko-lang/inko) (both written in Rust), as well as [Grain](https://github.com/grain-lang/grain) (written in Reason), but I fear the results would be similar.