Re: [Jprogramming] tree parsing

2014-06-18 Thread 'Pascal Jasmin' via Programming
-- From: Marshall Lochbaum To: 'Pascal Jasmin' via Programming Cc: Sent: Wednesday, June 18, 2014 7:14:24 PM Subject: Re: [Jprogramming] tree parsing You can use recursion ($:) to generate the required tree. a -: {.L:1 $:^:(0@:tree2  ". leaf <^:(2 %~ 0 i.~' '=]) &qu

Re: [Jprogramming] tree parsing

2014-06-18 Thread 'Pascal Jasmin' via Programming
ubject: Re: [Jprogramming] tree parsing You can use recursion ($:) to generate the required tree. a -: {.L:1 $:^:(0@:tree2  ". leaf <^:(2 %~ 0 i.~' '=]) "1 treetest Note that {.L:1 is required as otherwise the leaves would be lists of length 1. I'm not sure how to

Re: [Jprogramming] tree parsing

2014-06-18 Thread Marshall Lochbaum
You can use recursion ($:) to generate the required tree. a -: {.L:1 $:^:(0@:tree2 ". leaf <^:(2 %~ 0 i.~' '=]) "1 treetest Note that {.L:1 is required as otherwise the leaves would be lists of length 1. I'm not sure how to prevent that from happening within the verb that uses $: . Here's anoth

[Jprogramming] tree parsing

2014-06-18 Thread 'Pascal Jasmin' via Programming
all one line, treetest =: >(((<'  ') ('' ,~ ] #~ [ * <:@:#@:])"0 1~ each [: #S:1 {::) , each <@": S:0) a=: (fac =: 3 : 'q =. q: y if. 1<#q do. (y ; [: fac "0 each  y (] , %) ([: */ ] {~ # ?~ <.@:-:@:#)) q else. < y end.') 176715    treetest   1767150     189       9         3         3