Skip to content

Der Bogen steht

arc de triomphe

Gestern haben PaulGraham und RobertMorris “Arc” veröffentlicht. Arc ist ein Lisp-Dialekt, der auf das absolute Minimum reduziert ist. Wie Brucio in “Arc debarks” schreibt:

What you are left is [with] is the bare essense of coding. Everything written is essential. Nothing is superfluous. There are truly no onions. The specification of Arc (which is the implementation of Arc) can be printed on just a few pages (full duplex); the whole thing is 4609 lines of code!

Was ich ja besonders mag ist der Geist, der durch den Bogen weht. Von der Homepage von Arc:

Arc embodies just about every form of political incorrectness possible in a programming language. It doesn’t have strong typing, or even type declarations; it uses overlays on hash tables instead of conventional objects; its macros are unhygienic; it doesn’t distinguish between falsity and the empty list, or between form and content in web pages; it doesn’t have modules or any predefined form of encapsulation except closures; it doesn’t support any character sets except ascii. Such things may have their uses, but there’s also a place for a language that skips them.

Zum Schluss – und damit ich endlich mal Lisp-Code syntaxhighlighten kann – “the axioms of the new Lisp world”, sprich: der Evaluator:

(define (ac s env)
(cond ((string? s) (string-copy s))  ; to avoid immutable strings
      ((literal? s) s)
      ((eqv? s 'nil) (list 'quote 'nil))
      ((ssyntax? s) (ac (expand-ssyntax s) env))
      ((symbol? s) (ac-var-ref s env))
      ((ssyntax? (xcar s)) (ac (cons (expand-ssyntax (car s)) (cdr s)) env))
      ((eq? (xcar s) 'quote) (list 'quote (ac-niltree (cadr s))))
      ((eq? (xcar s) 'quasiquote) (ac-qq (cadr s) env))
      ((eq? (xcar s) 'if) (ac-if (cdr s) env))
      ((eq? (xcar s) 'fn) (ac-fn (cadr s) (cddr s) env))
      ((eq? (xcar s) 'set) (ac-set (cdr s) env))
      ; this line could be removed without changing semantics
      ((eq? (xcar (xcar s)) 'compose) (ac (decompose (cdar s) (cdr s)) env))
      ((pair? s) (ac-call (car s) (cdr s) env))
      (#t (err "Bad object in expression" s))))

Verwandte Artikel

Post a Comment

Your email is never published nor shared. Required fields are marked *