Anonymous user
Fractran: Difference between revisions
→Tacit version
Line 2,154:
'''Solution'''
This is a variation of the previous solution which it is not entirely tacit due to the use of the explicit standard library verb (function) charsub. The adverb (functional)
<lang j>
The argument of
'''Example'''
<lang j> '17/91 78/85 19/51 23/38 29/33 77/29 95/23 77/19 1/17 11/13 13/11 15/14 15/2 55/1' (<15)
2 15 825 725 1925 2275 425 390 330 290 770 910 170 156 132</lang>
Line 2,168:
'''Extra credit'''
The prime numbers are produced via the adverb primes; its argument has the same specifications as the argument for the
<lang j>primes=. ('fractan'f.) ((1 }. 2 ^. (#~ *./@:e.&2 0"1@:q:))@:)
Line 2,183:
'''Turing completeness of J's stateless point-free dialect'''
When _ is the limit argument (i.e., when no limit is imposed) the run will halt according to the
<lang j> _
".@:('1234567890r ' {~ '1234567890/ '&i.)@:[ ({~ (1 i.~ (= <.)))@:* ::]^:_ ]</lang>
Actually, most of the code above is there to comply with the task's requirement of a "''natural'' format." When J's format for fractions is used the
<lang j>
which is an indirect concise confirmation that J's fixed tacit dialect is Turing complete.
In the following example,
<lang j> 455r33 11r13 1r11 3r7 11r2 1r3
59604644775390625</lang>
|