Tracy Hamrs wrote:
> It seems easy enough to write a preprocessor that will allow J
> definitions to be identified and executed within text that is
> otherwise ignored. As for how J sentences would be best identified,
> and continuation handled where wrap-around occurs, debate within the J
> community would be the next step. (Perhaps double leading
> right-paren?)
It is simple enough and more useful than I expected. How about the
following for incorporating comments.
============================
Note 'Function implementing a suggestion of Tracy Harms'
Tracy suggested an initial character as delineating code.
Using the TAB key as the first character of a line which
defines a line which is to be executed. All other lines
are treated as comments.
)
litu =: , @ (}."1 @(LF,.~((TAB = {."1) # ]))) NB. util to strip code
lit =: 3 : 0 NB. for a file
require 'files'
0!:1 litu 'm' fread y
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm