initial import
This commit is contained in:
commit
dcc401b6e9
5 changed files with 101 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
test.db
|
||||
bin
|
||||
log
|
||||
.env
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -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.
|
19
decons.asd
Normal file
19
decons.asd
Normal file
|
@ -0,0 +1,19 @@
|
|||
(in-package #:asdf-user)
|
||||
|
||||
(defsystem :decons
|
||||
:author "cyberconcepts.org Team <team@cyberconcepts.org>"
|
||||
: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)))
|
40
decons.lisp
Normal file
40
decons.lisp
Normal file
|
@ -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))))
|
17
test-decons.lisp
Normal file
17
test-decons.lisp
Normal file
|
@ -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))
|
Loading…
Add table
Reference in a new issue