home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / apl / 1386 < prev    next >
Encoding:
Text File  |  1993-01-27  |  3.2 KB  |  71 lines

  1. Newsgroups: comp.lang.apl
  2. Path: sparky!uunet!ukma!darwin.sura.net!newsserver.jvnc.net!phage!wchang
  3. From: wchang@phage.cshl.org (William Chang in Marr Lab - CSHL)
  4. Subject: APL/! (APL slash bang)
  5. Message-ID: <C1Gx14.1t6@phage.cshl.org>
  6. Organization: Cold Spring Harbor Lab, Long Is New York
  7. Date: Tue, 26 Jan 1993 15:43:51 GMT
  8. Lines: 61
  9.  
  10. APL slash bang                                  DRAFT 31 December, 1991
  11.  
  12. I would like to propose an ASCII rendition of APL, to be called
  13. APL/! (a pun on APL\?, itself a pun on APL).  In this scheme, ASCII
  14. symbol combinations that are visually appealing are assigned to
  15. functions that are most commonly used, subject of course to rules
  16. of consistency and operator ambivalence.  In particular, APL's two
  17. Greek letters rho and iota are transliterated to slash / and bang !.
  18. There are two adverbs, a pre-modifier tilde ~ signifying oppositeness, 
  19. and a post-modifier dot . signifying extension.  A longer note on the
  20. motivation and design of APL/! will be submitted later.
  21.  
  22. Logical and Comparison:    
  23.   ~. not   ^. and   v. or      ~^. nand    ~v. nor
  24.   = equal  < less   > greater  ~= unequal  ~< not less  ~> not greater
  25. Structural (shaping, slicing, transposing, shifting):
  26.   , ravel, catenate   / shape, reshape   | take  ~| drop   \ transpose  
  27.   -. reverse, rotate (row-wise)  +. (column-wise)
  28. Special:
  29.   ! initial segment of indices, index of   ? membership
  30.   /. compress, reduce (cumulate)   \. expand, scan (partials)
  31.   ~/. ~\. (column-wise)            # execute  ~# format
  32.   (.f.) outer product   (f).(g) inner product
  33. Arithmetic:  
  34.   + plus   - negative, minus   * sign, times   % reciprocal, divide   
  35.   ^ power  ~^ logarithm 
  36. Numerical:
  37.   <. floor, min  >. ceiling, max   ~<. grade up  ~>. grade down
  38.   *. factorial, choose   %. invert matrix, solve   ?. roll, deal
  39.   #. decode  ~#. encode  @. pi times, circle  |. magnitude, modulo
  40. Syntactic:
  41.   ~number (negative constant)   @name (system variable or function)
  42.   @ quad (numerical input/output)  ~@ quote-quad (text input/output)
  43.   =. assignment   -> branch   <> statement separator   <>. o} comment
  44.   & delta  &. delta-underscore   ~& del (define function)  ~&. lock
  45. Unchanged:  
  46.   ;  :  [ ]  ( )  '
  47. Initials for Extended APL:
  48.   c. enclose  ~c. disclose   o. box (objectify)  ~o. open
  49.  
  50. Some familiar idioms:
  51.   /A "shape A"    //A "rank A"   (/B)/A "B-conform A"
  52.   !10 "initial ten"    !/A "indices A"   B!A "B-indices A"
  53.   ((!/A)=A!A)/.A "A minus duplicates" 
  54.       [indices A equal A-indices A, subset A]
  55.   +/.^.\. "find first zero" [cumulative-add all-one left-partials]
  56.   +/.^.\.-.' '=A "count trailing blanks"
  57.       [find first zero, backwards, in space-equal-A]
  58.   (-+/.^.\.-.' '=A)~|A "A minus trailing blanks"
  59.   (-+/.^.\.-.' '=A)-.A "right-justify A"  
  60.       [row-wise circular shift, trailing blanks to front]
  61.   (!10)(.*.)(!10) "ten-by-ten multiplication table"
  62.   A(+).(*)B "matrix product"   A(<.).(+)A "shortest paths, one stop-over"
  63.   ->(COND)/LABEL [goto LABEL if COND]
  64.   ->(CONDS)/.LABELS [goto LABEL corresponding to first true COND]
  65.  
  66. -----------------------------------------------------------------------------
  67. William I. Chang, Ph.D.
  68. Cold Spring Harbor Laboratory
  69. 100 Bungtown Road, Cold Spring Harbor, NY 11724
  70. (516)367-8866 -8461(fax)  email: wchang@cshl.org
  71.