All commands, alphabetic order; letter P

This page contains the description of the following commands packagecell, parallel_seq, parse_s2p, partial_ifactor, path, pathname, pathname-name, path-to-list, permutations, pgcd, phase, plist, plot_data_disc, poly_to_line, power, power-of-two, powermod, pratom, prevprime, prin, princn, print, prin1, print1, print-for-read, print-for-fast-read, printlength, printlevel, printline, print-to-string, print-to-vector, prin-rational, print-xml, probefile, probepathf, probepathm, probepatho, prog1, progn, prompt, protect, putprop,


(packagecell x) (Lisp function)

The packagecell function returns the packagecell of its argument.

[Endymion] (packagecell ())
()
[Endymion] (packagecell 'foo)
()
[Endymion] (packagecell '#:foo:bar:gee)
#:foo:bar
[Endymion] (packagecell "#:foo:bar:gee")
packagecell : not a symbol : #:foo:bar:gee

parallel_seq(s1, ..., sn) (Symbolic function)

Given sequences si, with general term sik, this return the sequence with as general term the list of the sik. If no argument is given, this returns the empty sequence. The length of the sequence is minimum of the lengths of the intial sequences.

(1) A:=parallel_seq();

(1)                <UninitializedSequence: PAR, <vector>>

(2) endofseq(makeseq(A));

(2)                                  TRUE

(4) seq_to_list(makeseq(parallel_seq(1...10 step 2)));

(4)                       [[1], [3], [5], [7], [9]]

(5) seq_to_list(makeseq(parallel_seq(1...10 step 2, 1...Infinity)));

(5)                [[1, 1], [3, 2], [5, 3], [7, 4], [9, 5]]

(7) seq_to_list(makeseq(parallel_seq(1...10 step 2, 1...Infinity,
(7) permutations([a,b,c,d,e]))));

(7)  [[1, 1, [a, b, c, d, e]], [3, 2, [a, b, c, e, d]], [5, 3, [a, b, d, c, e

]], [7, 4, [a, b, e, c, d]], [9, 5, [a, b, d, e, c]]]

(9)  B:=parallel_seq([a,b,c,d], N2_seq());

(9)  <UninitializedSequence: PAR, <vector: <UninitializedSequence: list, 

[a, b, c, d]>, <UninitializedSequence: N2>>>

(10)  makeseq(B);

(10)  <InitializedSequence: PAR, <vector: <InitializedSequence: list, 

[a, b, c, d]>, <InitializedSequence: N2, 0>>>

(11) parallel_seq(foo);
parallel_seq : not a sequence : foo

parse_s2p(f, p, sw) (Symbolic function)

This function reads a data file, formed of a header, and sequence of (2p+1)N real numbers, and returns a vector with p PW functions. The function is similar to read_data, that reads a file with p=1, and returns a PW function instead of a vector of PW functions. Consider a file with the following content:

!TITRE:filtre3s
!                      
!NOMBRES DE POINTS   :801
!DATA S[1,1] RI
!DATA S[2,1] RI
!DATA S[1,2] RI
!DATA S[2,2] RI
# GHZ  S  RI  R  50

1 1.2 1.3 2.2 2.3 3.2 3.3 4.2 4.3 
2 21.2 21.3 22.2 22.3 23.2 23.3 24.2 24.3 
3 31.2 31.3 32.2 32.3 33.2 33.3 34.2 34.3 

The header is formed by lines that start with an exclamation point (ignored) and lines that start with with a sharp sign (containing keywords). After that we have (2p+1)N real numbers. Between the numbers, we can have spaces or commas (additional junk is silently removed). There are two keywords, the first can be HZ, GHZ or MHZ, indicating the frequency unit (output is MHZ, so that HZ says divide by 10e6 and GHZ multiply by 1000). The second keyword indicates that type of the data: if RI, then the file contain the real part and the imaginary part of the data; if MA the file contain the module r and angle theta (in degrees), and DB says that the file contains d and theta, where d=20*log10(r). In the example above, we have p=4, each Sij is flagged RI: these flags are ignored; only the global flag RI is considered.

If the function is called with three arguments f, q, s, the last one is ignored, and a square matrix of size p=q*q is read from the file with extension s2p, s3p etc. In the example that follows the first line is equivalent to the second.

(1) /* parse_s2p("ex_data",2,true); */
(1) parse_s2p("ex_data.s2p",4);

(1)  <vector: <pw function: 1000 = 1.2 + 1.3 %i, 2000 = 21.2 + 21.3 %i, 

3000 = 31.2 + 31.3 %i>, <pw function: 1000 = 2.2 + 2.3 %i, 2000 = 

22.2 + 22.3 %i, 3000 = 32.2 + 32.3 %i>, <pw function: 1000 = 3.2 + 3.3 %i, 

2000 = 23.2 + 23.3 %i, 3000 = 33.2 + 33.3 %i>, <pw function: 

1000 = 4.2 + 4.3 %i, 2000 = 24.2 + 24.3 %i, 3000 = 34.2 + 34.3 %i>>

(partial_ifactor n) (Lisp function)

The partial_ifactor function finds some factors of a number. For details and examples, see ifactor.

#:system:path (Lisp variable)

The #:system:path contains the list of pathnames used by functions such as probepathf. The default value may depend on compilation options, etc. From this variables, three others are deduced #:system:llib-directory, #:system:llmod-directory, and #:system:llobj-directory. Initially these four variables have the same value.

[Endymion] #:system:path
(./ /user/grimm/home/cvs/endymion/lisp/)
[Endymion] #:system:llib-directory
(./ /user/grimm/home/cvs/endymion/lisp/)
[Endymion] #:system:llmod-directory
(./ /user/grimm/home/cvs/endymion/lisp/)
[Endymion] #:system:llobj-directory
(./ /user/grimm/home/cvs/endymion/lisp/)

(pathname x) (Lisp function)

The pathname command converts its argument into a pathname. This is an object with three fields: DIR, FN and EXT. Such an object can be used by pathname-name, that returns FN, directory-namestring that returns DIR, file-namestring, that returns the concatenation of FN and EXT, namestring, that returns the concatenation of DIR, FN and EXT, path-to-list, that returns the list of DIR, FN and EXT, and split-path, that returns also the list of DIR, FN and EXT. This last function calls expand-path.

The algorithm is the following: if the name contains no slash, then DIR is void (represented by nil), otherwise, DIR is everything before the final slash. Consider what remains after removing the DIR. If there is no dot, then FN is the string, EXT is void (represented by nil). Otherwise FN is everything before the final dot, and EXT everything after the final dot.

[Endymion] (setq x (pathname 'a/b/c/d.e.f.g))
a/b/c/d.e.f.g
[Endymion] (type-of x)
pathname
[Endymion] (namestring x)
a/b/c/d.e.f.g
[Endymion] (type-of (namestring x))
string
[Endymion] (directory-namestring x)
a/b/c
[Endymion] (pathname-name x)
d.e.f
[Endymion] (file-namestring x)
d.e.f.g
[Endymion] (path-to-list x)
(a/b/c d.e.f g)
[Endymion] (split-path x)
(a/b/c d.e.f g)
[Endymion] (split-path "$HOME")
(/user/grimm home ())
[Endymion] (setq x (pathname 'a/b/c/))
a/b/c/
[Endymion] (path-to-list x)
(a/b/c  ())
[Endymion] (setq x (pathname 'a/b/c/.foo))
a/b/c/.foo
[Endymion] (path-to-list x)
(a/b/c  foo)
[Endymion] (setq x (pathname 'foo.bar.gee))
foo.bar.gee
[Endymion] (path-to-list x)
(() foo.bar gee)
[Endymion] (setq x (pathname 'foo.bar.gee.))
foo.bar.gee.
[Endymion] (path-to-list x)
(() foo.bar.gee )
[Endymion] (directory-namestring "foo")
()
[Endymion] (directory-namestring "/foo")

[Endymion] (directory-namestring "foo/")
foo
[Endymion] (directory-namestring "foo/bar")
foo
[Endymion] (directory-namestring "foo/bar/")
foo/bar
[Endymion] (directory-namestring "f.o.o/b.a.r")
f.o.o
[Endymion] (file-namestring "foo/bar.gee")
bar.gee
[Endymion] (namestring "foo/bar.gee")
foo/bar.gee
[Endymion] (file-namestring "foo/bar.gee")
bar.gee
[Endymion] (pathname-name "foo/bar.gee")
bar
[Endymion] (file-namestring "a.b.c")
a.b.c
[Endymion] (pathname-name "a.b.c")
a.b
[Endymion] (file-namestring "x/a.b.c")
a.b.c
[Endymion] (pathname-name "x/a.b.c")
a.b

(pathname-name x) (Lisp function)

The pathname-name function takes as argument a pathname (either an object of type pathname, or something that can be converted to a pathname, for instance a string or a symbol), like "foo/bar.gee" and returns the name part (here `bar'). See pathname for examples.

(path-to-list x) (Lisp function)

The path-to-list function takes as argument a pathname (either an object of type pathname, or something that can be converted to a pathname, for instance a string or a symbol), like "foo/bar.gee" and returns the three parts as a list (here foo, bar, gee). See pathname for examples.

(permutations list) (Symbolic function)

The function creates a sequence formed of all permutations of the list; if the list is empty, or has a single element, the sequence has only one element; if the list hs two elements, there are two permutations: the list and its reverse. Otherwise, if a is the first element of the list and b is the remaining, we consider all permutations of b and insert a anywhere in the list.

(1) seq_to_list(makeseq(permutations([a,b,c,d])));

(1)  [[a, b, c, d], [a, b, d, c], [a, c, b, d], [a, d, b, c], [a, c, d, b], 

[a, d, c, b], [b, a, c, d], [b, a, d, c], [c, a, b, d], [d, a, b, c], 

[c, a, d, b], [d, a, c, b], [b, c, a, d], [b, d, a, c], [c, b, a, d], 

[d, b, a, c], [c, d, a, b], [d, c, a, b], [b, c, d, a], [b, d, c, a], 

[c, b, d, a], [d, b, c, a], [c, d, b, a], [d, c, b, a]]

(2) seq_len(y):=let([a=0,x=makeseq(y)],
(2) while not(endofseq(x)) do { a++,  popseq(x)}, a)?;

(3) timing(seq_len(permutations([a,b,c,d,e])));
Time 0.01s. 

(3)                                 120

(4) timing(seq_len(permutations([a,b,c,d,e,f])));
Time 0.06s. 

(4)                                 720

(5) timing(seq_len(permutations([a,b,c,d,e,f,G])));
Time 0.40s. 

(5)                                 5040

(6) timing(seq_len(permutations([a,b,c,d,e,f,g,h])));
Time 3.28s. 

(21)                                40320

(22) timing(seq_len(permutations([a,b,c,d,e,f,g,h,i])));
Time 30.69s. 

(22)                                362880

(plist x) (Lisp function)

The plist function returns a copy of the property list of its argument, that must be a symbol.

[Endymion] (putprop 'a 'b 'c)
b
[Endymion] (putprop 'a 'bb 'cc)
bb
[Endymion] (plist 'a)
(cc bb c b)
[Endymion] (eq (plist 'a) (plist 'a))
()
[Endymion] (plist 33)
plist : not a symbol : 33

plot_data_disc(F, s) (Symbolic function)

This function takes two arguments, a file name F, and an integer S. The integer S is to be thought as a sequence of bits, a, b and c; S=1 means a true, S=2 means b true, S=4 means c true, S=7 means a,b,c all true, S=0 means all false. The file f is read by the read_fourier function (that considers S modulo 4). If a is true the Fourier series f is real, otherwise it is complex. If b is false, we assume that f is analytic in the disc, f=a0+a1*z+a2*z^2, etc. If b is true, f=conj(a0*z+a1*z^2+a2*z^3), said otherwise, the first coefficient is zero, and the conjugate of the coefficients found in the file are taken.

Two files, foo_dd and foo_dn are created, containing Bode and Nyquist representation of the data. They will be plotted by gnuplot. If the switch c is true, two postscript files foo_dd.ps and foo_dn.ps are created, they contain what gnuplot shows on the screen.

popseq(x) (Symbolic function)

The function is defined as: if endofseq(x) is true, then the function returns false; otherwise it calls topseq(x), this gives some value, the return value of the function; after that discard_seq is called. See makeseq for examples.

(poly_to_line p) (Lisp function)

This function takes as argument a polynomial P; it replaces the variable z by (w+1)/(w-1), then multiplies everything by (w-1)^n, where n is the degree of P. This gives a polynomial of the same degree (unless P vanishes at z=1). If P is a complex polynomial, coefficients are replaced by their conjugates. If P not not a double precision polynomial, or of degree greater than 100, the function returns nil, or signals an error.

[Endymion] (poly_to_line #PD 2 1 0 100)
#PD_s 101 + 198*z + 101*z^2;
[Endymion] (poly_to_line #PC_s 100*z^2 +I;)
#PC_s (100-1*I) + (200+2*I)*z + (100-1*I)*z^2;
[Endymion] (poly_to_line #PD 3 0 1 0 0)
#PD_s 1-1*z-1*z^2 + 1*z^3;
`

power(x, y) (Symbolic function)

There is no difference between power(a,b) and a**b (which is the same as a^b). See ^.

(power-of-two n) (Lisp function)

This computes power(2,n) in an efficient way.

(powermod x y z) (Lisp function)

This computes x power y modulo z. Arguments y and z must be integers. Argument x must be a rational number. If it is a/b, then b must be invertible mod z, and x is first converted to an integer. If y negative x must be invertible modulo z.

[Endymion] (powermod 2 10 100)
24
[Endymion] (powermod 2 100000 100)
76
[Endymion] (powermod 1/3 2 100)
89
[Endymion] (powermod 3 -2 100)
89
[Endymion] (powermod 2 10 1/2)
powermod : not a fixnum : 1/2
[Endymion] (powermod 2 10 -12)
powermod : argument out of bounds : -12
[Endymion] (powermod 2 1/2 100)
powermod : not a fixnum : 1/2
[Endymion] (powermod 1/3 2 99)
modp : division by zero : 1/3
[Endymion] (powermod 3 -2 99)
modp : division by zero : 1/3

(pratom n) (Lisp function)

This function prints an object. It should be used inside functions like print, because it does not establish a handler for the case where arguments are too big; for instance (repeat N (pratom 0)) will signal an error (undefined escape: prin) if N is geater than printlength. If you print an object X, of type T, and if the fonction #:A:B:prin is defined, and takes one argument, and T is a subtype of the package, then the vector is printed by calling the function with X as argument (In the example below, the package is foo and the type is #:foo:bar). Otherwise, the vector is printed as usual. This mechanism is not used if the vector is printed via pratom. In the example below, the function uses pratom for printing the vector, no recursion involved.

[Endymion] (defun #:foo:prin(x)
[Endymion]   (if (eq (vlength x) 0)
[Endymion]       (prin "Empty vector of type foo")
[Endymion]     (pratom x)))
#:foo:prin
[Endymion] '(x #:foo:#[] #:foo:bar:#[1 2])
(x Empty vector of type foo #:foo:bar:#[1 2])

(prevprime n) (Lisp function)

The prevprime function returns the greatest prime number smaller than its argument. For an example, see nextprime

(print-banner x) (Lisp function)

The (print-banner "xx") command prints two lines (see example below) using the argument as prefix; the function returns the argument.

[Endymion]  (prog1 () (print-banner ";;;"))
;;; This file automatically generated by Endymion
;;; version 0.21 (medee), Tue Jun  5 12:01:04 2007
()

(prin x1 ... xn) (Lisp function)

The function prints the arguments, and returns the last one. The function establishes a handler for the case where arguments are too big (more than printlength tokens or printline lines needed).

(print x1 ... xn) (Lisp function)

The function behaves like prin, but a new line character is printed after the object, via a call to ITsoft eol.

(prin1 x1) (Lisp function)

The function behaves like prin, but takes a single argument.

(print1 x1) (Lisp function)

The function behaves like print, but takes a single argument.

(prinflush x1) (Lisp function)

The function behaves like prin1, but flushes the buffer after printing via a call to the ITsoft flush. If you say (repeat 1000 (prinflush 'a)), you will see one thousand characters a in a row. If you use prin or prin1 instead of prinflush, a newline character will be printed every N characters (where N is the value of the right margin).

(princn c n) (Lisp function)

The command (princn c n) prints n occurences of the character c and returns it. If n is not an integer, or is omitted, then one occurence of c is printed. If c is not an integer between 1 and 255, nothing is printed.

#:system:print-for-read (Lisp variable/function)

#:system:print-for-fast-read (Lisp variable/function)

If the variable print-for-read is true, then objects are printed in such a way as they can be read again. In the case of big integers, the variable print-for-fast-read is also looked at; if true (the default) the internal representation is used; reading and printing is faster (for instance, in the case factorial 10000, the times for write and read goes from 2.38s to 0.11s); if false, numbers are printed using the #10R123 notation, and a backslash is used to tell the reader that the number continues on the next line.

[Endymion] (let ((#:system:print-for-read true))
[Endymion] (print '(foo "foo" foo\ bar "foo\"bar")))
(foo "foo" foo\ bar "foo\"bar")
(foo foo foo bar foo"bar)
[Endymion] (let ((#:system:print-for-read true))
[Endymion] (print '(#C(1 2) #.(fact 100))))
(#C(1 2) #10R/2 #:r:z:#[true #<00001b30964ec395dc24069528d54bbda40d16e9
66ef9a70eb21b5b2943a321cdf10391745570cca9420c6ecb3b72ed2ee8b02ea2735c61a
000000000000000000000000>])
([2i+1] 9332621544394415268169923885626670049071596826438162146859296389521759
999322991560894146397615651828625369792082722375825118521091686400000000000000
0000000000)
[Endymion] (setq print-for-fast-read false)
()
[Endymion] (let ((#:system:print-for-read true))
[Endymion] (print (fact 100)) (print (1/ (fact 100))) 0)
#10R9332621544394415268169923885626670049071596826438162146859296389521759999\
32299156089414639761565182862536979208272237582511852109168640000000000000000\
00000000
#10R1/93326215443944152681699238856266700490715968264381621468592963895217599\
99322991560894146397615651828625369792082722375825118521091686400000000000000\
0000000000
0

printlength (Lisp variable/function)

The variable printlength, an integer between 0 and 106, initially 1000, holds the maximum number of tokens printed before the printer aborts via (exit prin 'prin). In the example below, we consider a list that has itself as single element. Printing this object consists in printing an open parenthesis, the object, and a closing parenthesis. Each parenthesis is a token.

[Endymion] (let ((printlength 10)) (print '#3=(1 . #3#) 2))
(1 1 1 1 1 1 1 1 1 ...
2
[Endymion] (let ((printlength 10)) (print '#3=(#3# ) 2))
((((((((((...
2
[Endymion] (let ((printlevel 11)) (print '#3=(#3# x) 2))
(((((((((((& x) x) x) x) x) x) x) x) x) x) x)2
2
[Endymion]  (let ((printline 3)) (print '#3=(#3# #.(** 10 40)) 2))
((((((((((& 10000000000000000000000000000000000000000) 10000000000000000000000
000000000000000000) 10000000000000000000000000000000000000000) 100000000000000
00000000000000000000000000) 10000000000000000000000000000000000000000) 1000...
2

printlevel (Lisp variable/function)

The variable printlevel, an integer between 0 and 106, initially 10, holds the maximum depth for printing of lists. If this level is reached, an ampersand character is printed instead. See example above under printlength.

printline (Lisp variable/function)

The variable printline, an integer between 0 and 106, initially 100, holds the maximum number of lines printed before the printer aborts via (exit prin 'prin). See example above under printlength.

(print-to-string x) (Lisp function)

The three functions print-to-string, print-to-vector and explode print their argument in a string. In the case of explode, the string is converted into a list of character codes; in the case of print-to-vector, the string is converted into a vector of character codes.

[Endymion] (setq x #[1/2 "José" 2.3])
#[1/2 José 2.3]
[Endymion] (list (print-to-string x) (print-to-vector x) (explode x))
(#[1/2 José 2.3] #:string:#[35 91 49 47 50 32 74 111 115 233 32 50 46 51 93] (
35 91 49 47 50 32 74 111 115 233 32 50 46 51 93))

(print-to-vector x) (Lisp function)

This function behaves like print-to-string but instead of producing a string of character, it returns a vector of character codes.

(prin-rational x T p) (Lisp function)

This function sometimes prints x, and sometimes returns a value, depending on T. In the first case argument p is ignored. Otheerwise, it should be a small integer. In case 2, it should be positive, otherwise it can be negative.

[Endymion] (setq y (+ 52 45/100 6667/999900))
26225711/499950
[Endymion] (prin-rational y 'float 12)
0.524566676668e2
[Endymion] (prin-rational y 'float 13)
0.5245666766677e2
[Endymion] (prog1 "!" (prin-rational y 'float0 1))
52.4...!
[Endymion] (prog1 "!" (prin-rational y 'float0 4))
52.45{66...}!
[Endymion] (prog1 "!" (prin-rational y 'float1 4))
52.4566!
[Endymion] (prog1 "!" (prin-rational y 'float0 14))
52.45{6667}!
[Endymion] (prog1 "!" (prin-rational y 'float1 14))
52.45666766676667!
[Endymion] (setq x (cf-to-rational '(12 13 14 15)))
33307/2758
[Endymion] (prin-rational x true 0)
33307/275833307/2758
[Endymion] (prog1 "!" (prin-rational x true 0))
33307/2758!
[Endymion] (prin-rational x 'cf1 -2)
(12 2758/211)
[Endymion] (prin-rational x 'cf1 -3)
(12 13 211/15)
[Endymion] (prin-rational x 'cf1 -4)
(12 13 14 15)
[Endymion] (prin-rational x 'cf0 -30)
(1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 2125/211)
[Endymion] (prog1 "!" (prin-rational x 'cf0 50))
/10101010101010101010101101010101010101010101010110 196/15/!
[Endymion] (prin-rational (/(fib 20)(fib 21)) 'cf-1 -1)
(1 -3 3 -3 3 -3 3 -3 3 -2 -2)
[Endymion] (prin-rational (/(fib 20)(fib 21)) 'cf1 -1)
(0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2)

(print-xml n) (Lisp function)

The function prints the argument as XML. The object can contain references to itself.

[Endymion] (progn (print-xml 10)(print-xml 11.) )
<int>10</int><double>11</double>()
[Endymion] (progn (print-xml ())(print-xml 'foo) (print-xml '#:foo:bar)
[Endymion] (print-xml '#:foo:bar:gee)(print-xml "foo")(print-xml #"foo"))
<nil/><symbol pname="foo"/><symbol pname="bar" package="foo"/><symbol pname=
"gee"><symbol pname="bar" package="foo"/></symbol><string>foo</string><string 
type="wide-string">foo</string>()
[Endymion] (print-xml '(a (b . c)))
<list><symbol pname="a"/> <cons><symbol pname="b"/> <symbol pname="c"/></cons>
</list>()
[Endymion] (progn (print-xml #[1 2 3])(print-xml #:foo:#[1]))
<vector><int>1</int> <int>2</int> <int>3</int></vector><vector type="foo">
<int>1</int></vector>()
[Endymion] (print-xml '#3=(4 . #3#))
<mcons id='uid1'><int>4</int> <shared ref='uid1'></mcons>()

(probefile f m) (Lisp function)

The probefile function takes one or two arguments. The default value of the second argument is zero. If the second argument is an integer, but neither zero nor one, it will be replaced by two. If the second argument is not an integer, it will be replaced by zero. The function returns 1 if no channels are available, 0 if OK, and 2 if not OK. If m is zero, OK means that the file can be opened for reading. If m is one OK means that the file can be opened for writing (as a side effect this creates the file, unless it exists already). If m is two, OK means that the file does not exists, but can be created for writing (as a side effect this creates the file).

[Endymion] (probefile "Test0" 1)
0
[Endymion] !ls -al Test0
-rw-r--r--   1 grimm    apics           0 Apr 14 16:37 Test0
true
[Endymion] (probefile "Test0" 2)
2
[Endymion] (probefile "Test1" 2)
0
[Endymion] (probefile "/Test1" 2)
2
[Endymion] (probefile "Test1")
0
[Endymion] !chmod 0 Test1
true
[Endymion] (probefile "Test1")
2
[Endymion] (probefile 12)
probefile : non string argument : 12

(probepathf f) (Lisp function)

The function probepathf takes one argument. It tries to find a file by calling search-in-path with three arguments: the value of #:system:llib-directory, the argument, and the extension .ll.

(probepathm f) (Lisp function)

The function probepathm takes one argument. It tries to find a file by calling search-in-path with three arguments: the value of #:system:llmod-directory, the argument, and the extension .lm.

(probepatho f) (Lisp function)

The function probepatho takes one argument. It tries to find a file by calling search-in-path with three arguments: the value of #:system:llobj-directory, the argument, and the extension .lo.

(prog1 e1 e2 ... en) (Lisp special form)

The prog1 special form takes any number of arguments. It evaluates them one after the other and returns the value of the first evaluation. If no argument is given, the value is nil.

[Endymion] (prog1)
()
[Endymion] (prog1 1)
1
[Endymion] (prog1 1 2 3)
1
[Endymion] (setq x '(A B C))
(A B C)
[Endymion] (prog1 (car x) (setq x (cdr x)))
A
[Endymion] x
(B C)

(progn e1 e2 ... en) (Lisp special form)

The progn special form takes any number of arguments. It evaluates them one after the other and returns the value of the last evaluation. If no argument is given, the value is nil.

[Endymion] (progn)
()
[Endymion] (progn 1)
1
[Endymion] (progn 1 3 4 5 6 6 7 8 9 10)
10
[Endymion] (progn (print 1) (print 2) (print 3) (etc))
1
2
3
eval : undefined function : etc

prompt (variable function)

The prompt holds the character string that Endymion prints when it reads a line on the terminal. If you say (setq prompt 12) nothing happens because the argument is neither a string nor a symbol.

[Endymion] (let ((prompt "??? "))(print(read)))
??? abc
abc
abc

(protect e1 e2 ... en) (Lisp special form)

The protect special form takes at least two arguments. They are evaluated in order. The result is the value of the first argument. However, a handler is established so that, in the case where the stack is unwound while evaluating the first argument (case of error for instance), remaining arguments are still evaluated. Evaluation of these arguments should not provoke an error. See also exit return-from go, which are the commands that can unwind the stack.

[Endymion] (defun p (x) (print "Protect: " x))
p
[Endymion] (protect (car '(0)) (p 1) (p 2))
Protect: 1
Protect: 2
0
[Endymion] (protect (car 0) (p 1) (p 2))
car : not a list : 0
Protect: 1
Protect: 2
[Endymion] (tag a (protect (exit a 0) (p 1) (p 2)))
Protect: 1
Protect: 2
0
[Endymion] (block a (protect (return-from a 0) (p 1) (p 2)))
Protect: 1
Protect: 2
0
[Endymion] (tagbody  (protect (go a) (p 1) (p 2)) a)
Protect: 1
Protect: 2
()

(putprop sym val key) (Lisp special form)

There are five functions that give access to the property list of a symbol, they are plist, putprop, addprop, remprop and getprop. The function get is an alias for getprop. The plist function returns a copy of the PLIST; this is a list of the form (key1, val1, key2, val2), etc. The getprop function takes two argument, a symbol name and a key; it returns the value associated to the key. It uses eq as predicate (in general, keys are symbols, so that this is irrelevant). The remprop function takes two arguments, a symbol and a key. It removes the property; the return value is nil if the property did not exist, the new plist otherwise. The addprop function takes three arguments, symbol, value and key. It adds a new pair in front of the plist. It returns the value. Finaly, putprop behaves like addprop, except that, if the key already exists, the old value of the first occurence is discarded.

[Endymion] (plist 'foo)
()
[Endymion] (putprop 'foo 'a1 'b1)
a1
[Endymion] (putprop 'foo 'a2 'b2)
a2
[Endymion] (putprop 'foo 'a3 'b3) 
a3
[Endymion] (remprop 'foo 'b4)
()
[Endymion] (remprop 'foo 'b3)
(b2 a2 b1 a1)
[Endymion] (putprop 'foo 'a3 'b2)
a3
[Endymion] (plist 'foo)
(b2 a3 b1 a1)
[Endymion] (addprop 'foo 'a3 'b3)
a3
[Endymion] (addprop 'foo 'a4 'b3)
a4
[Endymion] (addprop 'foo 'a5 'b3)
a5
[Endymion] (plist 'foo)
(b3 a5 b3 a4 b3 a3 b2 a3 b1 a1)
[Endymion] (remprop 'foo 'b3)
(b3 a4 b3 a3 b2 a3 b1 a1)
[Endymion] (addprop 'foo 'a5 '"b3")
a5
[Endymion] (getprop 'foo 'b3)
a4
[Endymion] (getprop 'foo 'b2)
a3
[Endymion] (getprop 'foo "b3")
()
[Endymion] (remprop 'foo "b3")
()
[Endymion] (setq x (car (plist 'foo)))
b3
[Endymion] (getprop 'foo x)
a5
[Endymion] (remprop 'foo x)
(b3 a4 b3 a3 b2 a3 b1 a1)

Valid XHTML 1.0 Strict back to home page © INRIA 2005, 2006 Last modified $Date: 2009/01/08 17:43:30 $