⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 refp.html

📁 A very small LISP implementation with several packages and demo programs.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
(dm (has> . +Fold) (Val X)   (extra      Val      (if (= Val (fold Val)) (fold X) X) ) )(dm (has> . +Entity) (Var Val)   (or      (nor Val (get This Var))      (has> (meta This Var) Val (get This Var)) ) )(dm (has> . +List) (Val X)   (and      Val      (or         (extra Val X)         (find '((X) (extra Val X)) X) ) ) )(dm (has> . +Bag) (Val X)   (and      Val      (or (super Val X) (car (member Val X))) ) )</code></pre><dt><a name="pr"><code>(pr 'any ..) -> any</code></a><dd>Binary print: Prints all <code>any</code> arguments to the current outputchannel in encoded binary format. See also <code><ahref="refR.html#rd">rd</a></code>, <code><a href="refW.html#wr">wr</a></code>and <code><a href="refR.html#rpc">rpc</a></code>.<p><pre><code>: (out "x" (pr 7 "abc" (1 2 3) 'a))          # Print to "x"-> a: (hd "x")00000000  04 0E 0E 61 62 63 01 04 02 04 04 04 06 03 05 61  ...abc.........a-> NIL</code></pre><dt><a name="prEval"><code>(prEval 'prg ['cnt]) -> any</code></a><dd>Executes <code>prg</code>, similar to <code><ahref="refR.html#run">run</a></code>, by evaluating all expressions in<code>prg</code> (within the binding environment given by <code>cnt-1</code>).As a side effect, all atomics expression will be printed with <code><ahref="refP.html#prinl">prinl</a></code>. See also <code><ahref="refE.html#eval">eval</a></code>.<p><pre><code>: (let Prg 567   (prEval      '("abc" (prinl (+ 1 2 3)) Prg 987) ) )abc6567987-> 987</code></pre><dt><a name="pre?"><code>(pre? 'sym1 'sym2) -> flg</code></a><dd>Returns non-<code>NIL</code> when the name of the first symbol<code>sym1</code> is a prefix string of the name of the second symbol<code>sym2</code>. See also <code><a href="refS.html#sub?">sub?</a></code>.<p><pre><code>: (pre? "abc" "abcdef")-> T: (pre? "def" "abcdef")-> NIL: (pre? "" "abcdef")-> T</code></pre><dt><a name="pretty"><code>(pretty 'any 'cnt)</code></a><dd>Pretty-prints <code>any</code>. If <code>any</code> is an atom, or a listwith a <code><a href="refS.html#size">size</a></code> not greater than 12, it is<code><a href="refP.html#print">print</a></code>ed as is. Otherwise, only theopening parenthesis and the CAR of the list is printed, all other elementes arepretty-printed recursively indented by three spaces, followed by a space and thecorresponding closing parenthesis. The initial indentation level<code>cnt</code> defaults to zero. See also <code><ahref="refP.html#pp">pp</a></code>.<p><pre><code>: (pretty '(a (b c d) (e (f (g) (h) (i)) (j (k) (l) (m))) (n o p) q))(a   (b c d)   (e      (f (g) (h) (i))      (j (k) (l) (m)) )   (n o p)   q )-> ")"</code></pre><dt><a name="prin"><code>(prin 'any ..) -> any</code></a><dd>Prints the string representation of all <code>any</code> arguments to thecurrent output channel. No space or newline is printed between individual items,or after the last item. For lists, all elements are <code>prin</code>'tedrecursively. See also <code><a href="refP.html#prinl">prinl</a></code>.<p><pre><code>: (prin 'abc 123 '(a 1 b 2))abc123a1b2-> (a 1 b 2)</code></pre><dt><a name="prinl"><code>(prinl 'any ..) -> any</code></a><dd>Prints the string representation of all <code>any</code> arguments to thecurrent output channel, followed by a newline. No space or newline is printedbetween individual items. For lists, all elements are <code>prin</code>'tedrecursively. See also <code><a href="refP.html#prin">prin</a></code>.<p><pre><code>: (prinl 'abc 123 '(a 1 b 2))abc123a1b2-> (a 1 b 2)</code></pre><dt><a name="print"><code>(print 'any ..) -> any</code></a><dd>Prints all <code>any</code> arguments to the current output channel. Ifthere is more than one argument, a space is printed between successivearguments. No space or newline is printed after the last item. See also <code><ahref="refP.html#println">println</a></code>, <code><ahref="refP.html#printsp">printsp</a></code>, <code><ahref="refS.html#sym">sym</a></code> and <code><ahref="refS.html#str">str</a></code><p><pre><code>: (print 123)123-> 123: (print 1 2 3)1 2 3-> 3: (print '(a b c) 'def)(a b c) def-> def</code></pre><dt><a name="println"><code>(println 'any ..) -> any</code></a><dd>Prints all <code>any</code> arguments to the current output channel,followed by a newline. If there is more than one argument, a space is printedbetween successive arguments. See also <code><ahref="refP.html#print">print</a></code>, <code><ahref="refP.html#printsp">printsp</a></code>.<p><pre><code>: (println '(a b c) 'def)(a b c) def-> def</code></pre><dt><a name="printsp"><code>(printsp 'any ..) -> any</code></a><dd>Prints all <code>any</code> arguments to the current output channel,followed by a space. If there is more than one argument, a space is printedbetween successive arguments. See also <code><ahref="refP.html#print">print</a></code>, <code><ahref="refP.html#println">println</a></code>.<p><pre><code>: (printsp '(a b c) 'def)(a b c) def -> def</code></pre><dt><a name="prog"><code>(prog . prg) -> any</code></a><dd>Executes <code>prg</code>, and returns the result of the last expression.See also <code><a href="refN.html#nil">nil</a></code>, <code><ahref="refT.html#t">t</a></code>, <code><ahref="refP.html#prog1">prog1</a></code> and <code><ahref="refP.html#prog2">prog2</a></code>.<p><pre><code>: (prog (print 1) (print 2) (print 3))123-> 3</code></pre><dt><a name="prog1"><code>(prog1 'any1 . prg) -> any1</code></a><dd>Executes all arguments, and returns the result of the first expression<code>any1</code>. See also <code><a href="refN.html#nil">nil</a></code>,<code><a href="refT.html#t">t</a></code>, <code><ahref="refP.html#prog">prog</a></code> and <code><ahref="refP.html#prog2">prog2</a></code>.<p><pre><code>: (prog1 (print 1) (print 2) (print 3))123-> 1</code></pre><dt><a name="prog2"><code>(prog2 'any1 'any2 . prg) -> any2</code></a><dd>Executes all arguments, and returns the result of the second expression<code>any2</code>. See also <code><a href="refN.html#nil">nil</a></code>,<code><a href="refT.html#t">t</a></code>, <code><ahref="refP.html#prog">prog</a></code> and <code><ahref="refP.html#prog1">prog1</a></code>.<p><pre><code>: (prog2 (print 1) (print 2) (print 3))123-> 2</code></pre><dt><a name="prop"><code>(prop 'sym1|lst ['sym2|cnt ..] 'sym) -> lst|sym</code></a><dd>Fetches a property for a property key <code>sym</code> from a symbol. Thatsymbol is <code>sym1</code> (if no other arguments are given), or a symbol foundby applying the <code><a href="refG.html#get">get</a></code> algorithm to<code>sym1|lst</code> and the following arguments. The property (the cell, notjust its value) is returned, suitable for direct (destructive) manipulations.<p><pre><code>: (put 'X 'cnt 0)-> 0: (prop 'X 'cnt)-> (0 . cnt): (inc (prop 'X 'cnt))        # Directly manipulate the property value-> 1: (get 'X 'cnt)-> 1</code></pre><dt><a name="protect"><code>(protect . prg) -> any</code></a><dd>Executes <code>prg</code>, and returns the result of the last expression. Ifa signal is received during that time, its handling will be delayed until theexecution of <code>prg</code> is completed. See also <code><ahref="refA.html#alarm">alarm</a></code>, <a href="refH.html#*Hup">*Hup</a>, <ahref="refS.html#*Sig1">*Sig[12]</a> and <code><ahref="refK.html#kill">kill</a></code>.<p><pre><code>: (protect (journal "db1.log" "db2.log"))-> T</code></pre><dt><a name="prove"><code>(prove 'lst ['lst]) -> lst</code></a><dd>The <a href="ref.html#pilog">Pilog</a> interpreter. Tries to prove the querylist in the first argument, and returns an association list of symbol-valuepairs, or <code>NIL</code> if not successful. The query list is modified as aside effect, allowing subsequent calls to <code>prove</code> for furtherresults. The optional second argument may contain a list of symbols; in thatcase the successful matches of rules defined for these symbols will be traced.See also <code><a href="refG.html#goal">goal</a></code>, <code><ahref="ref_.html#->">-&gt</a></code> and <code><ahref="refU.html#unify">unify</a></code>.<p><pre><code>: (prove (goal '((equal 3 3))))-> T: (prove (goal '((equal 3 @X))))-> ((@X . 3)): (prove (goal '((equal 3 4))))-> NIL</code></pre><dt><a name="prune"><code>(prune ['flg])</code></a><dd>Optimizes memory usage by pruning in-memory leaf nodes of database trees.Typically called repeatedly during heavy data imports. If <code>flg</code> isnon-<code>NIL</code>, further pruning will be disabled. See also <code><ahref="refL.html#lieu">lieu</a></code>.<p><pre><code>(in File1   (while (someData)      (new T '(+Cls1) ..)      (at (0 . 10000) (commit) (prune)) ) )(in File2   (while (moreData)      (new T '(+Cls2) ..)      (at (0 . 10000) (commit) (prune)) ) )(commit)(prune T)</code></pre><dt><a name="push"><code>(push 'var 'any ..) -> any</code></a><dd>Implements a stack using a list in <code>var</code>. The <code>any</code>arguments are cons'ed in front of the value list. See also <code><ahref="refP.html#push1">push1</a></code>, <code><ahref="refP.html#pop">pop</a></code>, <code><ahref="refQ.html#queue">queue</a></code> and <code><ahref="refF.html#fifo">fifo</a></code>.<p><pre><code>: (push 'S 3)              # Use the VAL of 'S' as a stack-> 3: S-> (3): (push 'S 2)-> 2: (push 'S 1)-> 1: S-> (1 2 3): (push S 999)             # Now use the CAR of the list in 'S'-> 999: (push S 888 777)-> 777: S-> ((777 888 999 . 1) 2 3)</code></pre><dt><a name="push1"><code>(push1 'var 'any ..) -> any</code></a><dd>Maintains a unique list in <code>var</code>. Each <code>any</code> argumentis cons'ed in front of the value list only if it is not already a <code><ahref="refM.html#member">member</a></code> of that list. See also <code><ahref="refP.html#push">push</a></code>, <code><ahref="refP.html#pop">pop</a></code> and <code><ahref="refQ.html#queue">queue</a></code>.<p><pre><code>: (push1 'S 1 2 3)-> 3: S-> (3 2 1): (push1 'S 2 4)-> 4: S-> (4 3 2 1)</code></pre><dt><a name="put"><code>(put 'sym1|lst ['sym2|cnt ..] 'sym 'any) -> any</code></a><dd>Stores a new value <code>any</code> for a property key <code>sym</code> in asymbol. That symbol is <code>sym1</code> (if no other arguments are given), or asymbol found by applying the <code><a href="refG.html#get">get</a></code>algorithm to <code>sym1|lst</code> and the following arguments.<p><pre><code>: (put 'X 'a 1)-> 1: (get 'X 'a)-> 1: (prop 'X 'a)-> (1 . a)</code></pre><dt><a name="putl"><code>(putl 'sym1|lst1 ['sym2|cnt ..] 'lst) -> lst</code></a><dd>Stores a complete new property list <code>lst</code> in a symbol. Thatsymbol is <code>sym1</code> (if no other arguments are given), or a symbol foundby applying the <code><a href="refG.html#get">get</a></code> algorithm to<code>sym1|lst1</code> and the following arguments. All previously definedproperties for that symbol are lost. See also <code><ahref="refG.html#getl">getl</a></code> and <code><ahref="refM.html#maps">maps</a></code>.<p><pre><code>: (putl 'X '((123 . a) flg ("Hello" . b)))-> ((123 . a) flg ("Hello" . b)): (get 'X 'a)-> 123: (get 'X 'b)-> "Hello": (get 'X 'flg)-> T</code></pre><dt><a name="pwd"><code>(pwd) -> sym</code></a><dd>Returns the path to the current working directory. See also <code><ahref="refD.html#dir">dir</a></code> and <code><ahref="refC.html#cd">cd</a></code>.<p><pre><code>: (pwd)-> "/home/app/"</code></pre></dl></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -