It is interesting to test this and trace and see the difference of using 5
and _
outp1=: 2
outp2=: 5
trigger=: outp1, outp2
- ^: (trigger */@:-.@e.~ ])^:_ 2 3 5 7
- ^: (trigger */@:-.@e.~ ])^:_ 33
test=: 3 : 0
smoutput 'test'
smoutput y
( trigger */@:-.@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 <[email protected]>
> 2011/10/8 Björn Helgason <[email protected]>:
> > (- ^: (trigger */@:-.@e.~ ])^:_ ) 2 3 5 7
> > 2 3 5 7
> > (- ^: (trigger */@:-.@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: [email protected]
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 |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=) ♖♘♗♕♔♙
`. )----' (")_(") ☃☠
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm