[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to delete all nil properties from a plist?
From: |
Rusi |
Subject: |
Re: How to delete all nil properties from a plist? |
Date: |
Sat, 1 Aug 2015 20:55:24 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Sunday, August 2, 2015 at 7:06:24 AM UTC+5:30, Pascal J. Bourguignon wrote:
> Emanuel Berg writes:
>
> > Marcin Borkowski 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))
>
> This is horrible. Again, you can't prevent yourself writing O(n²) code
> when O(n) would do perfectly.
Hey Pascal!
If O(n²) is 'horrible' what is O(n³)? And O(n⁴) ?
And the stuff in NP?
[I suppose the french lexicon has many adjectives...]
BTW: Thanks for being civilized/cultured and using a non-ASCII character ²
when it is appropriate. Vive la Unicode!
- 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, 2015/08/01
- 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
- Re: How to delete all nil properties from a plist?, John Mastro, 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/07