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.6.20 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.19 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.18 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.17 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.16 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.15 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.14 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.13 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.12 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.11 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.10 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.9 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.8 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.7 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.6 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.5 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.4 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.3 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.2 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.0.6.1 tracks/lfe/exercises/trinary/src/example.lfe