Python scala data structures
Guidelines for translating Python dataclasses, enums, and collections to Scala.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill python-scala-data-structuresAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
0.8 KB, 174 tokens by cl100k_base, as published. Nobody here has run it
Python to Scala Data Structures
Dataclasses to Case Classes
- Python
@dataclass(frozen=True)-> Scalacase class. - Python
field(default_factory=dict)-> Scala default argumentmetadata: Map[String, Any] = Map.empty.
Enums
- Python
Enum-> Scalasealed traitwithcase objects orEnumeration. - For string values, a
sealed traitwith avalueproperty is idiomatic.
Collections
- Python
list-> ScalaListorVector. - Python
dict-> ScalaMap. - Python
tuple-> ScalaTupleorVector(if variable length). - Python
Sequence-> ScalaSeq. - Python
Iterable-> ScalaIterable. - Python
Iterator-> ScalaIterator.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.