Is there a concise emacs lisp equivalent of Python's [n:m] list slices? -


One thing I remember myself in emacs lisp is surprising, a special bit of manipulation in the list A short list of Python miss skiing.

  & gt; & Gt; & Gt; Mylist = ["foo", "bar", "baz", "qux", "frobnitz"] & gt; & Gt; & Gt; My List [1: 4] ['Bar', 'False', 'Quix']   

See the function but and nthcdr In the MACAC documentation, which will give the same result with code:

  (setq mylist '("foo" "bar" "baz" Quax "" fronnitz ")) (but the plot (nthcdr 1 mylist) 1) ;; There is a more concise way to get a list piece by combining  butlast  and  nthcdr  ("bar" "baz" "qux")   < P> code>?   

Be sure:

  (required 'cl) (Setq Mylist '("foo" "bar" "baz" "qux" "frobnitz")) (subseq mylist 1 4) ;; ("Bar", "falcon" "quakes")    

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -