agentsclimarketplace

Python scala functional

Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-gemini-3-flash-preview/python-scala-translation/python-scala-functional

Mapping Python's functional tools to idiomatic Scala equivalents, including lambdas and collection methods.From its SKILL.md

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

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

SKILL.md

1.2 KB, 315 tokens by cl100k_base, as published. Nobody here has run it

Python to Scala Functional Programming

This skill focuses on functional patterns and collection transformations.

Lambdas and Functions

  • Python: lambda x: x * 2
  • Scala: (x: Int) => x * 2 or _ * 2 (placeholder syntax).

Collection Operations

OperationPythonScala
Mapmap(f, items)items.map(f)
Filterfilter(p, items)items.filter(p)
Reducefunctools.reduce(f, items)items.reduce(f)
For-eachfor x in items: do(x)items.foreach(do)
Zipzip(a, b)a.zip(b)
Sortsorted(items, key=...)items.sortBy(...)

Lazy Sequences

  • Python: Generators (yield) and Iterator.
  • Scala: LazyList, Iterator, or View.

Higher-Order Functions

Scala supports HOFs natively.

def applyFunc(f: Int => String, x: Int): String = f(x)

Pattern Matching (Instance Checks)

Instead of isinstance, use match for clean type dispatch.

value match {
  case s: String => "string"
  case i: Int    => "int"
  case _         => "unknown"
}

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.