Inspect a mixed linked list
Append, prepend, and remove mixed payloads while named development captures show Node references and the resulting list.
Download .aner source// Read-only snapshots show node references; they never call user methods.
import aner.dev
class Node {
public let value
public var next: Node?
}
class LinkedList {
var head: Node?
fn prepend(value) { head = Node(value: value, next: head) }
fn append(value) {
let node = Node(value: value, next: null)
if head == null { head = node; return }
var cursor = head
while cursor.next != null { cursor = cursor.next }
cursor.next = node
}
fn remove_first(value) {
if head == null { return false }
if head.value == value { head = head.next; return true }
var cursor = head
while cursor.next != null {
if cursor.next.value == value {
cursor.next = cursor.next.next
return true
}
cursor = cursor.next
}
return false
}
fn len() {
var count = 0
var cursor = head
while cursor != null { count = count + 1; cursor = cursor.next }
return count
}
}
let items = LinkedList(head: null)
items.append(10)
items.append("hello")
dev.capture("After two appends", items)
items.prepend(1.5)
dev.capture("After prepending a Float64", items)
print(items.remove_first("hello"))
dev.capture("After removing the String node", items)
print(items.len()) // 2 in both development and production
Make it your experiment.
With Aner installed, save this program as examples/development_linkedlist.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/development_linkedlist.aner
aner run examples/development_linkedlist.aner --dev linked-list-report
aner run examples/development_linkedlist.aner --prodThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
After development, open linked-list-report/inspection.html in a browser for variables, references, and observations. The development guide explains report files, recording budgets, neural captures, and notebook controls.
Use a new report directory for each development run. Production is the default; --prod disables recording, and --dev records bounded observations without changing the model or list computation.
Iris and Wine are teaching datasets with their own attribution. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution