emacs-tangents
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Request for review of my Emacs project elosort


From: Emanuel Berg
Subject: Re: Request for review of my Emacs project elosort
Date: Tue, 03 Sep 2024 16:55:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Sergey Lilo wrote:

> https://github.com/lilo/elosort
> (my savannah.gnu.org account is in approval stage)
>
> Elosort is a small for fun project I've been working on
> while studying Emacs Lisp.

Is the algorithm you setup explicitely what is on top for any
two items, and you score points every time you are are
prefered to something else?

And then you sort by total score? That simple?

> What should I improve there?

Instead of your 'swap', see if you like `cl-rotatef'.

Below is a one-liner to shuffle a list - the function is
called 'scramble-string' but as you see it works for lists
as well.

;;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/comic-book-insult.el

(require 'seq)

(defun scramble-string (str)
  (seq-sort (lambda (_ __) (zerop (random 2))) str))

;; (scramble-string '(1 2 3))

(defun comic-book-insult ()
  (interactive)
  (insert (format "%s!" (scramble-string "@#$%&"))))

;; (comic-book-insult) ; #$%&@!
;; (comic-book-insult) ; $&#@%!

(provide 'comic-book-insult)

> Any advice and comments are appreciated!

You can always do:

(elint-current-buffer)
(checkdoc-current-buffer t)

And this:

  (package-lint-current-buffer)

If you get it to work; it is in MELPA and in the Debian repos
(as elpa-package-lint). It used to work for me but now gets
into too-far nesting.

GLHF!

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]