File: test910.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 (40 lines) | stat: -rw-r--r-- 1,225 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
;; -*-theme-d-*-

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

;; Expected results: translation and running OK


(define-proper-program (tests test910)
  
  
  (import (standard-library core)
          (standard-library list-utilities)
          (standard-library string-utilities)
          (standard-library console-io))


  (define-simple-method +one (((i <integer>)) <integer> pure)
    (+ i 1))


  (define-simple-proc myproc
      (((s1 <symbol>) (s2 <symbol>) (i3 <integer>) (i4 <integer>)) <integer> pure)
    (if (equal? s1 s2) (+ i3 i4) (- i3 i4)))

  (define-simple-proc myproc2
      (((str1 <string>) (str2 <string>) (str3 <string>)) <string> nonpure)
    (console-display-line str1)
    (console-display-line str2)
    (console-display-line str3)
    (string-append str1 str2 str3))

  (define-main-proc (() <none> nonpure)
    (console-display-line (apply cons '(1 2)))
    (console-display-line (apply map1 (list +one '(1 2 3))))
    (console-display-line (apply myproc 'abc 'abc '(1 2)))
    (console-display-line (apply myproc 'abc 'def '(3 2)))
    (console-display-line (apply-nonpure myproc2 "abc" (list "def" "ghi")))))