Language Reference

Collections

Work with lists and dictionaries using clear, readable statements.

Collection patterns

  • Initialize lists and dictionaries inline.
  • Use readable list comprehensions.
  • Access items with brackets.

Lists and dictionaries

Create collections in a single line, then access items with standard Python notation.

collections.pln
create a list named users with ["Ada", "Lin", "Sam"]
create a dictionary named profile with {"name": "Ada", "role": "admin"}
print profile["role"]

Readable list building

Use natural language filters to build new lists from existing data.

list_build.pln
create a list of user["name"] for each user in users if user["active"] is true

Organization tips

  • Prefer dictionaries for labeled data and lists for sequences.
  • Keep collection names plural to clarify intent.
  • Use list creation lines to keep transformations readable.