Crossposting from beta, as there is a code overview for how multiline tacit
code works. Its been updated since initial post. Also allows console macros
to apply to lines in editor windows.
I think your main idea is the possiblity of having a top/down -> right to left
expression parser. The TacifyR adverb does create reversed (top to bottom
becomes right to left) multiline tacit expressions.
defined simply as
(0 :) (TacifyC |.)
TacifyC is a conjunction that is exactly like the Tacify adverb except that a v
verb can process the whole set of boxes after they are cut with LF but before
Tacify's 3 main operations
Tacify does 3 relatively simple things to each line before creating a tacit
expression by 'evaling' the lines together
removes comments. executes any macros on the line (detected by the presense of
a name with MAC prefix as the last ;: token). Puts parentheses around each
line unless a line has one ;: token (to avoid parenthesizing lone conjunctions).
Some valid uses of Tacify
'+/%#' Tacify 2 43
boxscan =: 0 Tacify
&.
>
/
>@:
)
boxscan =: 0 Tacify
&.>
/
>@:
)
((&.>)/)(>@:)
NB. compiles to your mix function, but tabs are lost and shortened comments.
NB. this code has maximum line breaks
] (+"1/ #~&(,/) 1 - +./ .*&:*"1/) [ {.~"1 0 (-@}. i.@>:)&{:&$ ]
mixes =: 0 Tacify NB.langford strings type interleaving
(+"1/ NB. dyadic/ y +"1/ righward justifies of x. result is 3d
,/ NB. roll up 1 dimension of each side to make both 2d
#~& NB. equiv to #~&(,/) selects from rolled up +"1/ table
1
- NB. 1 - to produce 0 1 boolean 3d table
+./ .*&:* NB. inner product over y items *"1/ rightward justifies of x
"1/) NB. adverbs apply to whole previous phrase
[ NB. x
{.~"1 0 NB. rightward justifies of x upto size of y item shape
-@}. i.@>: NB. hook: negative of excess sizes y over x item shapes as list
&{: NB. item shapes of each xy
&$ NB. x is 1d, y 2d
)
multiline_test file has formatted versions of these functions. There is also a
top to bottom reversed function assigned to test6
test6 =: 0 TacifyR_multiline_
) NB. too weird. When reversing, parens close at top. indent or comment.
#)
%
(+/
(
)
Beyond the weirdness rules regarding single parentheses lines, you also have to
close before opening in general. But the biggest reason this turns out to be
not useful is that the bottom to top multiline tacit format allows you to split
and join lines with enter and backspace
I'm not 100% sure how your true if test can be conveniently used. Though that
is a very interesting way of parsing multiline expressions with anything (not
just 0) as the right parameter.
----- Original Message -----
From: Raul Miller <[email protected]>
To: Beta forum <[email protected]>
Cc:
Sent: Sunday, July 26, 2015 2:19 AM
Subject: Re: [Jbeta] could there be a function to reload user keys?
Something you might like to play with:
example=:1 :'if.LF e.m do.|.m else.if. 0-:m do.|.0 :0 end.end.'
0 example
1
2
)
2
1
Good luck,
--
Raul
On Sun, Jul 26, 2015 at 1:56 AM, 'Pascal Jasmin' via Beta
<[email protected]> wrote:
> I've updated my macro and keyboard shortcut system to use WinSelect/Text.
> Works nice.
>
> https://github.com/Pascal-J/multiline-tacit-and-macros---J
>
> bug fixes too.
>
> some enhancements are:
>
> findline can be called with a right argument, that will append to the
> selected string. Following keys are recommended, and usage described in
> git's readme.
>
> F12;0;Macro exec;DoWithMacro@findline_jpp_ ''
> F4;0;Timespace exec;DoWithMacro@:(' timespacex MACm' findline_jpp_ ]) ''
> F3;0;Clipboard append exec;DoWithMacro@((' ' , wdclippaste@:(''"_))
> findline_jpp_ ])''
>
> Works in editor files now too.
>
> My suggestion is that it would be nice to be able to reload userkeys without
> restarting J. Perhaps one of the submenu items in |Function keys.
>
> An issue with any user key application is that you want to use it right now,
> but you might also not want to restart J right now.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm