🧾 $from() Cheat Sheet (OpenAF Array Superpowers)
🔍 Filtering
$from(arr).equals("key", "value").select()
$from(arr).greater("size", 1024).select()
$from(arr).contains("tags", "urgent").select()
$from(arr).where(r => r.name.startsWith("A")).select()
📊 Sorting
$from(arr).sort("name").select()
$from(arr).sort("-date", "priority").select() // "-" for descending
🏷️ Selecting/Mapping
$from(arr).select(r => ({ id: r.id, label: r.name.toUpperCase() }))
🧮 Aggregation
$from(arr).sum("amount") // total of amount fields
$from(arr).count() // count all
$from(arr).avg("score") // average score
$from(arr).max("age") // max age
🧩 Grouping
$from(arr).group("type").select()
Result: a list of { key: type, values: […] }
🧹 Distinct
$from(arr).distinct("category").select()
🔗 Combining Sets
$from(arr1).intersect(arr2).select()
$from(arr1).except(arr2).select()
$from(arr1).cartesian(arr2).select()
🧰 Common Patterns
Get first match
$from(arr).equals("status", "active").at(0)
Chain filters
$from(arr).greater("price", 10).less("price", 100).select()
Use custom logic
$from(arr).where(r => r.date < now()).select()