Here are some steps for simplifying the original tacit expression
([: +/ [: > [: ".&.> [: [ [: {.&.> [: [ [: ":&.>@p: i.) 15
43
NB. ( ([: [ f) y ) <--> ( f y )
NB. so can get rid of the two instances of that
([: +/ [: > [: ".&.> [: {.&.> [: ":&.>@p: i.) 15
43
NB. rather than do an each ( &.> ) for each primitive
NB. make a new composed verb ("....@{.@": ) with one each
([: +/ [: > [: "....@{.@":&.>@p: i.) 15
43
NB. the step to unbox means in this case that you didn't
NB. really want the results boxed in the first place so
NB. use Bond Open ( &> ) rather than Under Open ( &.> )
([: +/ [: "....@{.@":&>@p: i.) 15
43
NB. ([: f g) y <--> f...@g y (really @: but @ ok in this case)
([: +/ "....@{.@":&>@p:@i.) 15
43
NB. because p: has monadic rank of 0, it will probably be faster to use @: than
@
([: +/ "....@{.@":&>@:p:@i.) 15
ts=: 6!:2 , 7!:2...@]
50 ts '([: +/ [: > [: ".&.> [: [ [: {.&.> [: [ [: ":&.>@p: i.) 555'
0.00358129172 268800
50 ts '([: +/ ".@:{.@:":&>@:p:@i.) 555'
0.00192112882 33344
> From: Björn Helgason
> Sent: Tuesday, 16 November 2010 04:39
>
> It would be interesting to know how many J ers can easily read tacit
> programs.
>
> A line like
>
> [: +/ [: > [: ".&.> [: [ [: {.&.> [: [ [: ":&.>@p: i.
>
> This is something I am not too comfortable to read nor write just like
> that
> even if I do know what it is supposed to do.
>
> Question is if people see it as a better way to program like this
> tacitly
> than just do it in more lines and easily understood steps?
>
> --
> Björn Helgason, Verkfræðingur
> Fornustekkum II
> 781 Hornafirði,
> t-póst: [email protected]
> gsm: +3546985532
> sími: +3544781286
> http://groups.google.com/group/J-Programming
>
>
> Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari
> einfaldleikans
>
> góður kennari getur stigið á tær án þess að glansinn fari af skónum
> /|_ .-----------------------------------.
> ,' .\ / | Með léttri lund verður |
> ,--' _,' | Dagurinn í dag |
> / / | Enn betri en gærdagurinn |
> ( -. | `-----------------------------------'
> | ) | (\_ _/)
> (`-. '--.) (='.'=) ♖♘♗♕♔♙
> `. )----' (")_(") ☃☠
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm