📄 refm.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>M</title><link rel="stylesheet" href="doc.css" type="text/css"></head><body><h1>M</h1><dl><dt><a name="*Msg"><code>*Msg</code></a><dd>A global variable holding the last recently issued error message. See also<code><a href="ref.html#errors">Error Handling</a></code>, <code><ahref="refE.html#*Err">*Err</a></code> and <code><ahref="refR.html#*Rst">*Rst</a></code>.<p><pre><code>: (+ 'A 2)!? (+ 'A 2)A -- Number expected?:: *Msg-> "Number expected"</code></pre><dt><a name="macro"><code>(macro prg) -> any</code></a><dd>Substitues all <code><a href="refP.html#pat?">pat?</a></code> symbols in<code>prg</code> (using <code><a href="refF.html#fill">fill</a></code>), andexecutes the result with <code><a href="refR.html#run">run</a></code>. Usedoccasionally to call functions which otherwise do not evaluate their arguments.<p><pre><code>: (de timerMessage (@N . @Prg) (setq @N (- @N)) (macro (task @N 0 . @Prg) ) )-> timerMessage: (timerMessage 6000 (println 'Timer 6000))-> (-6000 0 (println 'Timer 6000)): (timerMessage 12000 (println 'Timer 12000))-> (-12000 0 (println 'Timer 12000)): (more *Run)(-12000 2616 (println 'Timer 12000))(-6000 2100 (println 'Timer 6000))-> NIL: Timer 6000Timer 12000...</code></pre><dt><a name="made"><code>(made ['lst1 ['lst2]]) -> lst</code></a><dd>Initializes a new list value for the current <code><ahref="refM.html#make">make</a></code> environment. All list elements alreadyproduced with <code><a href="refC.html#chain">chain</a></code> and <code><ahref="refL.html#link">link</a></code> are discarded, and <code>lst1</code> isused instead. Optionally, <code>lst2</code> can be specified as the new linkagecell, otherwise the last cell of <code>lst1</code> is used. When called withoutarguments, <code>made</code> does not modify the environment. In any case, thecurrent list is returned.<p><pre><code>: (make (link 'a 'b 'c) # Link three items (println (made)) # Print current list (a b c) (made (1 2 3)) # Discard it, start new with (1 2 3) (link 4) ) # Link 4(a b c)-> (1 2 3 4)</code></pre><dt><a name="mail"><code>(mail 'any 'cnt 'sym1 'sym2 'sym3 'lst . prg)'</code></a><dd>Sends an eMail via SMTP to a mail server at host <code>any</code>, port<code>cnt</code>. <code>sym1</code> should be the "from" address,<code>sym2</code> the "to" address, and <code>sym3</code> the recipient'saddress. <code>lst</code> is a list of attachments, each one specified by threeelements for path, name and mime type. <code>prg</code> generates the mail bodywith <code><a href="refP.html#prEval">prEval</a></code>. See also <code><ahref="refC.html#connect">connect</a></code>.<p><pre><code>(mail "localhost" 25 # Local mail server "a@bc.de" # "From" address "abu@software-lab.de" # "To" address "Testmail" # Subject (quote "img/go.png" "go.png" "image/png" # First attachment "img/7fach.gif" "7fach.gif" "image/gif" ) # Second attachment "Hello," # First line NIL # (empty line) (prinl (pack "This is mail #" (+ 3 4))) ) # Third line</code></pre><dt><a name="make"><code>(make .. [(made 'lst ..)] .. [(link 'any ..)] ..) -> any</code></a><dd>Initializes and executes a list-building process with the <code><ahref="refM.html#made">made</a></code>, <code><ahref="refC.html#chain">chain</a></code>, <code><ahref="refL.html#link">link</a></code> and <code><ahref="refY.html#yoke">yoke</a></code> functions, and returns the result list.For efficiency, pointers to the head and the tail of the list are maintainedinternally.<p><pre><code>: (make (link 1) (link 2 3) (link 4))-> (1 2 3 4): (make (made (1 2 3)) (link 4))-> (1 2 3 4)</code></pre><dt><a name="map"><code>(map 'fun 'lst ..) -> lst</code></a><dd>Applies <code>fun</code> to <code>lst</code> and all successive<code>CDR</code>'s. When additional <code>lst</code> arguments are given, theyare passed to <code>fun</code> in the same way. Returns the result of the lastapplication.<p><pre><code>: (map println (1 2 3 4) '(A B C))(1 2 3 4) (A B C)(2 3 4) (B C)(3 4) (C)(4) NIL-> NIL</code></pre><dt><a name="mapc"><code>(mapc 'fun 'lst ..) -> any</code></a><dd>Applies <code>fun</code> to each element of <code>lst</code>. Whenadditional <code>lst</code> arguments are given, their elements are also passedto <code>fun</code>. Returns the result of the last application.<p><pre><code>: (mapc println (1 2 3 4) '(A B C))1 A2 B3 C4 NIL-> NIL</code></pre><dt><a name="mapcan"><code>(mapcan 'fun 'lst ..) -> lst</code></a><dd>Applies <code>fun</code> to each element of <code>lst</code>. Whenadditional <code>lst</code> arguments are given, their elements are also passedto <code>fun</code>. Returns a (destructively) concatenated list of all results.<p><pre><code>: (mapcan reverse '((a b c) (d e f) (g h i)))-> (c b a f e d i h g)</code></pre><dt><a name="mapcar"><code>(mapcar 'fun 'lst ..) -> lst</code></a><dd>Applies <code>fun</code> to each element of <code>lst</code>. Whenadditional <code>lst</code> arguments are given, their elements are also passedto <code>fun</code>. Returns a list of all results.<p><pre><code>: (mapcar + (1 2 3) (4 5 6))-> (5 7 9): (mapcar '((X Y) (+ X (* Y Y))) (1 2 3 4) (5 6 7 8))-> (26 38 52 68)</code></pre><dt><a name="mapcon"><code>(mapcon 'fun 'lst ..) -> lst</code></a><dd>Applies <code>fun</code> to <code>lst</code> and all successive<code>CDR</code>'s. When additional <code>lst</code> arguments are given, theyare passed to <code>fun</code> in the same way. Returns a (destructively)concatenated list of all results.<p><pre><code>: (mapcon copy '(1 2 3 4 5))-> (1 2 3 4 5 2 3 4 5 3 4 5 4 5 5)</code></pre><dt><a name="maplist"><code>(maplist 'fun 'lst ..) -> lst</code></a><dd>Applies <code>fun</code> to <code>lst</code> and all successive<code>CDR</code>'s. When additional <code>lst</code> arguments are given, theyare passed to <code>fun</code> in the same way. Returns a list of all results.<p><pre><code>: (maplist cons (1 2 3) '(A B C))-> (((1 2 3) A B C) ((2 3) B C) ((3) C))</code></pre><dt><a name="maps"><code>(maps 'fun 'sym ['lst ..]) -> any</code></a><dd>Applies <code>fun</code> to all properties of <code>sym</code>. Whenadditional <code>lst</code> arguments are given, their elements are also passedto <code>fun</code>. Returns the result of the last application. See also<code><a href="refP.html#putl">putl</a></code> and <code><ahref="refG.html#getl">getl</a></code>.<p><pre><code>: (put 'X 'a 1)-> 1: (put 'X 'b 2)-> 2: (put 'X 'flg T)-> T: (getl 'X)-> (flg (2 . b) (1 . a)): (maps println 'X '(A B))flg A(2 . b) B(1 . a) NIL-> NIL</code></pre><dt><a name="mark"><code>(mark 'sym|0 [NIL | T | 0]) -> flg</code></a><dd>Tests, sets or resets a mark for <code>sym</code> in the database (for asecond argument of <code>NIL</code>, <code>T</code> or <code>0</code>,respectively), and returns the old value. The marks are local to the currentprocess (not stored in the database), and vanish when the process terminates. Ifthe first argument is zero, all marks are cleared.<p><pre><code>: (pool "db")-> T: (mark '{1} T) # Mark-> NIL: (mark '{1}) # Test-> T # -> marked: (mark '{1} 0) # Unmark-> T: (mark '{1}) # Test-> NIL # -> unmarked</code></pre><dt><a name="match"><code>(match 'lst1 'lst2) -> flg</code></a><dd>Takes <code>lst1</code> as a pattern to be matched against<code>lst2</code>, and returns <code>T</code> when successful. Atoms must beequal, and sublists must match recursively. Symbols in the pattern list withnames starting with an at-mark "<code>@</code>" (see <code><ahref="refP.html#pat?">pat?</a></code>) are taken as wildcards. They can matchzero, one or more elements, and are bound to the corresponding data. See also<code><a href="refC.html#chop">chop</a></code>, <code><ahref="refS.html#split">split</a></code> and <code><ahref="refF.html#fill">fill</a></code>.<p><pre><code>: (match '(@A is @B) '(This is a test))-> T: @A-> (This): @B-> (a test): (match '(@X (d @Y) @Z) '((a b c) (d (e f) g) h i))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -