mastodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance, open to everyone, but mainly English and French speaking.

Administered by:

Server stats:

820
active users

#alist

0 posts0 participants0 posts today
Susan Larson ♀️🏳️‍🌈🏳️‍⚧️🌈<p><a href="https://mastodon.online/tags/JonathanBailey" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>JonathanBailey</span></a> says <a href="https://mastodon.online/tags/Bridgerton" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Bridgerton</span></a> <a href="https://mastodon.online/tags/role" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>role</span></a> helped him <a href="https://mastodon.online/tags/promote" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>promote</span></a> <a href="https://mastodon.online/tags/LGBTQ" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LGBTQ</span></a>+ <a href="https://mastodon.online/tags/community" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>community</span></a>. </p><p>As well as telling more <a href="https://mastodon.online/tags/LGBTQ" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LGBTQ</span></a>+-<a href="https://mastodon.online/tags/focused" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>focused</span></a> <a href="https://mastodon.online/tags/stories" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>stories</span></a>, Bailey has been able to use his <a href="https://mastodon.online/tags/Alist" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Alist</span></a> <a href="https://mastodon.online/tags/status" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>status</span></a> to promote <a href="https://mastodon.online/tags/causes" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>causes</span></a> close to his heart – for example, his new <a href="https://mastodon.online/tags/partnership" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>partnership</span></a> with LGBTQ+ <a href="https://mastodon.online/tags/young" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>young</span></a> <a href="https://mastodon.online/tags/people" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>people</span></a>’s <a href="https://mastodon.online/tags/charity" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>charity</span></a> <a href="https://mastodon.online/tags/JustLikeUs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>JustLikeUs</span></a>. </p><p><a href="https://www.thepinknews.com/2023/11/17/jonathan-bailey-bridgerton-lgbtq/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">thepinknews.com/2023/11/17/jon</span><span class="invisible">athan-bailey-bridgerton-lgbtq/</span></a></p>
Susan Larson ♀️🏳️‍🌈🏳️‍⚧️🌈<p><a href="https://mastodon.online/tags/AList" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>AList</span></a> <a href="https://mastodon.online/tags/Stars" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Stars</span></a> Sign On For ‘<a href="https://mastodon.online/tags/DragIsntDangerous" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DragIsntDangerous</span></a>’ <a href="https://mastodon.online/tags/Telethon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Telethon</span></a> </p><p><a href="https://mastodon.online/tags/Hollywood" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Hollywood</span></a> isn’t having it with the <a href="https://mastodon.online/tags/RepublicanParty" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>RepublicanParty</span></a>'s <a href="https://mastodon.online/tags/drag" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>drag</span></a> <a href="https://mastodon.online/tags/bans" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>bans</span></a> </p><p><a href="https://mastodon.online/tags/Women" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Women</span></a> <a href="https://mastodon.online/tags/Transgender" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Transgender</span></a> <a href="https://mastodon.online/tags/LGBTQIA" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LGBTQIA</span></a> <a href="https://mastodon.online/tags/Entertainment" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Entertainment</span></a> <a href="https://mastodon.online/tags/TV" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>TV</span></a> <a href="https://mastodon.online/tags/Drag" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Drag</span></a> <a href="https://mastodon.online/tags/Representation" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Representation</span></a> <a href="https://mastodon.online/tags/Culture" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Culture</span></a> </p><p><a href="https://www.pride.com/events/drag-queen" rel="nofollow noopener noreferrer" target="_blank"><span class="invisible">https://www.</span><span class="">pride.com/events/drag-queen</span><span class="invisible"></span></a></p>
veer66<p>I try to emulate Clojure’assoc on Common Lisp’s alist. <a class="hashtag" href="https://norze.world/tag/commonlisp" rel="nofollow noopener noreferrer" target="_blank">#commonlisp</a> <a class="hashtag" href="https://norze.world/tag/lisp" rel="nofollow noopener noreferrer" target="_blank">#lisp</a> <a class="hashtag" href="https://norze.world/tag/assoc" rel="nofollow noopener noreferrer" target="_blank">#assoc</a> <a class="hashtag" href="https://norze.world/tag/alist" rel="nofollow noopener noreferrer" target="_blank">#alist</a> </p><pre><code>(defun assoc* (m k v &amp;key test) (acons k v (remove-if (lambda (i) (if test (funcall test (car i) k) (eq (car i) k))) m)))</code></pre>
veer66Key-value data in Common Lisp<p>tags: <a class="hashtag" href="https://norze.world/tag/commonlisp" rel="nofollow noopener noreferrer" target="_blank">#commonlisp</a> <a class="hashtag" href="https://norze.world/tag/keyvalue" rel="nofollow noopener noreferrer" target="_blank">#keyvalue</a> <a class="hashtag" href="https://norze.world/tag/plist" rel="nofollow noopener noreferrer" target="_blank">#plist</a> </p><p>I enjoy using key-value data in dynamic languages. For example, in Python, I can create key-value data for storing the metadata of a document as shown below. I don’t discuss why I don’t use struct, class, named tuple in this post.</p><pre><code>doc_metadata = {"title": "The Rust Programming Language", "type": "book", "number-of-pages": 584, "authors": ["Steve Klabnik", "Carol Nichols", "contributions"]}</code></pre><p>I can code read/write a value easily, for example:</p><pre><code># Write doc_metadata["type"] = "text book" # Read print(doc_metadata["type"])</code></pre><p>In Perl and Ruby, we can use Hash, which is almost the same thing as Dict in Python. In JavaScript, we can use an object. </p><p>Common Lisp is different. We can use a hash table, but it is not as convenient as Dict in Python. </p><pre><code>(let ((doc-metadata (make-hash-table))) (setf (gethash :title doc-metadata) "The Rust Programming Language") (setf (gethash :type doc-metadata) :BOOK) (setf (gethash :number-of-pages doc-metadata) 584) (setf (gethash :authors doc-metadata) '("Steve Klabnik" "Carol Nichols" "contributions")))</code></pre><p>Besides construction, printing a hash table is not so convenient. Maybe one can create a function or macro to make creating/printing a hash table convenient. I still felt that I abused Common Lisp. </p><p>My code is usually too buggy when I keep mutating the same variable. So I prefer using an immutable data structure to prevent me from messing things up. Moreover, my key-value data usually do not have more than five keys. So I don’t strictly need to use an efficient data structure, namely, hash table or binary search tree. So I use alist (assosiation list). I can construct a list like below:</p><pre><code>(setq doc-metadata '((:title . "The Rust Programming Language") (:type . :BOOK) (:number-of-pages . 542) (:authors . '("Steve Klabnik" "Carol Nichols" "contributions"))))</code></pre><p>IMO, it looks concise and convenient. We can retrieve key-value pair with a specific key using the assoc function, which I suppose it does linear search. Linear search can be slow. However, my alist doesn’t have a lot of keys. </p><p>Instead of replacing a value with another value, I can add a new key-value pair with an existing key, for example:</p><pre><code>(setq another-doc-metadata (acons :type :TEXT-BOOK doc-metadata))</code></pre><p>By retrieving the value of :type using assoc, we get the new value because assoc function retrieves the first key found in alist, for example:</p><pre><code>(cdr (assoc :type another-doc-metadata)) ;; OUTPUT =&gt; :TEXT-BOOK</code></pre><p>However, with function calls instead of number/string literal, alist doesn’t look concise anymore, for example:</p><pre><code>(list (cons :title (get-title x y z)) (cons :type (get-type x)) (cons :number-of-pages (get-number-of-pages a b c)) (cons :authors (get-authors c d)))</code></pre><p>plist looks much more concise, for example:</p><pre><code>(setq doc-metadata (list :title (get-title x y z) :type (get-type x) :number-of-pages (get-number-of-pages a b c) :authors (get-authors c d)))</code></pre><p>I can retrieve a value corresponding to a key easily by getf function. For example:</p><pre><code>(getf doc-metadata :type)</code></pre><p>A new value can be replaced the old value by setf, example:</p><pre><code>(setf (getf doc-mentadata :type) :TEXT-BOOK)</code></pre><p>setf is different from acons since acons doesn’t mutate the existing list, setf does. Therefore plist is not exactly what I’m looking for. </p><p>Maybe the best way is using an Alexandria function for converting plist ot alist as Michał “phoe” Herda suggested.</p>