#!/usr/bin/env node

var sc = require('skale-engine').context();

var file = process.argv[2] || '/etc/hosts';

sc.textFile(file)
  .flatMap(line => line.split(' '))
  .map(word => [word, 1])
  .reduceByKey((a, b) => a + b, 0)
  .count().then(console.log)

@@ -239,17 +239,59 @@
 hen(
-console.log)
+function (res) %7B%0A  %09console.log(res);%0A%09sc.end();%0A  %7D);
 %0A

Add sc.end() to exit after results. Suggested by @tfauck.