Move 1988-2004 entries into subdirs
We we move 1988-2004 entries from all of a year's winning entries in a single directory to each winner being in their own sub-directory under the given year directory.
This commit is contained in:
1 parent
1e82e8aa3e
commit
d2a42f42e8
478 files changed
No files matched your search
@@ -0,0 +1,71 @@
|
||||
Best of show:
|
||||
|
||||
Jari Arkko, Ora Lassila, Esko Nuutila
|
||||
Laboratory of Information Processing Science
|
||||
Helsinki University of Technology
|
||||
Otakaari 1
|
||||
02150 Espoo
|
||||
Finland
|
||||
|
||||
Judges notes:
|
||||
|
||||
This is the most useful program entered this year. It is a
|
||||
rather large subset of lisp. It has no error recovery, and
|
||||
performs rather poorly in a number of cases. Even so, placing
|
||||
all this functionality in such a small, densely packed program,
|
||||
is impressive enough to win the Best of show award.
|
||||
|
||||
Selected notes from the author:
|
||||
|
||||
This program implements a Lisp interpreter in 1465 bytes of source.
|
||||
Some sophisticated features supported, eg. functionals and recursion.
|
||||
The special-forms/functions/variables implemented are:
|
||||
|
||||
+ - * < ()
|
||||
car cdr cons defun equal
|
||||
function if lambda quote t
|
||||
|
||||
Below are sample lisp expressions you might choose to try as input.
|
||||
The program implements a conventional lisp listener, i.e. you type in
|
||||
lisp expressions (followed by CR), the program evaluates them and
|
||||
prints out the return values. End execution by typing an end-of-file
|
||||
character.
|
||||
|
||||
(+ 2.5 3.1)
|
||||
(defun fib (n)
|
||||
(if (< n 2)
|
||||
1
|
||||
(+ (fib (- n 2)) (fib (- n 1)))))
|
||||
(fib 10)
|
||||
(defun ! (x) (if (equal x 0) 1 (* x (! (- x 1)))))
|
||||
(! 7)
|
||||
(defun fn1 (fn) (+ (fn 1 2) (fn 3 4)))
|
||||
(defun fn2 (a b) (+ a b))
|
||||
(fn1 (function +))
|
||||
(fn1 (function fn2))
|
||||
(fn1 (function (lambda (z1 z2) (+ z1 z2))))
|
||||
(quote a)
|
||||
(cons (quote (a b)) (quote (c d e)))
|
||||
(cons (quote (f)) ())
|
||||
(car (quote (a b c)))
|
||||
(cdr (cdr (quote (g h i))))
|
||||
|
||||
Please do not leave any whitespace before the first parenthesis when
|
||||
you type your input, or any other unnecessary whitespace. Please try to
|
||||
avoid any undefined variables or functions, wrong number of arguments
|
||||
etc. All these errors are likely to dump core (i.e. there are no error
|
||||
checks in the program).
|
||||
|
||||
Traditional Lisp implementations use cons cells as the main data
|
||||
structure. Lists are organized of pointer chains of these cells.
|
||||
In this program, an alternate representation was chosen: char*'s.
|
||||
All list operations, including the ones in the interpreter, are
|
||||
made using string representations of the lists. These operations
|
||||
must count parentheses and skip whitespace. This leads to extremely
|
||||
poor performance!
|
||||
|
||||
Copyright (c) 1989, Landon Curt Noll & Larry Bassel.
|
||||
All Rights Reserved. Permission for personal, educational or non-profit use is
|
||||
granted provided this this copyright and notice are included in its entirety
|
||||
and remains unaltered. All other uses must receive prior permission in writing
|
||||
from both Landon Curt Noll and Larry Bassel.
|
||||
@@ -0,0 +1,44 @@
|
||||
#define d define
|
||||
#d a include
|
||||
#a <stdio.h>
|
||||
#a <string.h>
|
||||
#a <ctype.h>
|
||||
#d p char*
|
||||
#d P ,(p)
|
||||
#d T(E) !strcmp(E,"()")
|
||||
#d U return
|
||||
#d W while
|
||||
#d X sbrk(199)
|
||||
#d z atof
|
||||
#d e isspace
|
||||
#d D A(_)
|
||||
#d E S(C(_))
|
||||
#d B(y) p y(_)p _;{
|
||||
#d G(y,V) B(y)p i;U sprintf(i=X,"%lf",z(E)V z(S(C(D)))),i;}
|
||||
|
||||
p sbrk(),*S(),*j(),*O,*H;K,Y,M=14;double
|
||||
z();Q(_)p _;{int V=0;W(e(*_))_++;H=_;W(V|!(e
|
||||
(*H)|*H==')'||(*H=='('&&H-_)))V+=(*H=='(')-(*H==
|
||||
')'),H++;U H-_;}B(C)U _++,Y=Q(_),_=strncpy(X,_,Y),_[
|
||||
Y]=0,_;}B(A)_++,_+=Q(_);W(e(*_))_++;U O=X,*O='(',strcpy(
|
||||
O+1,_),O;}B(Z)U _;}B(c)U C(E);}B(q)U A(E);}B(t)p i=E;U H=S(C
|
||||
(D)),sprintf(O=X,T(H )?"(%s)":"(%s %s",i,H+1)
|
||||
|
||||
,O;}B(F)U S(C(A(T(E)?D:_)));}L(i,s)p
|
||||
|
||||
i,*s;{U isdigit(*i) ? z(i)!=z(s):strcmp(i,s);}
|
||||
B(b)U L(E,S(C(D)))?"()":"t";}B(R)U E;}B(o)U z(E)<z(S(C(D)))?
|
||||
"t":"()";}G(f,+)G(g,-)G(h,*)p r[4][2]={"function" P R,
|
||||
"quote"P C,"lambda"P Z,"defun"P j};B(j)U r[M][1]=D,*
|
||||
r[M++]=C(_);}p not[99][2]={"if"P F,"equal"P b,"<"
|
||||
P o,"+"P f,"-"P g,"*"P h,"car"P c,"cdr"P q,
|
||||
"cons"P t,"t","t"};B(S)int Li,s;p u;if(
|
||||
isdigit(*_)|T(_))U _;for(Y=M;Y--;)
|
||||
if(!strcmp(_,*r[Y]))U r[Y][1]
|
||||
;u=E,_=D;if(*u-'(')U(*((p(*)())u)
|
||||
)(_);s=Li=M;W(!T(_))r[M][1]=E,*r[M++]
|
||||
="",_=D;O=C(u);W(!T(O))*r[Li++]=C(O),O=A(O);U O=S
|
||||
(C(A(u))),M=s,O;}main(){H=O=X,Y=0;W(Y|!e(K=getchar()))K==
|
||||
EOF?exit(0):0,Y+=(K=='(')-(K==')'),*H++=K;*H=0,puts(S(O))
|
||||
,
|
||||
main();{printf("XLISP 4.0\n");}}
|
||||
Reference in new issue
Block a user