Sha256: 09686a2f3f567de211a1532d69f01a85aea7efb396831319594e161a5fd08b4e

Contents?: true

Size: 388 Bytes

Versions: 396

Compression:

Stored size: 388 Bytes

Contents

(defmodule trinary
  (export (to-decimal 1)))

(defun BASE () 3)

(defun to-decimal (string) (to-decimal string 0))

(defun to-decimal
  ([() acc] acc)
  ([`(,digit . ,digits) acc] (when (>= digit #\0) (=< digit #\2))
   (to-decimal digits (+ (digit->int digit) (* acc (BASE)))))
  ([_string _acc] 0))

(defun digit->int
  ([digit] (when (>= digit #\0) (=< digit #\2))
   (- digit #\0)))

Version data entries

396 entries across 396 versions & 1 rubygems

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