;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/ll/ll-abc.el ;; ;; -------------------------------------------------------------------------- (require 'cl-lib) (cl-pushnew "." load-path :test #'string=) (require 'luki-lisp) ;; -------------------------------------------------------------------------- (defun alphabet (&optional as-list) (let ((abc "a b c d e f g h i j k l m n o p q r s t u v w x y z")) (if as-list (cl-remove ?\s (string-to-list abc)) abc))) ;; (alphabet) ; a b c d e f g h i j k l m n o p q r s t u v w x y z ;; (alphabet 'as-list) ; (97 98 99 100 101 102 103 104 105 106 107 108 ...) ;; (--- (alphabet 'as-list)) ; 26 ;; -------------------------------------------------------------------------- (defun echo-alphabet (&optional num) (interactive "P") (let ((as-list (alphabet 'as-list))) (or num (setq num (--- as-list))) (let* ((part (cl-subseq as-list 0 num)) (str-list (mapcar (L (c) (char-to-string c)) part)) (str-almost (@f "%s" str-list)) (str (substring str-almost 1 (1- (--- str-almost))))) ($ str)))) (defalias 'abc #'echo-alphabet) ;; (echo-alphabet 2) ; a b ;; (echo-alphabet -2) ; a b c d e f g h i j k l m n o p q r s t u v w x ;; (echo-alphabet 10) ; a b c d e f g h i j ;; (echo-alphabet -10) ; a b c d e f g h i j k l m n o p ;; -------------------------------------------------------------------------- (<- 'll-abc)