[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to delete all nil properties from a plist?
From: |
Emanuel Berg |
Subject: |
Re: How to delete all nil properties from a plist? |
Date: |
Sun, 02 Aug 2015 03:32:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Marcin Borkowski <mbork@mbork.pl> writes:
>> Hi all, so I'm still using plists, though I'm less
>> and less sure that they are actually better than
>> alists for my use-case. Now I need to delete all
>> properties whose value is nil. I'm using this
>> function:
Try this:
(require 'cl)
(defun plist-drop-nil-props (l)
(let((new)
(prop nil) )
(cl-loop for x in l
do (if (or (setq prop (not prop)) x)
(setq new (append new (list x)))
(setq new (butlast new))))
new))
(plist-drop-nil-props
'(nil nil a 1 b 2 c nil d nil e 5 g nil nil nil) ) ; (a 1 b 2 e 5)
--
underground experts united
http://user.it.uu.se/~embe8573
- How to delete all nil properties from a plist?, Marcin Borkowski, 2015/08/01
- Re: How to delete all nil properties from a plist?, Marcin Borkowski, 2015/08/01
- Re: How to delete all nil properties from a plist?,
Emanuel Berg <=
- Message not available
- Message not available
- Re: How to delete all nil properties from a plist?, Pascal J. Bourguignon, 2015/08/02
- Re: How to delete all nil properties from a plist?, Emanuel Berg, 2015/08/05
- Message not available
- Re: How to delete all nil properties from a plist?, Pascal J. Bourguignon, 2015/08/05
- Re: How to delete all nil properties from a plist?, Emanuel Berg, 2015/08/05
- Re: How to delete all nil properties from a plist?, Emanuel Berg, 2015/08/05
- Re: How to delete all nil properties from a plist?, John Mastro, 2015/08/05