Mitchell J. Wagner

Mitch Wagner

Miscellaneous

Tali Test

(@: def      | (@: def      | (@: def
 n: car      |  n: car      |  n: car
 p: [xs]     |  p: [xs]     |  p: [xs]
 f: (@: idx  |  f: (@: idx  |  f: (@: idx
     k: a    |      k: a    |      k: a
     t: xs)) |      t: xs)) |      t: xs))

Tali can start to look complicated quickly:

(@: def
 n: map
 p: [f k xs]     -- k for key: need to bind args in f
 f: (@: map-help
     f: f
     k: k
     xs: xs
     a: ()
     c: 0))

(@: def
 n: map-help
 p: [f k xs a c]
 f: (@: if
     p: (@:= a:c b:(@:dec v:(@:len xs:xs))) -- p for predicate
     t: (@: bind                            -- t for "if true"
         k: 'len
         v: (@:len xs:xs)
         m: a)
     f: (@: map-help                        -- f for "if false"
         f: f
         k: k
         xs: xs
         a: (@: bind
             k: (@:c)
             v: (@:f (@:k):(@:idx k:c m:xs))
             m: a)
         c: (inc c))))

(@: def
 n: ⊕
 p: [a b]
 f: (@: ∨
     a: (@: ∧
         a: a
         b: (@:¬ p:b))
     b: (@: ∧
         a: (@:¬ p:a)
         b: b)))

Perhaps a more interesting name for Tali would be "65" - named after the most perfect maximum line length.

(@: def
 n: quadratic-formula
 p: {a b c}
 f: (@: let
     B: (-b: (@:* a:-1 b:b)
         b²: (@:* a:b b:b)
         4ac:
         2a:
     f: (@: /
         n: (@:+-
             a:-b
             b:(@:√ r:(@:- a:b² b:4ac)))
         d: 2a))))