From e8c0f8e58b0039d8d3ed886654a5452168168436 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Thu, 13 Aug 2020 10:38:30 -0500 Subject: removed replaced $and $or with macros; added reader macro for $$ --- examples.lisp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'examples.lisp') diff --git a/examples.lisp b/examples.lisp index 7bd44e2..973ebee 100644 --- a/examples.lisp +++ b/examples.lisp @@ -1,15 +1,14 @@ (defpackage #:lt-examples - (:use #:cl #:lambda-toosl)) + (:use #:cl #:lambda-tools)) ;; http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers (defun luhn (n) (flet ((sum-dig (x) (if (> x 9) (- x 9) x))) - (>> n - #'reverse - ($$ (map 'list #'digit-char-p $char)) - ($$ (mapcar #'* - (loop :for i :upto (length $digits) :collect (1+ (mod i 2))) - $digits)) - ($$ (zerop (mod (apply #'+ (mapcar #'sum-dig $digits)) 10)))))) + (>> n #'reverse + #$(map 'list #'digit-char-p $char) + #$(mapcar #'* + (loop :for i :upto (length $digits) :collect (1+ (mod i 2))) + $digits) + #$(zerop (mod (apply #'+ (mapcar #'sum-dig $digits)) 10))))) -- cgit v1.2.3