File: test791.thp

package info (click to toggle)
theme-d 7.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,036 kB
  • sloc: lisp: 9,625; sh: 5,321; makefile: 715; ansic: 477
file content (47 lines) | stat: -rw-r--r-- 1,455 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
;; -*-theme-d-*-

;; Copyright (C) 2020 Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.

;; Expected results: translation error

(define-proper-program (tests test791)

  (import (standard-library core)
	  (standard-library list-utilities)
	  (standard-library console-io))

  (define <general-proc> (:simple-proc ((rest <object>)) <object> nonpure))

  (define-param-proc map-nonpure0
      (%arglist %result-type)
      (((proc (:procedure ((splice %arglist)) %result-type nonpure))
  	(lists (type-loop %argtype %arglist (:uniform-list %argtype))))
       (:uniform-list %result-type)
       nonpure)
    (match-type lists
      ((lists1 (type-loop %argtype %arglist (:nonempty-uniform-list %argtype))) 
       (let ((cars (map-car lists1))
  	     (cdrs (map-cdr lists1)))
  	  (cons
  	   (apply-nonpure proc cars)
  	   (map-nonpure0 proc cdrs))))
      (else null)))

  (define-simple-proc $myproc (((l-args (rest <object>))) <object> nonpure)
    (match-type l-args
      ((l1 (:tuple <object>))
       (console-display-line (car l1))
       null)
      (else (raise 'error1))))
  
  (define-simple-proc $map (((l-args (rest <object>))) <object> nonpure)
    (match-type l-args
      ((l (:pair <general-proc> (:uniform-list <nonempty-list>)))
       (map-nonpure0 (car l) (cdr l)))
      (else (raise 'error2))))
  
  (define-main-proc (() <none> nonpure)
    ($map $myproc '(1 2 3 4 5))))