[Jprogramming] Tacit definition using Amend

Don Guinn donguinn at pvtnetworks.net
Thu Feb 9 21:44:55 HKT 2006


Tried to rewrite R.E.'s solution to eliminate the ties and got something 
that looks identical according to 5!:2 but is not. It doesn't work 
either. Curious.

g=.1:`(<@[)`]}
2 g i.4
0 1 1 3
h=.(1:(<@[)])}
2 h i.4
domain error: h
 2 h i.4
g
┌──────────────┬─┐
│┌──┬───────┬─┐│}│
││1:│┌─┬─┬─┐│]││ │
││ ││<│@│[││ ││ │
││ │└─┴─┴─┘│ ││ │
│└──┴───────┴─┘│ │
└──────────────┴─┘
h
┌──────────────┬─┐
│┌──┬───────┬─┐│}│
││1:│┌─┬─┬─┐│]││ │
││ ││<│@│[││ ││ │
││ │└─┴─┴─┘│ ││ │
│└──┴───────┴─┘│ │
└──────────────┴─┘
(5!:2<'g')-:(5!:2<'h')
1

5!:1 shows a difference.

(5!:1<'g')
┌──────────────────────────┐
│┌─┬──────────────────────┐│
││}│┌────────────────────┐││
││ ││┌─┬────────────────┐│││
││ │││0│┌──┬─────────┬─┐││││
││ │││ ││1:│┌─┬─────┐│]│││││
││ │││ ││ ││@│┌─┬─┐││ │││││
││ │││ ││ ││ ││<│[│││ │││││
││ │││ ││ ││ │└─┴─┘││ │││││
││ │││ ││ │└─┴─────┘│ │││││
││ │││ │└──┴─────────┴─┘││││
││ ││└─┴────────────────┘│││
││ │└────────────────────┘││
│└─┴──────────────────────┘│
└──────────────────────────┘
(5!:1<'h')
┌──────────────────────────┐
│┌─┬──────────────────────┐│
││}│┌────────────────────┐││
││ ││┌─┬────────────────┐│││
││ │││3│┌──┬─────────┬─┐││││
││ │││ ││1:│┌─┬─────┐│]│││││
││ │││ ││ ││@│┌─┬─┐││ │││││
││ │││ ││ ││ ││<│[│││ │││││
││ │││ ││ ││ │└─┴─┘││ │││││
││ │││ ││ │└─┴─────┘│ │││││
││ │││ │└──┴─────────┴─┘││││
││ ││└─┴────────────────┘│││
││ │└────────────────────┘││
│└─┴──────────────────────┘│
└──────────────────────────┘


R.E. Boss wrote:

>1:`(<@[)`]}
>
>R.E. Boss
>
>-----Oorspronkelijk bericht-----
>Van: programming-bounces at jsoftware.com
>[mailto:programming-bounces at jsoftware.com] Namens June Kim
>Verzonden: donderdag 9 februari 2006 10:57
>Aan: Programming forum
>Onderwerp: [Jprogramming] Tacit definition using Amend
>
>Hi
>
>Is it possible to make a tacit definition for the following verb?
>
>(4 : '1 (<x.) } y.')
>
>June
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>  
>



More information about the Programming mailing list