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.2.1.180 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.179 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.178 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.177 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.176 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.175 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.174 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.173 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.172 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.171 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.170 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.169 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.167 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.166 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.165 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.164 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.163 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.162 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.161 tracks/lfe/exercises/trinary/src/example.lfe
trackler-2.2.1.160 tracks/lfe/exercises/trinary/src/example.lfe