emacs lisp tutorial: list & vectors

  • Permalink
  • submit to reddit
  • Email
  • Follow


Fresh from the oven:

=E3=80=88Emacs Lisp Tutorial: List =EF=BC=86 Vector=E3=80=89
http://xahlee.org/emacs/elisp_list_vector.html

(for beginner lisper only)

plain text version follows. heavy use of unicode. also has html
tables.

-------------------------------------------------
Emacs Lisp Tutorial: List =EF=BC=86 Vector

Xah Lee, 2011-02-21

This page is a practical tutorial of Emacs Lisp's list and vector
datatype. If you don't know elisp, first take a look at Emacs Lisp
Basics.

Lisp has vector and list datatypes. These are similar to other
language's list, vector, array.

=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=
=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=
=81=E2=94=81=E2=94=81=E2=94=81
Vectors

To create a vector, write it like this (vector a b =E2=80=A6).

If you do not want the elements evaluated, write it like this: [a b
=E2=80=A6].

Creating a vector:

;; creating a vector
(setq v (vector 3 4 5)) ; each element will be evaluated
(setq v [3 4 5]) ; each element will NOT be evaluated

Length:

(length (vector 3 4 5))

Getting a Element:

use =E2=80=9Celt=E2=80=9D.

(elt (vector 3 4 5) 0) ; =E2=87=92 3. index starts at 0

Changing a Element:

use =E2=80=9Caset=E2=80=9D.

(setq v [3 4 5])
(aset v 0 "b")
v  ; =E2=87=92 ["b" 4 5]

=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80
Nested Vector

;; nested vector
[[1 2] [3 4]] ; 2 by 2 matrix
[8 [3 [2 9] c] 7 [4 "b"]] ; random nested vector


=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80
Looping Thru Vector

One simple way to go thru a vector is using mapcar. Note that it
returns a list, not vector.

;; add 1 to each
(mapcar '1+ [3 4 5] ) ; =E2=87=92 (4 5 6)

;; get first element of each row
(mapcar (lambda (x) (elt x 0)) [[1 2] [3 4]] ) ; =E2=87=92 (1 3)

You can also use =E2=80=9Cwhile=E2=80=9D. Example:

(setq v [3 4 5])
(setq i 0)
(while (< i (length v))
  (insert (format "%i" (elt v i)))
  (setq i (1+ i))  ) ; inserts "345"


=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80
Join and Misc

You can join 2 vectors into a new vector by =E2=80=9Cvconcat=E2=80=9D. You =
can convert
a vector to list by =E2=80=9Cappend=E2=80=9D, e.g. (append myVector nil).
(info "(elisp) Vector Functions")

=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=
=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=
=81=E2=94=81=E2=94=81=E2=94=81
List

To create a list, write it like this (list a b =E2=80=A6).

If you do not want the elements evaluated, write it like this: '(a b
=E2=80=A6).

