commit dcc401b6e9795baf5733868efdb5c262dd7bb4ab Author: Helmut Merz Date: Thu May 22 09:11:54 2025 +0200 initial import diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb3c359 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +test.db +bin +log +.env diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ac7c3da --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) 2024 team@cyberconcepts.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/decons.asd b/decons.asd new file mode 100644 index 0000000..7080818 --- /dev/null +++ b/decons.asd @@ -0,0 +1,19 @@ +(in-package #:asdf-user) + +(defsystem :decons + :author "cyberconcepts.org Team " + :license "MIT" + :version "0.0.1" + :homepage "https://www.cyberconcepts.org" + :description "Deconstruction as a method for implementing machine intelligence." + :depends-on (:alexandria + :scopes :scopes/test) + :components ((:file "decons")) + :long-description "decons: The base system of the decons project." + :in-order-to ((test-op (test-op "decons/test")))) + +(defsystem :decons/test + :depends-on (:decons) + :components ((:file "test-decons")) + :perform (test-op (o c) + (symbol-call :test-decons :run))) diff --git a/decons.lisp b/decons.lisp new file mode 100644 index 0000000..60a1d48 --- /dev/null +++ b/decons.lisp @@ -0,0 +1,40 @@ +;;;; decons + +(defpackage :decons + (:use :common-lisp) + (:local-nicknames (:util :scopes/util)) + (:export #:*pi* + #:area #:circle + #:absv #:double #:remainder + #:line + )) + +(in-package :decons) + +;;;; basic explorations + +(defconstant *pi* 3.14159) + +(defclass circle () + ;;; ! implement as closure + ((radius :accessor radius :initarg :radius :initform 1))) + +(defgeneric area (c) + (:method ((c circle)) + (* *pi* (radius c) (radius c)))) + +(defun double (f) + #'(lambda (v) (* 2 (funcall f v)))) + +(defun absv (v) + (if (< v 0) (- v) v)) + +(defun remainder (v d) + (if (< v d) + v + (remainder (- v d) d))) + +;;;; parameterized functions + +(defun line (x) + #'(lambda (w b) (+ b (* w x)))) diff --git a/test-decons.lisp b/test-decons.lisp new file mode 100644 index 0000000..e7c89a6 --- /dev/null +++ b/test-decons.lisp @@ -0,0 +1,17 @@ +;;;; decons/test-decons - basic tests. + +(defpackage :test-decons + (:use :common-lisp) + (:local-nicknames (:t :scopes/testing)) + (:export #:run) + (:import-from :scopes/testing #:deftest #:== #:!=)) + +(in-package :test-decons) + +(defun run () + (let ((t:*test-suite* (t:test-suite "decons"))) + (test-basic) + (t:show-result))) + +(deftest test-basic () + (== decons:*pi* 3.14159))