diff options
| author | eunhhu <[email protected]> | 2026-09-26 11:37:23 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-26 11:37:23 +0100 |
| commit | 7b0d1ec72ee45631d7e71d7498d360b49e268eb6 (patch) | |
| tree | 3adbef83497424b38d4b77b3cc5cf04b88c6eb00 /docs/design | |
| parent | b5cb79948d52fe9dd918a10a446dcf183c35d10d (diff) | |
| download | aup-7b0d1ec72ee45631d7e71d7498d360b49e268eb6.tar.gz aup-7b0d1ec72ee45631d7e71d7498d360b49e268eb6.zip | |
Find an item with first(t in tasks where ...)
first(item in list [where condition]) is the index of the first item the
condition keeps, typed as an index of that list: at = first(...), a field
through first(...).title, or its .position. With no such item a view has
no value and a handler fails not_found. A fold's result now takes member
access like a call's. The random model check jumps to the first open
task and shows its position; one diagnostic joins.
Diffstat (limited to 'docs/design')
| -rw-r--r-- | docs/design/002-dsl-direction.md | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/docs/design/002-dsl-direction.md b/docs/design/002-dsl-direction.md index 7924083..2ba217a 100644 --- a/docs/design/002-dsl-direction.md +++ b/docs/design/002-dsl-direction.md @@ -165,6 +165,9 @@ view best = max(p.score for p in players where p.active) view summary = "{count(t in tasks where !t.done)} open of {tasks.count}" ``` +- **찾기.** `first(항목 in 리스트 [where 조건])`은 조건이 참인 첫 항목의 인덱스다(그 리스트의 인덱스 타입이라 + `at = first(t in tasks where t.title == name)`, `first(…).done = 1`, `first(…).position`으로 쓴다). 없으면 보기는 + 비고 핸들러는 `not_found`로 실패한다. 찾으면 거기서 멈춘다. - **모양.** `count(항목 in 리스트 [where 조건])`, `sum|max|min(값 for 항목 in 리스트 [where 조건])`. 값을 둘 받는 `max(a, b)`·`min(a, b)`는 그대로 호출이고, 같은 이름의 fn(`fn sum(a, b)`)도 그대로 부를 수 있다. 첫 식 뒤의 `for`, 또는 `count(`의 `이름 in`으로 가른다. |
