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

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -