Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 5929 days ago | link | parent

Alternatively, we could define compose as being:

  (= compose
     (reducer
       (fn () (err "compose requires at least one argument"))
       (fn (e) e)
       (fn (a b) (<base>compose a b))))

  (def reducer (f0 f1 f2)
    (fn rest
      (if
        (no rest)
          (f0)
        (no:cdr rest)
          (f1:car rest)
          ((afn (acc l)
             (if l
                 (self (f2 acc (car l)) (cdr l))
                 acc))
           (f2 (car rest) (cadr rest)) (cddr rest)))))
(as I proposed here: http://snapvm.blogspot.com/2008/08/base-functions.html)

Then we can redefine <base>compose as:

  (defm <base>compose ((t a int) (t b int))
    (annotate 'composed-int
      (cons a b)))
  (defm <base>compose ((t a composed-int) (t b int))
    (annotate 'composed-int
      (cons a b)))
Then we can redefine the call* table as an overloading of the <base>call function:

  (defm <base>call ((t l cons) (t v composed-int))
    (let (first second) (rep v)
      ((l first) second)))
> 2. Allow the reader to treat a parenthesized item as an item that supports intrasymbol syntax.

This is probably going to conflict with (a . d) format