Last active
December 10, 2015 02:38
-
-
Save martialboniou/4369028 to your computer and use it in GitHub Desktop.
Test cl-define.shen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\* This script is aimed to run on Shen 7.1 on any Common Lisp port *\ | |
(load "cl-destroy.shen") | |
(load "cl-define.shen") | |
\* old behavior *\ | |
(do (output "*** OLD BEHAVIOR ***~%") start) | |
(define sad-foo X -> (sad-bar X)) | |
(define sad-bar X Y -> (+ X Y)) | |
(trap-error ((sad-foo 5) 2) (/. E (do (output "+++expected error on CL: ~A+++~%" (error-to-string E)) expected-error))) | |
\* one may use (destroy-it sad-bar) to avoid arity change warning *\ | |
(define sad-bar X -> X) | |
(do (output "=> ~A~%" (sad-foo 7)) | |
(map (function destroy-it) [sad-foo sad-bar]) reset) | |
\* new behavior *\ | |
(do (output "*** NEW BEHAVIOR ***~%") start) | |
(cc-define happy-foo X -> (happy-bar X)) | |
(caller-list happy-bar) \* => [happy-foo] *\ | |
(cc-define happy-bar X Y -> (+ X Y)) | |
((happy-foo 5) 2) \* ok *\ | |
(cc-define happy-bar X -> X) \* strangely works on REPL but not from loading *\ | |
(caller-list happy-bar) \* => [happy-foo] *\ | |
(happy-foo 7) \* ok *\ | |
(map (function destroy-it) [happy-foo happy-bar])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment