source: trunk/source/tests/ansi-tests/rctest/lambda-generator.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 966 bytes
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Mon Jun  9 20:57:34 2003
4;;;; Contains: Generators for lambda expressions
5
6(in-package :rctest)
7
8(compile-and-load "generator.lsp")
9
10
11(defgenerator lambda-list-generator
12  :body
13  (let ((vars (loop for i from 1 to size collect (gensym))))
14    (values vars t vars)))
15
16(defvar *lambda-list-generator* (make-instance 'lambda-list-generator))
17
18(defgenerator lambda-generator.1 :keys (vars)
19  :body
20  (let* ((s1 (random (min 5 size)))
21         (s2 (- size s1)))
22    (multiple-value-bind (lambda-list success1 lambda-vars)
23        (apply #'generate *lambda-list-generator* s1 ctxt)
24      (let ((vars (append (mapcar #'list lambda-vars) vars)))
25        (multiple-value-bind (body success2)
26            (apply #'generate 'implicit-progn-generator s2 :vars vars ctxt)
27          (if (and success1 success2)
28              (values `(lambda ,lambda-list ,@body))
29            (values nil nil)))))))
30
31(defvar *lambda-generator* (make-instance 'lambda-generator.1))
Note: See TracBrowser for help on using the repository browser.