-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
TypeL is Common Lisp sublanguage with strong typing and type
inference a-la ML.
It is first version of TypeL, and it is very primitive. These
features are implemented:
1. Polymorphic type inference.
2. Curring.
3. TypeL is Lisp-1.
4. Arithmetic, boolean and list operations.
Features that will be implemented in feature releases:
1. Algebraic types and pattern matching.
2. Detailed error reporting.
3. Code optimization based on types.
TypeL is licensed under terms of LLGPL.
You can download TypeL from <http://lispnik.newmail.ru/typel>.
Examples:
======================================================================
(common-lisp:in-package "COMMON-LISP-USER")
;;; Expression inside typel:typel is type-checked.
(defun test (a b)
(declare (type integer a b))
(typel:typel ((a integer) (b integer))
(typel:+ a b)))
(test 1 2)
;;; => 3
(in-package "TYPEL-USER")
;;; Lists
;;; MAPCAR: ('TYPE31 -> 'TYPE28) -> (:LIST 'TYPE31) -> (:LIST 'TYPE28)
(deftypel ((mapcar fun list)
(if (equal nil list)
nil
(cons (fun (first list))
(mapcar fun (rest list))))))
;;; Curring: (+ 2) has type INTEGER -> INTEGER, because
;;; + has type INTEGER -> INTEGER -> INTEGER.
(typel ()
(mapcar (+ 2) (cons 1 (cons 2 nil))))
;;; => (3 4)
;;; Lambda expression. Don't use #' for lambdas.
(typel ()
(mapcar (lambda (x) (cons x nil)) (cons 1 (cons 2 nil))))
;;; => ((1) (2))
;;; This example demonstrates LETREC and curring
;;; FACT: INTEGER -> INTEGER
(deftypel
(fact ((letrec (((fact-acc acc n)
(if (0? n)
acc
(fact-acc (* acc n) (- n 1)))))
(fact-acc 1)))))
;;; Floating point math
;;; EXPONENTA: FLOAT -> INTEGER -> FLOAT
(deftypel
((exponenta x n)
(letrec (((exp-acc e p fact i)
(if (= i n)
e
(let ((new-fact (* fact i)))
(exp-acc (+. e (/. (*. p x) (int-to-float new-fact)))
(*. p x)
new-fact
(+ i 1))))))
(exp-acc 1.0 1.0 1 1))))
;;; Usage
(typel ()
(exponenta 1.0 100))
;;; => 2.7182818284590455d0
(typel ()
(exponenta 2.0 100))
;;; => 7.389056098930649d0
;;; Do not try to call EXPONENTA directly:
;;; (exponenta 2.0 100) ; <- will fail
;;; TypeL is Lisp-1.
;;; COMPOSE: (INTEGER -> INTEGER) -> (INTEGER -> INTEGER) -> INTEGER -> INTEGER
;;; ADD5: INTEGER -> INTEGER
(deftypel
((compose f g x)
(g (f x))))
((add5 n)
((compose (+ 2) (+ 3)) n)))
(typel () (add5 10))
;;; => 15
======================================================================
- --
Ivan Boldyrev
Today is the first day of the rest of your life.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.3.5 (GNU/Linux)
iQEVAwUBQGSlBg4ALcwzZFpVAQI2CAf+KvvIldXFTUlv5iIy0OErOK5nL2qE+ZWR
sCh1GXdr2pyWHo7yZRBn6ggh4xGcSVhkcAM/GsQfNJfgTcE8/W1LZRD6lMoRqkF3
FpU0rvNKU0dxWRxWgI3adtjpIX9yFNqOV38ocoS4SmZ+NhoAM0lPUccvE4BDyILV
zmWY8hNXYL++MlXsYIv8YflH4dhvwOEu33Towk7Y36v62YOnhBhIhMxVMUwEbj4m
eJaEmy8w4kHzALODuQr6nJFUZIH/EcZjcN/uIHx2oHOFi7Q07LZjANaNhAl2CtqG
iLKOnJdbV8rU2M+zVrGXK9Vr8Pa5bCq+xu/Myii6ykmWZi2M30iKEQ==
=042b
-----END PGP SIGNATURE-----
From: Carl Shapiro
Subject: Re: [ANN] TypeL 0.1 -- extension of Common Lisp with strong typing
Date:
Message-ID: <ouyk717rus3.fsf@panix3.panix.com>
There are at least two publicly-available systems which do the same
thing as your TypeL but are already in a complete state. Ask Google
about Mark Tarver's SEQUEL (very Common Lisp oriented) and its
successor Qi. They both offer a type secure veneer over Common Lisp.
Perhaps you could at least borrow some of their good ideas?
On 8696 day of my life Carl Shapiro wrote:
> There are at least two publicly-available systems which do the same
> thing as your TypeL but are already in a complete state. Ask Google
> about Mark Tarver's SEQUEL (very Common Lisp oriented) and its
> successor Qi. They both offer a type secure veneer over Common Lisp.
They both seems to be overcomplicated. And both are not free for
commerical use.
> Perhaps you could at least borrow some of their good ideas?
I will look more attentively at it, but they are based on very
different idea...
Actually TypeL is just demonstration of power of Lisp macros for one
of my friends. :)
--
Ivan Boldyrev
XML -- new language of ML family.
On 8696 day of my life Carl Shapiro wrote:
> There are at least two publicly-available systems which do the same
> thing as your TypeL but are already in a complete state. Ask Google
> about Mark Tarver's SEQUEL (very Common Lisp oriented) and its
> successor Qi. They both offer a type secure veneer over Common Lisp.
> Perhaps you could at least borrow some of their good ideas?
Qi is explicitly typed, BTW, while TypeL is implicitly typed. And
type system is quite different.
--
Ivan Boldyrev
"Assembly of Japanese bicycle require great peace of mind."
From: Carl Shapiro
Subject: Re: [ANN] TypeL 0.1 -- extension of Common Lisp with strong typing
Date:
Message-ID: <ouy65cpnao2.fsf@panix3.panix.com>
Ivan Boldyrev <···············@cgitftp.uiggm.nsc.ru> writes:
> Qi is explicitly typed, BTW, while TypeL is implicitly typed. And
> type system is quite different.
Regarding the type system, this is not neccesarily the case.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 8697 day of my life Carl Shapiro wrote:
> Ivan Boldyrev <···············@cgitftp.uiggm.nsc.ru> writes:
>
>> Qi is explicitly typed, BTW, while TypeL is implicitly typed. And
>> type system is quite different.
>
> Regarding the type system, this is not neccesarily the case.
Excuse me, Carl. I have re-read whole thread and I am ashamed. You
are only one who was attentive to my post and I started trolling
against you. Thank you for your advise about Qi, your attention and
your time.
- --
Ivan Boldyrev
Sorry my terrible English, my native language is Lisp!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.3.5 (GNU/Linux)
iQEVAwUBQGeq8g4ALcwzZFpVAQLHvAf/SIZ//WoOYXJTZj4zWmwMP6BeRDbFpZa9
sG3XNmS33BSewR+Ew+MgDebx4y8jdHSmgQW4RSNT3wJc8HPrVYYnhH3232JKOQlW
sVsa/8+COW6i/BYxHYTVNMVmFWrkyTOnWEaXhrWs2XpcROQNtoqcjLNjFISSsAgS
6UHkKCqkRzn77b2uZUQOrLsXipL4bfQJQo1jduFbfIXdSMWNeNkx6ClYWyi7ZSTY
0LgtvLNmqXwkDomOhbr+s2V1gA1EwAmpcbJ7iE23gd6NkShNsSTdiDLGi1pwzyXC
GjzU0ow0X2knhRhTk28hb8vZ9PD4g+FfGdKFlAdFJo4YyDa910AUKg==
=elUx
-----END PGP SIGNATURE-----