4 map(f, '(if x < 1 then 5 else 2));
5 '(if f(x < 1) then f(5) else f(2))$
7 fullmap(f, '(if x < 1 then 5 else 2));
8 '(if f(x) < f(1) then f(5) else f(2))$
10 /* The user documentation says that matrixmap returns a matrix. So
11 matrixmap(f,[6]) --> [f(6)] is wrong. */
13 errcatch(matrixmap(f, [6]));
28 map(lambda([x],x^2), set(-1,1));
31 errcatch(map(f, false));
41 [f[5](1), f[5](2), f[5](inf)]$
43 errcatch(map(f, 1.5b0));
49 map(lambda([x], x^2), []);
67 map(f,[a],[b],[c,b]), maperror : false;
70 map(lambda([a,b], is(a < b)), [],[]);
73 map(lambda([a,b], is(a < b)), [1],[2]);
76 map(lambda([a,b], is(a < b)), [x],[x+1]);
79 errcatch(map(lambda([a,b], is(a < b)), [x],[x+1],[x+2]));
115 map(f, dpart(a*b*c,1));
116 ''(dpart(f(a) * f(b) * f(c),1,1))$
127 map(f, cfdisrep([1,2,3,4]));
128 f(1) + f(''(cfdisrep([0,2,3,4])))$
130 map('append, [[v]],[[t]]);
133 map('first,[[u,1],[n,2],[k,3]]);
160 fullmap('cos, matrix());
163 fullmap('exp, set());
166 fullmap(f, set(a,b));
169 fullmap(lambda([x],x^2), set(-1,1));
178 fullmap(f[5],[1,2,inf]);
179 [f[5](1), f[5](2), f[5](inf)]$
181 errcatch(fullmap(f, 1.5b0));
187 fullmap(lambda([x], x^2), []);
196 fullmap(f, [[false]]);
202 fullmap(f,[a],[b],[c]);
205 fullmap(f,[a],[b],[c,b]), maperror : false;
208 fullmap(lambda([a,b], is(a < b)), [],[]);
211 fullmap(lambda([a,b], is(a < b)), [1],[2]);
214 fullmap(lambda([a,b], is(a < b)), [x],[x+1]);
217 errcatch(fullmap(lambda([a,b], is(a < b)), [x],[x+1],[x+2]));
220 fullmap("=",[a,b],[1,2]);
223 fullmap("#",[a,b],[1,2]);
232 fullmap(f,a-b), inflag : true$
235 fullmap(f,a-b), inflag : false$
238 fullmap(f, rat(a+b));
256 fullmap(f, dpart(a*b*c,1));
257 ''(dpart(f(a) * f(b) * f(c),1))$
259 errcatch(fullmap(f,1));
271 fullmap(f,a.b + b . a);
272 f(a) . f(b) + f(b) . f(a)$
277 fullmap(f, a. (b .c ));
278 f(a) . (f(b) . f(c))$
280 fullmap(f, a^^(b^^c));
283 matrixmap(f,matrix());
286 matrixmap(f, matrix([]));
289 matrixmap(f, matrix([],[]));
292 matrixmap(f, matrix([5]));
295 matrixmap('cosh, matrix([a,b],[c,d]));
296 matrix([cosh(a), cosh(b)],[cosh(c), cosh(d)])$
298 matrixmap(lambda([x], x * ident(2)), matrix([1,2],[3,4]));
299 matrix([matrix([1,0],[0,1]),matrix([2,0],[0,2])],[matrix([3,0],[0,3]),matrix([4,0],[0,4])])$
301 /* SF bug 3241: f()(...) not same as "foo"(...) when f returns "foo" */
306 /* other examples related to #3241 */
314 map (fooval, [a, b, c]);
315 [foo a, foo b, foo c];
317 map (foofun(), [a, b, c]);
318 [foo a, foo b, foo c];
323 apply (foofun(), [a]);
326 funmake (fooval, [a]);
329 funmake (foofun(), [a]);
338 (kill (bar, baralias),
339 alias (baralias, bar),
345 map (barval, [a, b, c]);
346 [baralias(a), baralias(b), baralias(c)];
348 map (barfun(), [a, b, c]);
349 [baralias(a), baralias(b), baralias(c)];
354 apply (barfun(), [a]);
357 funmake (barval, [a]);
360 funmake (barfun(), [a]);
369 /* bug reported to mailing list 2018-07-22: "mapatom(-4)" */
371 (kill (x), map (mapatom, [-1, 1/2, -1/2, -1.0, -1b0, 1, 1.0, 1b0, x[1]]));
372 [true, true, true, true, true, true, true, true, true];
374 (kill (f), errcatch (map (f, -1)));
377 errcatch (map (f, 1/2));
380 errcatch (map (f, -1/2));
383 errcatch (map (f, -1.0));
386 errcatch (map (f, -1b0));
389 errcatch (map (f, 1));
392 errcatch (map (f, 1.0));
395 errcatch (map (f, 1b0));
398 errcatch (map (f, x[1]));
401 (kill (a, b), map (mapatom, [-a, a/b, -a/b, x(1)]));
402 [false, false, false, false];
416 /* Previously some atoms were not considered to be mapatoms.
417 * Mailing list 2020-06-05: "Non-mapatomic atoms"
421 a : make_array (fixnum, 1),
428 errcatch (map (f, a));
434 /* Structure references are mapatoms.
435 * Mailing list 2020-06-05: "Non-mapatomic atoms"
444 errcatch (map (f, s@x));
450 errcatch (map (f, '(s@x)));