diff options
| author | eunhhu <[email protected]> | 2026-09-28 05:22:14 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 05:22:14 +0100 |
| commit | 25af3db3643c7a4e961b172104ca289f5923e83a (patch) | |
| tree | 8d431d9dc0e6d0f455fe5d0fb93b726c6a3a134a /docs/design/002-dsl-direction.md | |
| parent | 0134f492c9fcb4ecf079a9dad93db1f8c70ced79 (diff) | |
| download | aup-25af3db3643c7a4e961b172104ca289f5923e83a.tar.gz aup-25af3db3643c7a4e961b172104ca289f5923e83a.zip | |
Slice a keyed list by its keys
list[low .. high], as a fold's or a for's list, is the items whose keys
are from low up to before high (a list keyed by a number), read by key:
distinct(l.item for l in lines[o * 16 .. o * 16 + 16] where
stock[l.item].quantity < t) reads one order's lines, whatever its test
does outside them. It compiles to Pure's sliced folds and walks; an empty
for over a slice still computes its keys. Two diagnostics and an app of
slices are checked.
Diffstat (limited to 'docs/design/002-dsl-direction.md')
| -rw-r--r-- | docs/design/002-dsl-direction.md | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/docs/design/002-dsl-direction.md b/docs/design/002-dsl-direction.md index c4aaddf..07aee73 100644 --- a/docs/design/002-dsl-direction.md +++ b/docs/design/002-dsl-direction.md @@ -330,7 +330,10 @@ on clean { 메시지는 행을 리스트의 저장 형식 바이트로 보내도 된다(대량 넣기). 출력은 행을 보내지 않는다. - 이것으로 여러 행을 한꺼번에 바꾸는 트랜잭션(TPC-C의 주문처럼 행마다 재고를 줄이고 주문 행을 넣는 일)이 이벤트 하나다. - 키 있는 리스트의 키를 범위로 묻는 `where`(`for l in lines where l.id >= start && l.id < start + 16`)와 집계, 표의 필터는 Pure가 - 그 범위의 항목만 읽는다(키로 찾아서). 인덱스를 선언하지 않는다. + 그 범위의 항목만 읽는다(키로 찾아서). 인덱스를 선언하지 않는다. 다만 집계와 걷기는 나머지 조건이 결함을 낼 수 없을 때만 그렇게 + 하므로, 범위를 뜻으로 적으려면 **조각**을 쓴다: `lines[a .. b]`는 키가 a부터 b 앞까지인 항목들이다(`for l in lines[a .. b]`, + `distinct(l.item for l in lines[a .. b] where stock[l.item].quantity < t)`). 조각 밖의 항목은 돌지 않으므로 그 조건이 결함을 낼 + 수 있어도 된다. 수로 키를 둔 리스트에만 쓴다. 검증: 진단 9건(`for` 안의 `for`, 걷는 리스트에 넣기, `for` 안의 `reply`, 행을 보내는 출력, 핸들러 밖의 행, 값으로 쓴 행, 리스트가 아닌 것, 이미 선언된 항목 이름, 없는 레코드)과, 그룹 안의 행·`where`·걷는 항목을 읽는 집계·지우는 걷기를 쓴 앱을 Pure가 |
