agentsclimarketplace

Python scala collections

Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-claude-opus-4-6/python-scala-translation/python-scala-collections

Guide for mapping Python collection types and operations to Scala equivalents.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill python-scala-collections

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

0.9 KB, 263 tokens by cl100k_base, as published. Nobody here has run it

Python to Scala Collections

Type Mappings

PythonScala
list[T]List[T] or mutable.ListBuffer[T]
dict[K, V]Map[K, V] or mutable.Map[K, V]
tuple[T, ...](T, ...) or Vector[T]
set[T]Set[T]
Sequence[T]Seq[T]
Iterable[T]Iterable[T]
Iterator[T]Iterator[T]

Mutable Collections

import scala.collection.mutable

// Python: list with append -> mutable.ListBuffer
val buf = mutable.ListBuffer.empty[Token]
buf += token

// Python: dict -> mutable.Map
val reg = mutable.Map.empty[String, TokenContainer[T]]
reg(key) = container

Collection Operations

// Python: [f(x) for x in xs] -> xs.map(f)
// Python: [x for x in xs if p(x)] -> xs.filter(p)
// Python: enumerate(xs) -> xs.zipWithIndex

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.