; prints a list
(message "%S" '(a b c))

; assign a list to a var
(setq mylist '(a b c))

; create a list of values of variables
(let ((x 3) (y 4) (z 5))
  (message "%S" (list x y z))
) ; prints "(3 4 5)"

Some List Element Extraction Functions Function	Purpose
(car mylist)	first element
(nth n mylist)	nth element (start from 0)
(car (last mylist))	last element
(cdr mylist)	2nd to last elements
(nthcdr n mylist)	nth to last elements
(butlast mylist n)	without the last n elements

Here's some example of lists and element extraction.

(car (list "a" "b" "c") )   ; =E2=87=92 "a"
(nth 1 (list "a" "b" "c") ) ; =E2=87=92 "b"
(car (last (list "a" "b" "c")) )   ; =E2=87=92 "c"

(cdr (list "a" "b" "c") )   ; =E2=87=92 ("b" "c")

Basic List Functions Function	Purpose
(length mylist)	number of elements
(cons x mylist)	add x to front
(append mylist1 mylist2)	join two lists

Examples:

(length (list "a" "b" "c") ) ; =E2=87=92 3

(cons "a" (list "c" "d") ) ; =E2=87=92 ("a" "c" "d")
(cons (list "a" "b") (list "c" "d") ) ; =E2=87=92 (("a" "b") "c" "d")

(append (list "a" "b") (list "c" "d") ) ; =E2=87=92 ("a" "b" "c" "d")

Functions that modify a list variable Function	Purpose
(pop mylist)	Remove first element from the variable. Returns the
removed element.
(nbutlast mylist n)	Remove last n elements from the variable. Returns
the new value of the variable.
(setcar mylist x)	replaces the first element in mylist with x. Returns
x.
(setcdr mylist x)	replaces the rest of elements in mylist with x.
Returns x.

The weird names =E2=80=9Ccar=E2=80=9D, =E2=80=9Ccdr=E2=80=9D, and =E2=80=9C=
cons=E2=80=9D are like that for historical
reasons.

(info "(elisp) Lists")

=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80
Looping Thru a List

Here's a typical way of going thru a list. It is done with =E2=80=9Cmapcar=
=E2=80=9D.

; add one to each list member
(mapcar (lambda (x) (+ x 1)) (list 1 2 3 4)) ; =E2=87=92 (2 3 4 5)

; add one to each list member using the build in function 1+
(mapcar '1+ (list 1 2 3 4)) ; =E2=87=92 (2 3 4 5)

; take the 1st element of each element in the list
(mapcar 'car  '((1 2) (3 4) (5 6))) ; =E2=87=92 (1 3 5)
(mapcar 'car  '((1 2) (3 4) (5 6))) ; =E2=87=92 (1 3 5)

; take the 2nd element of each element in the ilst
(mapcar (lambda (x) (nth 1 x))  '((1 2) (3 4) (5 6))) ; =E2=87=92 (2 4 6)

; apply a file processing function to a list of files
(mapcar 'my-update-html-footer
        (list
"/home/vicky/web/3d/viz.html"
"/home/vicky/web/3d/viz2.html"
"/home/vicky/web/dinju/Khajuraho.html"
"/home/vicky/web/dinju/Khajuraho2.html"
"/home/vicky/web/dinju/Khajuraho3.html"
        )
)

The =E2=80=9Clambda=E2=80=9D above pretty much means =E2=80=9Csubroutine=E2=
=80=9D. It essentially let
you define a function in the middle of your code. The form is (lambda
arguments body). For example, (lambda (x y) (+ x y)) would be a
function that takes two arguments, x and y, and returns their sum.
Loop thru List with =E2=80=9Cwhile=E2=80=9D

Another common form to loop thru a list is using the =E2=80=9Cwhile=E2=80=
=9D function.
In each iteration, =E2=80=9Cpop=E2=80=9D is used to reduce the list. Here's=
 a example
of going thru a list using the =E2=80=9Cwhile=E2=80=9D function.

(let (mylist)
  (setq mylist '(a b c))
  (while mylist
     (message "%s" (pop mylist))
     (sleep-for 1)
  )
)

Following is another example of using =E2=80=9Cwhile=E2=80=9D to loop thru =
a list.

; pop head of mylist
; prepend it to mylist2
; resulting a reversed list
(let (mylist mylist2)
  (setq mylist '(a b c))
  (setq mylist2 '())
  (while mylist
    (setq mylist2
          (cons (pop mylist) mylist2)
    )
  )
  mylist2
)

First, use =E2=80=9Clet=E2=80=9D to set a code block, with temporary variab=
les
=E2=80=9Cmylist=E2=80=9D and =E2=80=9Cmylist2=E2=80=9D. =E2=80=9Cmylist=E2=
=80=9D is then set to '(a b c). =E2=80=9Cmylist2=E2=80=9D is
set to a empty list. Then, in the body of =E2=80=9Cwhile=E2=80=9D, the (pop=
 mylist)
drops mylist's first element and returns it, the (cons (pop mylist)
mylist2) creates a list with the new element prepended to =E2=80=9Cmylist2=
=E2=80=9D.
(Note: This code is to illustrate going thru a list. If you want to
reverse a list, use the =E2=80=9Creverse=E2=80=9D function.)

=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=
=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=81=E2=94=
=81=E2=94=81=E2=94=81=E2=94=81
List vs Vector

Lisp's =E2=80=9Clist=E2=80=9D and =E2=80=9Cvector=E2=80=9D datatypes are al=
so called =E2=80=9Csequences=E2=80=9D. Many
functions, such as =E2=80=9Celt=E2=80=9D, =E2=80=9Cmapcar=E2=80=9D, work on=
 any sequence type. Here's
their primary differences:

    * vector has constant time access to any element.
    * It takes proportionally longer time to access a long list.
    * list's length can grow by pre-pending with =E2=80=9Ccons=E2=80=9D and=
 is fast.
=E2=80=9Cvector=E2=80=9D's length cannot change.

You can nest list and vectors in any way. Example:

;; arbitrary nested list or vector
[ '(3 4) '(5 8) [4 2]]
(list [8 7] '(4 1))

(info "(elisp) Sequences Arrays Vectors")

 Xah =E2=88=91 http://xahlee.org/
0
Reply Xah 2/21/2011 10:11:27 PM

See related articles to this posting

comp.emacs 4789 articles. 0 followers. Post

0 Replies
622 Views

Similar Articles

[PageSpeed] 14


Reply:

Similar Artilces:

emacs lisp tutorial: list & vectors
Fresh from the oven: =E3=80=88Emacs Lisp Tutorial: List =EF=BC=86 Vector=E3=80=89 http://xahlee.org/emacs/elisp_list_vector.html (for beginner lisper only) plain text version follows. heavy use of unicode. also has html tables. ------------------------------------------------- Emacs Lisp Tutorial: List =EF=BC=86 Vector Xah Lee, 2011-02-21 This page is a practical tutorial of Emacs Lisp's list and vector datatype. If you don't know elisp, first take a look at Emacs Lisp Basics. Lisp has vector and list datatypes. These are similar to other language's list,...

How to Write grep in Emacs Lisp (tutorial)
new little elisp tutorial. =E3=80=88How to Write grep in Emacs Lisp=E3=80=89 http://xahlee.org/emacs/elisp_grep_script.html -------------------------------------------------- How to Write grep in Emacs Lisp Xah Lee, 2011-02-07 This page shows a real-world example of a emacs lisp script that search files, similar to unix grep. If you don't know elisp, first take a look at Emacs Lisp Basics. ---------------------------------------- The Problem Summary I want to write a elisp script that reports all files in a dir that contains a string n times. The script is expect...

emacs tutorial missing in Lisp in a Box
Dear Lispers, I am new to both Lisp and emacs and started studying Peter Seibel's "Practical Common Lisp" book. I've installed Lisp in a Box under Windows. The emacs tutorial file seems to be missing from the distribution (as are the FAQs and info files). Should be in C:\Program files\LispBox\emacs\etc\TUTORIAL, but there is nothing there. Is there a place where I can grab these files (emacs version is GNU Emacs 21.3.1 - i386-mingw-nt5.0.2195) ? The issue has been raised before in this newsgroup but I have found no answer. Thanks, alex Alexandre Irrthum wrote: > Dear ...

tutorial: generating sitemap with emacs lisp
Here's a little tutorial on text processing with emacs lisp. HTML version with syntax coloring and links is at: http://xahlee.org/emacs/make_sitemap.html plain text version follows: ------------------------------------------ Elisp Lesson: Creating Sitemap Xah Lee, 2008-07 This page shows how to use elisp to create a sitemap. If you don't know elisp, first take a look at Emacs Lisp Basics. -------------------------- THE PROBLEM SUMMARY I want to use elisp to create a sitemap. More specifically, generate a list all files of a given directory including its subdirectories, for eac...

emacs lisp tutorial: Count Words and Chars
Emacs Lisp: Count Words, Count Chars, Count Region Xah Lee, 2010-03-23 A little elisp tip. Here's a short elisp i have been using since about 2006. It reports the number of words and chars in a text selection. (defun count-region (beginning end) "Print number of words and chars in region." (interactive "r") (message "Counting ...") (save-excursion (let (wCnt charCnt) (setq wCnt 0) (setq charCnt (- end beginning)) (goto-char beginning) (while (and (< (point) end) (re-search-forward &qu...

Transform HTML Tags with Emacs Lisp (tutorial)
=E3=80=88Transform HTML Tags with Emacs Lisp=E3=80=89 http://xahlee.org/ema= cs/elisp_transform_html_tags.html plain text version follows. -------------------------------------------------- Transform HTML Tags with Emacs Lisp Xah Lee, 2010-08-29 This page is a tutorial, showing a real-world example of using emacs lisp to do many tag transformation. The Problem Summary I need to transform many html tags. Typically, they are of the form =E3=80=8CBeginDelimiter...EndDelimiter=E3=80=8D, where the delimiters may b= e =E2=80=9Ccurly quotes=E2=80=9D, or it may be a html tag such as =E3=80=8C&l...

Emacs Lisp's Library System (tutorial)
=E2=80=A2 Emacs Lisp's Library System http://xahlee.org/emacs/elisp_library_system.html plain text version follows -------------------------------------------------- Emacs Lisp's Library System Xah Lee, 2010-07-13 This page explains emacs library system. For example, what's the difference between library, package, features? And what's the difference between load-file, load, require, autoload? -------------------------------------------------- What's Library, Package, Feature? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D...

little emacs lisp tutorial on turning a url into a link
new little tutorial on emacs lisp =E2=80=A2 =E3=80=88Emacs Lisp: writing a url-linkify=E3=80=89 http://xahlee.org/emacs/elisp_html-linkify.html -------------------------------- Emacs Lisp: writing a url-linkify Xah Lee, 2010-12-03 This page is a little lisp tutorial. A example on writing a function that transform the text under cursor on the fly. If you are not familiar with elisp, see: Emacs Lisp Basics. PROBLEM I need to write a elisp command, so that, when pressing a button, the url under cursor, such as: http://some.example.com/xyz.html becomes this: <a c...

Did Common Lisp introduce sequences as the union of lists and vectors?
Based on brief glance through my Chinual and Interlisp manual it seems that neither of those dialects had functions such as REMOVE and DELETE that worked on both lists and vectors the way Common Lisp's versions do. Was the unification of lists and vectors into the sequence type introduced in Common Lisp? -Peter -- Peter Seibel peter@javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp Peter Seibel <peter@javamonkey.com> writes: > Based on brief glance through my Chinual and Interlisp manual it seems > that neith...

NYC Lisp Conf -- What tutorials will there be? (no listing at site...)
About the tutorials, just what tutorials *will* there be? Nice listing of for last year's, but no link for this year's. Any idea? Thanks! David PS: Also, the schedule shows only the speaker's name -- but no title of the talk (other than being listed in a day-long column named eg "artificial intelligence". Or am I just looking at the wrong page or something? D. David Combs wrote: > About the tutorials, just what tutorials *will* there be? http://www.international-lisp-conference.org/Overview/ILC03-Schedule.html Check the Sunday listings. > > Or a...

Emacs Lisp: HTML Processing: Split Annotation (tutorial)
new article =E3=80=88Emacs Lisp: HTML Processing: Split Annotation=E3=80=89 http://xahlee.org/emacs/elisp_text_processing_split_annotation.html would you like to keep seeing my tutorial posted to comp.lang.lisp and/ or comp.emacs? I haven't been posting every one. Perhaps just occasionally? let me know. plain text version follows ------------------------------------ Emacs Lisp: HTML Processing: Split Annotation Xah Lee, 2011-08-16 This page shows a example of emacs lisp for a text processing HTML. The HTML files are classical novels. The annotation markups need to change from one fo...

Emacs Lisp's print, princ, prin1, format, message (tutorial)
=E2=80=A2 Emacs Lisp's print, princ, prin1, format, message http://xahlee.org/emacs/elisp_printing.html plain text version follows. -------------------------------------------------- This is a short tutorial on printing in emacs lisp. If you don't know elisp, first take a look at Emacs Lisp Basics. Simple Printing with =E2=80=9Cmessage=E2=80=9D The most basic printing function is =E2=80=9Cmessage=E2=80=9D. Here's a exa= mple: ; printing (message "hi") ; printing variable values (message "Her age is: %d " 16) ; %d is for number (message "Her n...

Xah's emacs lisp tutorial: Convert Image Files and Change Size in Dired
Emacs: Convert Image Files and Change Size in Dired http://xahlee.blogspot.com/2011/12/emacs-convert-image-files-and-change.htm= l plain text version follows. =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80 For working on my website, i often need to convert images from any of gif/jpg/png formats, or res...

how is emacs lisp syntax colored in emacs-lisp-mode?
when coding elisp, lately i find myself using camelCase style for my own function and variable names. Because i find that easier to distinguish from built-in function/var/keywords. on thinking about this, i thought it would not be necessary if emacs- lisp-mode would just color all built in functions and variables. However, the way it is syntax colored seems strange, unlike in most major modes for langs where each class of keywords gets one color. for example, these keywords would be colored purple by default: defun, lambda, while, if, progn, save-restriction, ... while the following built...

emacs lisp without emacs?
I have asked before. Is there a way to run emacs lisp, edit a buffer - save a buffer and do some work without opening emacs itself. Kind of a command line script batch thing? bigbinc@hotmail.com (bigbinc) writes: > I have asked before. > > Is there a way to run emacs lisp, edit a buffer - save a buffer and do > some work without opening emacs itself. Kind of a command line script > batch thing? check out the command line arguments for Emacs among others is a -batch this is what you want to use. Regards Friedrich In article <d1b33313.0312290742.17a3e195@posting.google....

Can list container contain an vector object, such as list< vector<string> >??
hi, everybody I am a newbie in STL. When I compile the following program under gcc4.0, I got a the following errors. I wonder whether the form of list< vector<string> > is correct in STL ? // test.cpp #include <iostream> #include <fstream> #include <vector> #include <string> #include <list> using namespace std; typedef vector<string> RECORD; typedef list< RECORD > DataInstances; DataInstances getRecords(const string& filename); void print_data(const DataInstances& d); void print_vector(const vector<string>&am...

Emacs Lisp & Common Lisp
A question: If I try to learn Emacs Lisp while also learning Common Lisp, am I going to damage my understanding of either in some way? "Paul Lange" <plange@gmail.com> writes: > A question: > > If I try to learn Emacs Lisp while also learning Common Lisp, am I > going to damage my understanding of either in some way? Depends whether you can keep them separate in your mind. If you can, observing the differences should be educational. But if not, you'll possibly waste some time discovering the differences the hard way, namely having your programs not work in o...

Are all Emacs Lisp programs derived from Emacs?
Are all Emacs Lisp programs derived from Emacs (in a legal sense), and as such subject to the GPL? Lars Brinkhoff <lars.spam@nocrew.org> writes: > Are all Emacs Lisp programs derived from Emacs (in a legal sense), and > as such subject to the GPL? Maybe two starting points: http://lists.debian.org/debian-legal/2002/debian-legal-200211/msg00217.html http://www.emacswiki.org/cgi-bin/wiki.pl/MissionStatement In article <854qwh99yk.fsf@junk.nocrew.org>, Lars Brinkhoff <lars.spam@nocrew.org> wrote: > Are all Emacs Lisp programs derived from Emacs (in a legal sense...

python list handling and Lisp list handling
This page says that Python lists are often flexible arrays http://www.brpreiss.com/books/opus7/html/page82.html but also says that their representation is implementation dependent. As far as I see this should mean that element access in Python should run in constant time. Now if so this is a boon, because generally 'A list is a sequence of elements, but it is not a single primitive object; it is made of cons cells, one cell per element. Finding the nth element requires looking through n cons cells, so elements farther from the beginning of the list take longer to access. But it is poss...

Controversy of Common Lisp Package in Emacs Lisp
=E3=80=88Controversy of Common Lisp Package in Emacs Lisp=E3=80=89 http://ergoemacs.org/emacs/elisp_common_lisp_in_emacs.html probably of interest to many of you. plain text version follows. --------------------------------------------- [1]Emacs Lisp Tutorial Controversy of Common Lisp Package in Emacs Lisp Xah Lee, 2012-06-13 For you emacs lisp coders, there's controversy in using the cl package (require 'cl). This page is my introduction about the issue, with opinions from emacs developers. First, here's what the official manual (info ...

Scope of COMMON LISP vs. EMACS LISP problem
Why does the following work in emacs lisp but not in common lisp? (let ((A '(AA BB CC)) (B '(car A))) (eval B)) And how would I make it work in common lisp? Thanks for any help on this. On 21/02/2011 18:03, sebs wrote: > Why does the following work in emacs lisp but not in common lisp? > > (let ((A '(AA BB CC)) > (B '(car A))) > (eval B)) > > And how would I make it work in common lisp? > > Thanks for any help on this. Common Lisp is by default lexically scoped, whereas Emacs Lisp is dynamically scoped. E...

define abbrev for emacs-lisp-mode but not other lisp-mode
this is a odd thing. when in emacs-lisp-mode, and when you define a abbrev (e.g. call define-mode-abbrev then =E2=80=9Cah=E2=80=9D then =E2=80=9Cadd-hook=E2=80= =9D), then call write-abbrev- file then you get this in your abbrev file (e.g. at =E3=80=94~/.emacs.d/ abbrev_defs=E3=80=95) (define-abbrev-table 'lisp-mode-abbrev-table '( ("ah" "add-hook" nil 0) )) note that it's lisp-mode-abbrev-table not emacs-lisp-mode-abbrev- table. Why's that? (if you change it to the latter, it won't work.) i'm wondering because i want ...

split vector into 2 vectors according to a list of indices
Hi, Let "Ind" be a vector of indices, and X some other vector. I want to create 2 new vectors: 1. X(Ind) 2. X(rest of indices) Is there an easy way to do this? Thanks, Li. "Li Perry" <lazygoldenpanda@gmail.com> wrote in message <i4bbja$cbn$1@fred.mathworks.com>... > Hi, > > Let "Ind" be a vector of indices, and X some other vector. > I want to create 2 new vectors: > 1. X(Ind) > 2. X(rest of indices) > > Is there an easy way to do this? > > Thanks, > Li. Hi Li, One way: X = randn(10...

sub2ind using a vector of indices (not a list of vectors of indices)
SUB2IND is used to determine the equivalent single index corresponding to a given set of subscript values, e.g.: f(sub2ind(size(f), 2, 5, 6)) Ok. But, in my problem, I dont have a list of subscripts but a vector of them. I would like to do something like: f(sub2ind(size(f), v)), where v = [2, 5, 6] But it's not correct. And I can`t do something like f(sub2ind(size(f), v(1), v(2), v(3))) because I don`t know the length of v. How do I can use my vector of subscript values to find the equivalent single index? Thanks in advance Vilamiu "Raphael Vilamiu" <raphaelvilam...

Allegro lisp setup
Hi, I was trying to configure allegro lisp on xemacs on a windows xp machine. I think I have done most of the setup steps correctly, but there is one place where I am confused and stuck. While starting acl, the code in the file (subproc.el distributed by franze) tries to execute the function associated with the variable fi:start-lisp-interface-arguments But this variable is bound to the name fi::start-lisp-interface But there is no function with the above name defined anyway. So the startup procedure crashes. Below is the code listing for the definition of the variable (defvar fi...