Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Executable XML users challenge

Name: F r o z e n V o i d !!mJCwdV5J0Xy2A21 2011-12-08 5:01

provide any LISP macro with clear explanation of its structure and function
that is :
1.concise (max 10 lines)
2.does not have a C equivalent(at least not anything above 100 lines)
3.does not use any libraries or imported complex functions which are not in C
If you provide an exact explanation/commentary on what it does i'll try to make a C solution which
is equivalent to LISP one. If i fail to do so, LISP wins, if i provide a solution you can make another macro.
If all examples in the thread are provide with C equivalents, LISP loses.

Name: Anonymous 2011-12-09 16:55

>>173
In case you missed it, here is the central macro:
(define-syntax ck
  (syntax-rules (quote)
    ((ck () 'v) v)            ; yield the value on empty stack

    ((ck (((op ...) ea ...) . s) 'v)    ; re-focus on the other argument, ea
      (ck s "arg" (op ... 'v) ea ...))

    ((ck s "arg" (op va ...))        ; all arguments are evaluated,
      (op s va ...))            ; do the redex

    ((ck s "arg" (op ...) 'v ea1 ...)    ; optimization when the first ea
      (ck s "arg" (op ... 'v) ea1 ...)) ; was already a value

    ((ck s "arg" (op ...) ea ea1 ...)    ; focus on ea, to evaluate it
      (ck (((op ...) ea1 ...) . s) ea))

    ((ck s (op ea ...))            ; Focus: handling an application;
      (ck s "arg" (op) ea ...))        ; check if args are values
))

It's a continuation machine with a stack, mentioned originally in Programming Languages and Lambda Calculi, which eventually became the work Semantics Engineering with PLT Redex. Enjoy you are failure.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List