Help / Release / J 5.02 / 13!:16 Withdrawn

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



13!:16 Withdrawn

initial writing: 2003-05-15
last updated: 2004-10-26


The conjunction 13!:16 Trace has been withdrawn and replaced by the script system\packages\misc\trace.ijs . The 13!:16 implementation required complications in the interpreter unwarranted by the amount of benefit, and having the trace as a script provides a model of the J parser whose internal workings can be examined and experimented with.


The main function in the script is trace :

x trace y  trace expression y to x levels of function calls
trace y  same as _ trace y

Examples:

   trace '3+i.4'
 --------------- 1 Monad ------
 i.
 4
 0 1 2 3
 --------------- 2 Dyad -------
 3
 +
 0 1 2 3
 3 4 5 6
 ==============================
3 4 5 6

   trace 'plus=: +'
 --------------- 7 Is ---------
 plus
 =:
 +
 +
 ==============================

   trace 'sum=: plus/'
 --------------- 3 Adverb -----
 plus
 /
 plus/
 --------------- 7 Is ---------
 sum
 =:
 plus/
 plus/
 ==============================

   trace 'sum p: 2+i.3'
 --------------- 1 Monad ------
 i.
 3
 0 1 2
 --------------- 2 Dyad -------
 2
 +
 0 1 2
 2 3 4
 --------------- 1 Monad ------
 p:
 2 3 4
 5 7 11
 --------------- 0 Monad ------
 sum
 5 7 11
  ------------------------------
  plus/
  5 7 11
   ------------------------------
   7
   +
   11
   18
   ==============================
   5
   +
   18
   23
   ==============================
  23
  ==============================
 23
 ==============================
23

   mean=: sum % #

   1 trace 'mean"1 *: i.2 3'
 --------------- 1 Monad ------
 i.
 2 3
 0 1 2
 3 4 5
 --------------- 4 Conj -------
 mean
 "
 1
 mean"1
 --------------- 1 Monad ------
 *:
 i.2 3
 0  1  4
 9 16 25
 --------------- 0 Monad ------
 mean"1
 2 3$0 1 4 9 16 25
  ------------------------------
  sum % #
  0 1 4
  1.6666666666666667
  ==============================
  sum % #
  9 16 25
  16.666666666666668
  ==============================
 1.66667 16.6667
 ==============================
1.66667 16.6667



>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release