[Jprogramming] Repeated application of a verb
Björn Helgason
gosinn at gmail.com
Mon Oct 10 22:33:47 HKT 2011
It is interesting to test this and trace and see the difference of using 5
and _
outp1=: 2
outp2=: 5
trigger=: outp1, outp2
- ^: (trigger */@:-. at e.~ ])^:_ 2 3 5 7
- ^: (trigger */@:-. at e.~ ])^:_ 33
test=: 3 : 0
smoutput 'test'
smoutput y
( trigger */@:-. at e.~ ]) y
)
ft=: 3 : 0
smoutput 'ft'
smoutput ' in comes'
smoutput y
-y
)
( ft ^: (test)^:_) 2 3 5 7
( ft ^: (test)^:5) 33
( ft ^: (test)^:5) 2 3 5 7
( ft ^: (test)^:_) 33
2011/10/8 Raul Miller <rauldmiller at gmail.com>
> 2011/10/8 Björn Helgason <gosinn at gmail.com>:
> > (- ^: (trigger */@:-. at e.~ ])^:_ ) 2 3 5 7
> > 2 3 5 7
> > (- ^: (trigger */@:-. at e.~ ])^:_ ) 33
> >
> > goes into a seemingly endless loop
>
> Of course.
>
> The sequence generated looks like this:'
>
> 33
> _33
> 33
> _33
> 33
> _33
> ...
>
> (with each subsequent value on a different line.)
>
> The loop terminates when the result list contains (presumably) a 2 or a 5.
>
> How long do imagine it will need to run, before a 2 or a 5 is generated?
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fornustekkum II
781 Hornafirði,
t-póst: gosinn at gmail.com
gsm: +3546985532
twitter: @flugfiskur
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 |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
More information about the Programming
mailing list