Files
marqdo/tests/lib/table-collections.mq.md
T
cflmyandCursor bd5555afaa Unify bare-identifier semantics in *…* / **…** (Python namespace)
Inside italic/bold code segments every bare word is a variable — including
call arguments and method-call receivers — so text literals must be quoted
and receivers no longer need backticks. A bare dotted callee `a.b` resolves
as a method call when `a` is a local variable, otherwise as a library path
(Python-style unified namespace), in both the tree-walk and bytecode backends.

Migrate ~70 tests plus ext/web, ext/quantum, ext/ai and the example projects
to the new idiom; update SKILL.md and the design docs; fix the web/quantum
example data model (db/index.mq.md). Unit and gold suites pass; only the 3
network-live tests fail offline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 11:20:46 +08:00

48 lines
971 B
Markdown

---
title: table collections
description: put + list/map helpers
import table:lib/table.mq.md
---
# main
*h = > table.put in=None at="Authorization" value="Bearer-x"*
> print text=`h`[^Authorization]
`xs` =
| v |
|---|
| a |
| b |
*xs = > table.put in=`xs` at=1 value="A"*
> print text=`xs`[^1]
> print text=`xs`[^2]
`req` =
| model | messages |
|-------|----------|
| m1 | None |
*msg = > table.put in=None at="role" value="user"*
*msg = > table.put in=`msg` at="content" value="hi"*
*messages = > table.append list=None item=`msg`*
*req = > table.put in=`req` at="messages" value=`messages`*
*req = > table.put in=`req` at="stream" value=True*
> print text=`req`[^messages][^1][^content]
> print text=`req`[^stream]
*xs = > table.append list=`xs` item="c"*
*n = > table.len xs=`xs`*
> print text=`n`
*m = > table.merge a=`h` b=`msg`*
*ks = > table.keys map=`m`*
> print text=`ks`
*empty = > table.empty_map*
*sz = > table.size map=`empty`*
> print text=`sz`