~ubuntu-branches/ubuntu/wily/picolisp/wily-proposed

« back to all changes in this revision

Viewing changes to doc/refP.html

  • Committer: Package Import Robot
  • Author(s): Kan-Ru Chen (陳侃如)
  • Date: 2015-02-06 00:19:20 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20150206001920-ug3fakmqpq9apw5o
Tags: 3.1.9.7-1
* New upstream release
* Build *.jar from source
* Do not install doc/{db,utf8} as requested by upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
306
306
<dd>Executes <code>exe</code> in a <code><a
307
307
href="refF.html#fork">fork</a></code>'ed child process (which terminates
308
308
thereafter). In the first form, <code>pipe</code> just returns a file descriptor
309
 
to read from the standard output of that process. In the second form, it opens
310
 
the standard output of that process as input channel during the execution of
311
 
<code>prg</code>. The current input channel will be saved and restored
312
 
appropriately. See also <code><a href="refL.html#later">later</a></code>,
313
 
<code><a href="refI.html#ipid">ipid</a></code>, <code><a
 
309
to write to the standard input and read from the standard output of that
 
310
process. In the second form, it opens the standard output of that process as
 
311
input channel during the execution of <code>prg</code>. The current input
 
312
channel will be saved and restored appropriately. See also <code><a
 
313
href="refL.html#later">later</a></code>, <code><a
 
314
href="refI.html#ipid">ipid</a></code>, <code><a
314
315
href="refI.html#in">in</a></code> and <code><a
315
316
href="refO.html#out">out</a></code>.
316
317
 
317
318
<pre><code>
318
319
: (pipe                                # equivalent to 'any'
319
 
   (prinl "(a b # Comment^Jc d)")         # (child process)
320
 
   (read) )                               # (parent process)
 
320
   (prinl "(a b # Comment^Jc d)")         # Child
 
321
   (read) )                               # Parent
321
322
-> (a b c d)
 
323
 
322
324
: (pipe                                # pipe through an external program
323
 
   (out '(tr "[a-z]" "[A-Z]")             # (child process)
 
325
   (out '(tr "[a-z]" "[A-Z]")             # Child
324
326
      (prinl "abc def ghi") )
325
 
   (line T) )                             # (parent process)
 
327
   (line T) )                             # Parent
326
328
-> "ABC DEF GHI"
 
329
 
 
330
: (setq P
 
331
     (pipe
 
332
        (in NIL                           # Child: Read stdin
 
333
           (while (line T)
 
334
              (prinl (uppc @))            # and write to stdout
 
335
              (flush) ) ) ) )
 
336
-> 3
 
337
:  (out P (prinl "abc def"))              # Parent: Send line to child
 
338
-> "abc def"
 
339
:  (in P (line))                          # Parent: Read reply
 
340
-> ("A" "B" "C" " " "D" "E" "F")
327
341
</code></pre>
328
342
 
329
343
<dt><a name="place"><code>(place 'cnt 'lst 'any) -> lst</code></a>
775
789
<dd>Implements a stack using a list in <code>var</code>. The <code>any</code>
776
790
arguments are cons'ed in front of the value list. See also <code><a
777
791
href="refP.html#push1">push1</a></code>, <code><a
 
792
href="refP.html#push1q">push1q</a></code>, <code><a
778
793
href="refP.html#pop">pop</a></code>, <code><a
779
794
href="refQ.html#queue">queue</a></code> and <code><a
780
795
href="refF.html#fifo">fifo</a></code>.
803
818
is cons'ed in front of the value list only if it is not already a <code><a
804
819
href="refM.html#member">member</a></code> of that list. See also <code><a
805
820
href="refP.html#push">push</a></code>, <code><a
 
821
href="refP.html#push1q">push1q</a></code>, <code><a
806
822
href="refP.html#pop">pop</a></code> and <code><a
807
823
href="refQ.html#queue">queue</a></code>.
808
824
 
817
833
-> (4 3 2 1)
818
834
</code></pre>
819
835
 
 
836
<dt><a name="push1q"><code>(push1q 'var 'any ..) -> any</code></a>
 
837
<dd>Maintains a unique list in <code>var</code>. Each <code>any</code> argument
 
838
is cons'ed in front of the value list only if it is not already <code><a
 
839
href="refM.html#memq">memq</a></code> of that list (pointer equality). See also
 
840
<code><a href="refP.html#push">push</a></code>, <code><a
 
841
href="refP.html#push1">push1</a></code>, <code><a
 
842
href="refP.html#pop">pop</a></code> and <code><a
 
843
href="refQ.html#queue">queue</a></code>.
 
844
 
 
845
<pre><code>
 
846
: (push1q 'S 'a (1) 'b (2) 'c)
 
847
-> c
 
848
: S
 
849
-> (c (2) b (1) a)
 
850
: (push1q 'S 'b (1) 'd)       # (1) is not pointer equal to the previous one
 
851
-> d
 
852
: S
 
853
->  (d (1) c (2) b (1) a)     # (1) is twice in the list
 
854
</code></pre>
 
855
 
820
856
<dt><a name="put"><code>(put 'sym1|lst ['sym2|cnt ..] 'sym|0 'any) ->
821
857
any</code></a> <dd>Stores a new value <code>any</code> for a property key
822
858
<code>sym</code> (or in the symbol value for zero) in a symbol. That symbol is