Does this solution depend on being able to evaluate the results in lexicographic order of name? The spec doesn't guarantee that.

My version:

NB. Advent 7
LC =: 'abcdefghijklmnopqrstuvwxyz'
'`NOT OR AND LSHIFT RSHIFT' =: (65535&-)`(23 b.)`(17 b.)`(65535 (17 b.) (33 b.)~)`(33 b.~ -)
NB. Read input, convert to words.  There seems to be an extra LF
NB. Extract signal-names
Nm =: (#~ e.&LC@{.@>)&.> I =: a: -.~ <@;:;._2 wd 'clippaste'
NB. topo sort names.  Move defined names to front, recur
Toponm =: ((;@#~ ([ , $:@(-.L:1~)^:(*.&*&#)) (#~ -.)) 1&>:@#@>) Nm
NB. Sort lines by result-name, convert, execute
([: ".@(;:^:_1) {: , '=:' ; _3&}.)@> I /: Toponm i. {:@> I
NB. Result?
a


Henry Rich

On 12/7/2015 12:48 PM, 'Pascal Jasmin' via Programming wrote:
Y =: (&{::)(@:])
X =: (&{::)(@:[)
excludesolved =: 2 : '(] #~ v) , [ u ] #~ -.@v'


c =. (('abcdefghijklmnopqrstuvwxyz' ('z' , leaf ])^:([ e.~ {.every@])"1 0  ])&.;:) each b =. 
<@( (0 Y ),~ '=:' ,~ }.@(1 Y))@:('-'&cut)"1 a =. > cutLF wd'clippaste'


wd 'clipcopy *' , LF joinstring 1 |. ,&>/((2 = # every@{.@;:every ) </. ])/:~ c

then paste clipboard into a new file (could have used 3 : trick)  where the 
file header is:

RSHIFT =: ((65535) 17 b. [ 33 b.~ -@])
LSHIFT =: (65535) 17 b. 33 b.~
AND =:(65535) 17 b. 17 b.
OR =:(65535) 17 b. 23 b.
NOT =:(65535) 17 b. 26 b.

load that file and inspect za
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to