picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

refQ.html (3070B)


      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
      2 <html lang="en">
      3 <head>
      4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      5 <title>Q</title>
      6 <link rel="stylesheet" href="doc.css" type="text/css">
      7 </head>
      8 <body>
      9 
     10 <h1>Q</h1>
     11 
     12 <dl>
     13 
     14 <dt><a name="qsym"><code>(qsym . sym) -> lst</code></a>
     15 <dd>Returns a cons pair of the value and property list of <code>sym</code>. See
     16 also <code><a href="refQ.html#quote">quote</a></code>, <code><a
     17 href="refV.html#val">val</a></code> and <code><a
     18 href="refG.html#getl">getl</a></code>.
     19 
     20 <pre><code>
     21 : (setq A 1234)
     22 -> 1234
     23 : (put 'A 'a 1)
     24 -> 1
     25 : (put 'A 'b 2)
     26 -> 2
     27 : (put 'A 'f T)
     28 -> T
     29 : (qsym . A)
     30 -> (1234 f (2 . b) (1 . a))
     31 </code></pre>
     32 
     33 <dt><a name="quote"><code>(quote . any) -> any</code></a>
     34 <dd>Returns <code>any</code> unevaluated. The reader recognizes the single quote
     35 char <code>'</code> as a macro for this function. See also <code><a
     36 href="refL.html#lit">lit</a></code>.
     37 
     38 <pre><code>
     39 : 'a
     40 -> a
     41 : '(foo a b c)
     42 -> (foo a b c)
     43 : (quote (quote (quote a)))
     44 -> ('('(a)))
     45 </code></pre>
     46 
     47 <dt><a name="query"><code>(query 'lst ['lst]) -> flg</code></a>
     48 <dd>Handles an interactive <a href="ref.html#pilog">Pilog</a> query. The two
     49 <code>lst</code> arguments are passed to <code><a
     50 href="refP.html#prove">prove</a></code>. <code>query</code> displays each
     51 result, waits for console input, and terminates when a non-empty line is
     52 entered. See also <code><a href="ref_.html#?">?</a></code>, <code><a
     53 href="refP.html#pilog">pilog</a></code> and <code><a
     54 href="refS.html#solve">solve</a></code>.
     55 
     56 <pre><code>
     57 : (query (goal '((append @X @Y (a b c)))))
     58  @X=NIL @Y=(a b c)
     59  @X=(a) @Y=(b c).   # Stop
     60 -> NIL
     61 </code></pre>
     62 
     63 <dt><a name="queue"><code>(queue 'var 'any) -> any</code></a>
     64 <dd>Implements a queue using a list in <code>var</code>. The <code>any</code>
     65 argument is (destructively) concatenated to the end of the value list. See also
     66 <code><a href="refP.html#push">push</a></code>, <code><a
     67 href="refP.html#pop">pop</a></code> and <code><a
     68 href="refF.html#fifo">fifo</a></code>.
     69 
     70 <pre><code>
     71 : (queue 'A 1)
     72 -> 1
     73 : (queue 'A 2)
     74 -> 2
     75 : (queue 'A 3)
     76 -> 3
     77 : A
     78 -> (1 2 3)
     79 : (pop 'A)
     80 -> 1
     81 : A
     82 -> (2 3)
     83 </code></pre>
     84 
     85 <dt><a name="quit"><code>(quit ['any ['any]])</code></a>
     86 <dd>Stops current execution. If no arguments are given, all pending <code><a
     87 href="refF.html#finally">finally</a></code> expressions are executed and control
     88 is returned to the top level read-eval-print loop. Otherwise, an error handler
     89 is entered. The first argument can be some error message, and the second might
     90 be the reason for the error. See also <code><a href="ref.html#errors">Error
     91 Handling</a></code>.
     92 
     93 <pre><code>
     94 : (de foo (X) (quit "Sorry, my error" X))
     95 -> foo
     96 : (foo 123)                                  # 'X' is bound to '123'
     97 123 -- Sorry, my error                       # Error entered
     98 ? X                                          # Inspect 'X'
     99 -> 123
    100 ?                                            # Empty line: Exit
    101 :
    102 </code></pre>
    103 
    104 </dl>
    105 
    106 </body>
    107 </html>