Skip to content

Commit 598dafb

Browse files
Mark Rosstclaude
andcommitted
Fix: Replace C API examples with Moop language syntax
- Replaced Example Usage section with actor Calculator in Moop syntax - Replaced Trinary MAYBE example with actor AuthService showing natural language - Replaced Self-Modification example with actor SelfOptimizer - Replaced Meta-Evolution example with actor EvolutionarySystem - All examples now demonstrate the natural language syntax (Quorum + Io + Python) - Shows proper use of three arrows: <-, ->, <-> 🦎 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f392518 commit 598dafb

File tree

1 file changed

+84
-63
lines changed

1 file changed

+84
-63
lines changed

README.md

Lines changed: 84 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -99,48 +99,43 @@ make test
9999

100100
### Example Usage
101101

102-
```c
103-
#include "src/moop_enhanced.h"
104-
105-
int main() {
106-
// Initialize Moop runtime with 16 qubits
107-
Moop_Runtime* moop = moop_init(16, 1);
108-
if (!moop) return 1;
109-
110-
// Execute reversible operations
111-
l2a_NOT(moop->l2a, 0);
112-
l2a_CNOT(moop->l2a, 0, 1);
113-
l2a_CCNOT(moop->l2a, 0, 1, 2);
114-
115-
// Create checkpoint (auto-marked essential, never pruned)
116-
uint32_t checkpoint = l2a_checkpoint(moop->l2a);
117-
118-
// Self-modification: read tape
119-
R_Cell cell = l2a_read_tape(moop->l2a, 0);
120-
printf("Tape[0]: gate=%u, a=%u, b=%u\n",
121-
cell.gate, cell.a, cell.b);
122-
123-
// Inspect evolutionary fitness
124-
Tape_Stats stats = l2a_get_tape_stats(moop->l2a);
125-
printf("Avg fitness: %.2f, Essential: %u\n",
126-
stats.avg_fitness, stats.essential_count);
127-
128-
// Meta-evolution: tune fitness parameters
129-
Fitness_Params params = {
130-
.recency_weight = 0.6f,
131-
.activity_weight = 0.3f,
132-
.gate_weight = 0.1f,
133-
.prune_interval = 512,
134-
.prune_threshold = 0.8f
135-
};
136-
l2a_tune_fitness(moop->l2a, params);
137-
138-
// Cleanup
139-
moop_free(moop);
140-
return 0;
141-
}
102+
```moop
103+
actor Calculator
104+
role is "Performs calculations with evolutionary optimization"
105+
106+
state has
107+
history is []
108+
last_result is 0
109+
110+
handlers
111+
112+
on compute(operation, args)
113+
# Reversible computation
114+
result <-> perform_operation(operation, args)
115+
116+
# Update state (irreversible)
117+
state.last_result = result
118+
state.history.append({op: operation, result: result})
119+
120+
# Output (irreversible)
121+
output -> "Result: " + result
122+
123+
on undo
124+
# Reversibility: can rewind to previous state
125+
if history.length > 0
126+
state.history.pop()
127+
restore_checkpoint(history.length)
128+
129+
on optimize_self
130+
# Meta-evolution: tune fitness parameters
131+
params <- get_fitness_params()
132+
params.recency_weight = 0.6
133+
params.activity_weight = 0.3
134+
tune_fitness(params)
142135
```
143136

137+
**Note:** This is Moop language syntax. The v0.1.0-alpha release includes a C implementation runtime. Full Moop parser/compiler coming in future releases.
138+
144139
## Architecture
145140

146141
```
@@ -165,40 +160,66 @@ Selection pressure: Top 75% survive, bottom 25% discarded every 256 operations
165160

166161
### 2. Trinary MAYBE
167162

168-
```c
169-
L2b_Maybe m = l2b_maybe_create("user_authenticated");
170-
l2b_maybe_resolve(&m, true, 0.95f, "JWT token valid");
171-
172-
if (l2b_maybe_get_state(&m) == MAYBE_TRUE) {
173-
// Proceed with confidence
174-
}
163+
```moop
164+
actor AuthService
165+
on authenticate(username, password)
166+
# MAYBE: uncertain value with confidence
167+
maybe user_authenticated is check_credentials(username, password)
168+
169+
when user_authenticated is true:
170+
session <- create_session(username)
171+
output -> "Login successful (confidence: " + user_authenticated.confidence + ")"
172+
173+
when user_authenticated is false:
174+
output -> "Login failed"
175+
176+
otherwise:
177+
# Still uncertain (e.g., awaiting 2FA)
178+
output -> "Awaiting multi-factor authentication"
179+
output -> "Reasoning: " + user_authenticated.reasoning
175180
```
176181

177182
### 3. Self-Modification
178183

179-
```c
180-
// Read operation from tape
181-
R_Cell op = l2a_read_tape(runtime, 100);
182-
183-
// Modify it
184-
op.gate = 1; // Change to CNOT
185-
l2a_write_tape(runtime, 100, op);
186-
187-
// Meta-modify entire tape
188-
R_Cell rule[] = {{2, 0, 0, 0}}; // NOT(0)
189-
l2a_meta_modify(runtime, rule, 1);
184+
```moop
185+
actor SelfOptimizer
186+
on modify_algorithm
187+
# Read code from tape (homoiconicity)
188+
operation <- tape.read(100)
189+
190+
# Modify it (self-modification)
191+
operation.gate = SWAP
192+
tape.write(100, operation)
193+
194+
# Test the modification (reversibly)
195+
checkpoint <- tape.checkpoint()
196+
result <-> execute_modified_code()
197+
198+
# Don't like it? Rewind!
199+
if result.performance < threshold
200+
tape.restore(checkpoint)
190201
```
191202

192203
### 4. Meta-Evolution
193204

194-
The system can tune its own fitness parameters:
205+
```moop
206+
actor EvolutionarySystem
207+
on adapt_to_workload
208+
# System tunes its own evolution (meta-evolution)
209+
params <- get_fitness_params()
210+
211+
# Adjust selection pressure based on usage patterns
212+
params.recency_weight = 0.7 # Favor recent operations more
213+
params.activity_weight = 0.2
214+
params.gate_weight = 0.1
215+
216+
tune_fitness(params)
195217
196-
```c
197-
Fitness_Params params = l2a_get_fitness_params(runtime);
198-
params.recency_weight = 0.7f; // Favor recent ops more
199-
l2a_tune_fitness(runtime, params);
218+
output -> "System adapted to workload"
200219
```
201220

221+
The system evolves how it evolves!
222+
202223
## Documentation
203224

204225
- [UNIFIED_MOOP.md](UNIFIED_MOOP.md) - Complete specification

0 commit comments

Comments
 (0)