Twelve statements: Difference between revisions

Content deleted Content added
→‎{{header|Ada}}: added Ada solution
→‎{{header|J}}: added more comments
Line 490: Line 490:


=={{header|J}}==
=={{header|J}}==
In the following 'apply' is a foreign conjunction:
In the following 'apply' is the foreign conjunction:
<lang j> apply
<lang j> apply
128!:2
128!:2
Line 514: Line 514:


testall=: (];"1 0<@I.@:(]~:(apply&><))"1) #:@i.@(2&^)@#</lang>
testall=: (];"1 0<@I.@:(]~:(apply&><))"1) #:@i.@(2&^)@#</lang>

The output follows the Haskell convention: true/false bitstring followed by the index of a contradiction


'''All true'''
'''All true'''
Line 557: Line 559:


'''Iterative for all true'''
'''Iterative for all true'''
<br>In fact a repeat while true construction: x f^:(p)^:_ y
<lang j> (-N)&{. #: S <:@]^:((]-.@-:(apply&><)"1) (-N)&{.@#:@])^:(_) 2^N=.#S
<lang j> (-N)&{. #: S <:@]^:((]-.@-:(apply&><)"1) (-N)&{.@#:@])^:(_) 2^N=.#S
1 0 1 1 0 1 1 0 0 0 1 0</lang>
1 0 1 1 0 1 1 0 0 0 1 0</lang>