|
From: | Emanuel Berg |
Subject: | Re: puzzle with string permutations [photo] |
Date: | Tue, 07 Jun 2022 09:58:59 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>> (calc-eval "fact(5)") => "120" >> (calc-eval "fact(10)") => "3628800" > > Indeed, however that isn't lispy either ... (defun faculty (n) (if (> n 1) (* n (faculty (1- n))) 1) ) ;; (faculty 5) ; 120 ;; (faculty 10) ; 3 628 800 (defun string-perms-num (str) (faculty (length str) )) ;; (string-perms-num "kudce") ; 120 -- underground experts united https://dataswamp.org/~incal
[Prev in Thread] | Current Thread | [Next in Thread] |