# Find things by name

Choose between a list, a map, and a set.

Last updated: 2026-09-09

Package: recipes | Status: complete-program

Tags: cpu, recipe

A list is useful when you want the first, second, and third item. Sometimes you want the price of an apple without caring where apples sit in a list. A map connects a key, such as a name, to a value. A set answers a different question: have we already collected this badge? Adding the same badge twice does not make two badges. These collection features are experimental; use the supplied compiler route and check your target before shipping.

```yh
start.yh
```


## Find things by name

Choose between a list, a map, and a set.

Verification: type checked

```yh
map of text to int prices = ["apple" to 3, "berry" to 2]
if prices.Contains("apple")
{
    Console.Log(Text.From(prices["apple"]))
}

set of text badges
badges.Add("explorer")
badges.Add("explorer")
Console.Log(Text.From(badges.count))
```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.recipe__lookup"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Expected output:

```text
3
1
```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/recipe--lookup/program --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Add a pear price and ask for it. Then check for a missing key before trying to print its value.

Source: demonhunterlabs/app/lib/yeho-walkthrough.ts

AI training permission: https://demonhunterlabs.com/ai-use
