unofficial mirror of emacs-tangents@gnu.org
 help / color / mirror / Atom feed
* Request for review of my Emacs project elosort
@ 2024-09-03  7:25 Sergey Lilo
  2024-09-03 14:55 ` Emanuel Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Lilo @ 2024-09-03  7:25 UTC (permalink / raw)
  To: emacs-tangents

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.
What should I improve there? Any advice and comments are appreciated!

Thanks in advance!

---
via emacs-tangents mailing list (https://lists.gnu.org/mailman/listinfo/emacs-tangents)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Request for review of my Emacs project elosort
  2024-09-03  7:25 Request for review of my Emacs project elosort Sergey Lilo
@ 2024-09-03 14:55 ` Emanuel Berg
  2024-09-03 19:43   ` Sergey Lilo
  0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2024-09-03 14:55 UTC (permalink / raw)
  To: emacs-tangents

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


---
via emacs-tangents mailing list (https://lists.gnu.org/mailman/listinfo/emacs-tangents)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Request for review of my Emacs project elosort
  2024-09-03 14:55 ` Emanuel Berg
@ 2024-09-03 19:43   ` Sergey Lilo
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Lilo @ 2024-09-03 19:43 UTC (permalink / raw)
  To: emacs-tangents

On Tue, Sep 3, 2024 at 9:34 PM Emanuel Berg <incal@dataswamp.org> wrote:
>
> 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?
>
Yes, after some series of rating updates according to the user's answers
the Elo ratings converge into more or less stable values. 2*n^2 or
better 3*n^n is enough.
One could use it to sort a list of tasks by priority, for example, if
you struggle with deciding which one
is the highest priority. Or use it to scientifically prove that
oranges are better than apples!
It's fun - try it :)

> GLHF!
Thank you for useful advice, Emanuel!

---
via emacs-tangents mailing list (https://lists.gnu.org/mailman/listinfo/emacs-tangents)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-03 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03  7:25 Request for review of my Emacs project elosort Sergey Lilo
2024-09-03 14:55 ` Emanuel Berg
2024-09-03 19:43   ` Sergey Lilo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).