Sha256: ce95b56dc572879893a23beaa75edfa86acfab122fbdcfb56f505baf00195836

Contents?: true

Size: 492 Bytes

Versions: 396

Compression:

Stored size: 492 Bytes

Contents

(defmodule parallel-letter-frequency
  (export (dict 1)))

(defun dict (strings)
  (let ((pid (spawn #'loop/0)))
    (lists:foreach (lambda (string) (! pid `#(string ,string))) strings)
    (! pid `#(done ,(self))))
  (receive (freqs freqs)))

(defun loop () (loop (dict:new)))

(defun loop (freqs)
  (receive
    (`#(string ,string) (loop (lists:foldl #'frequency/2 freqs string)))
    (`#(done   ,from)   (! from freqs))))

(defun frequency (char freqs) (dict:update_counter char 1 freqs))

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.0.0.5 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-2.0.0.4 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-2.0.0.3 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-2.0.0.2 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-2.0.0.1 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-2.0.0.0 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.4.1 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.4.0 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.3.0 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.2.1 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.2.0 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.1.2 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.1.1 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.1.0 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.0.1 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe
trackler-1.0.0 tracks/lfe/exercises/parallel-letter-frequency/src/example.lfe