emacs-devel
[Top][All Lists]
Advanced

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

Re: small seq function for json data


From: Stefan Huchler
Subject: Re: small seq function for json data
Date: Tue, 18 Oct 2016 05:04:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Nicolas Petton <address@hidden> writes:

> Stefan Huchler <address@hidden> writes:
>
>> Hello,
>
> Hi Stefan,
>
>> So inspired by let-alist I wrote a more powerful version that supports
>> also vector which is also used in json messages.
>>
>> (setq x '((foo . [((bar . "string of interest"))])))
>>
>> (defun sbit-seq-get (seq path)
>>   (cond ((null path) seq)
>>       ((listp seq)
>>        (sbit-seq-get (cdr (assoc (car path) seq)) (cdr path))
>>        )
>>      ((vectorp seq)
>>       (sbit-seq-get (elt seq (car path)) (cdr path))
>>       )
>>      (t seq)))
>>
>> (sbit-seq-get x '(foo 0 bar))
>
> Did you have a look at `map-nested-elt'? I often use it to access JSON
> data.

Well,

as far as I can tell it does what I want to do (and better), now you make me
wanna update to emacs 25.1 (dont tease me).

I mean I have emacs 25.1 installed paralell anyway, but dont want to
fiddle with the exwm package in nixos, in which I live :)

Whatever not that important for now I guess but it is in upstream good
to know, then I have to not write a bug to add somethnig like that in
seq.el.




reply via email to

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