mes/test.mes

186 lines
3.3 KiB
Plaintext
Raw Normal View History

;;; -*-scheme-*-
;;; Mes --- Maxwell Equations of Software
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;;
;;; test.mes: This file is part of Mes.
;;;
;;; Mes is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; Mes is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Mes. If not, see <http://www.gnu.org/licenses/>.
;; The Maxwell Equations of Software -- John McCarthy page 13
;; http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
(display 123)
4
(newline)
2016-07-10 09:55:05 +01:00
(cons (display 'one-) (display 'two))
2016-07-09 21:01:00 +01:00
(newline)
(display 'hello-display-symbol)
(newline)
(display '(0 1 2))
(newline)
(display (- 12 3))
(newline)
(display (+ 3 4))
(newline)
(display 'and-0-1:)
(display (and 0 1))
(newline)
(display 'and-#f-2:)
(display (and #f 2))
(newline)
(display 'or-0-1:)
(display (or 0 1))
(newline)
(display 'or-#f-2:)
(display (or #f 2))
(newline)
(let ((p 5)
(q 6))
(display 'let-p:3-q:4)
(newline)
(display 'p:)
(display p)
(newline)
(display 'q:)
(display q)
(newline))
(display
(let ((p 5)
(q 6))
(display 'hallo)
(display p)
(display 'daar)
(display q)
(display 'dan)))
(newline)
(display 'let-dun)
(newline)
(define c 'b)
`(aa bb ,c)
(display `(pp qq ,c))
(newline)
2016-07-09 19:12:49 +01:00
(display
(let* ((aa 2)
(bb (+ aa 3))
#! boo !#
;;(bb 4)
)
(display 'allo:)
bb))
(newline)
(display 'let*-dun)
(newline)
2016-07-09 21:01:13 +01:00
(map display '(1 2 3 4))
(newline)
2016-07-09 21:47:36 +01:00
(map (lambda (x) (display x) (newline)) '(5 6 7 8))
2016-07-09 21:01:13 +01:00
(newline)
2016-07-09 21:05:07 +01:00
2016-07-09 21:47:36 +01:00
(map (lambda (i a) (display i) (display ':) (display a) (newline)) '(1 2 3 4) '(a b c d))
2016-07-09 21:05:07 +01:00
(newline)
2016-07-10 09:43:26 +01:00
(define a 0)
(display 'a=0:)
(display a)
(newline)
(set! a 1)
(display 'a=1:)
(display a)
(newline)
2016-07-10 11:52:53 +01:00
2016-07-10 12:45:54 +01:00
(display
((lambda (x)
(display 'x:)
(display x)
(newline)
(display 'setting-x=2)
(newline)
(set! x 2)
(display 'x:)
(display x)
(newline))
1))
2016-07-10 11:52:53 +01:00
(display (+ 11 12))
(newline)
(display (* 3 3))
(newline)
(display (/ 9 3))
(newline)
(display (= 3 '3))
(newline)
2016-07-10 12:04:10 +01:00
(display (if #t 'true))
(newline)
(display (if (eq? 0 '0) 'true 'false))
(newline)
(display (if (= 1 2) 'true 'false))
(newline)
2016-07-10 12:47:56 +01:00
(display 'factorial4=)
(display
(letrec ((factorial (lambda (n)
;; (display 'factorial:)
;; (display n)
;; (newline)
(if (= n 1) 1
(* n (factorial (- n 1)))))))
(factorial 4)))
(newline)
2016-07-10 14:19:20 +01:00
(define a 2)
(begin
(display 'a+3=)
(display (+ a 3)))
(newline)
2016-07-10 21:43:23 +01:00
" a b c"
(display "string me")
(newline)
(display (string-append "a" "b" "c"))
(newline)
(display (string-length (string-append "a" "b" "c")))
(newline)
2016-07-10 23:15:28 +01:00
#\m
(display #\m)
(newline)
(display #\101)
(newline)
(display #\newline)
(newline)
(display #\space)
(newline)
(display (string #\a #\space #\s #\t #\r #\i #\n #\g #\newline))
(newline)
'()