Skip to content

Consider a Sink to mirror Source #144

Description

@ekrich

I know we are not wanting a big Scala library and such but this is where we could make some things easier for beginners or just for easy scripting. I was just doing some analysis on the sbt build for Scala Native and wrote the following. I think we could have something even easier than Python.

import scala.io.Source

val lines = Source
  .fromFile("config.txt")
  .getLines
  .toList
  .sorted
  .groupMapReduce[String, Int](identity)(_ => 1)(_ + _)
  .toList
  .map(t => t._1 + t._2)
  .sorted

val file = new java.io.FileWriter("config-out.txt")
for (line <- lines) file.write(line + "\n")
file.close()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions