langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
17
Task/Inverted-syntax/OxygenBasic/inverted-syntax.oxy
Normal file
17
Task/Inverted-syntax/OxygenBasic/inverted-syntax.oxy
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
macro cond(a,c) {c then a}
|
||||
|
||||
macro store(b,a) {a=b}
|
||||
|
||||
sys a,c=10
|
||||
|
||||
if c>4 then a=4
|
||||
|
||||
'INVERTED SYNTAX FORMS:
|
||||
|
||||
cond a=40, if c>4
|
||||
|
||||
store 4,a
|
||||
|
||||
'COMBINED:
|
||||
|
||||
cond store(5,a), if c>4
|
||||
4
Task/Inverted-syntax/PARI-GP/inverted-syntax.pari
Normal file
4
Task/Inverted-syntax/PARI-GP/inverted-syntax.pari
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fi(f, condition)=if(condition,f());
|
||||
|
||||
if(raining, print("Umbrella needed"))
|
||||
fi(->print("Umbrella needed"), raining)
|
||||
4
Task/Inverted-syntax/Perl-6/inverted-syntax-1.pl6
Normal file
4
Task/Inverted-syntax/Perl-6/inverted-syntax-1.pl6
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
if $guess == 6 { say "Wow! Lucky Guess!" } # Traditional
|
||||
say 'Wow! Lucky Guess!' if $guess == 6; # Inverted
|
||||
unless $guess == 6 { say "Huh! You Guessed Rong!" } # Traditional
|
||||
say 'Huh! You Guessed Rong!' unless $guess == 6; # Inverted
|
||||
8
Task/Inverted-syntax/Perl-6/inverted-syntax-2.pl6
Normal file
8
Task/Inverted-syntax/Perl-6/inverted-syntax-2.pl6
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
while $i { --$i }
|
||||
--$i while $i;
|
||||
|
||||
until $x > 10 { $x++ }
|
||||
$x++ until $x > 10;
|
||||
|
||||
for 1..10 { .say if $_ %% 2 }
|
||||
.say if $_ %% 2 for 1..10; # list comprehension
|
||||
1
Task/Inverted-syntax/Perl-6/inverted-syntax-3.pl6
Normal file
1
Task/Inverted-syntax/Perl-6/inverted-syntax-3.pl6
Normal file
|
|
@ -0,0 +1 @@
|
|||
42 R= $_; say $_; # prints 42
|
||||
2
Task/Inverted-syntax/Perl-6/inverted-syntax-4.pl6
Normal file
2
Task/Inverted-syntax/Perl-6/inverted-syntax-4.pl6
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
my @a = 1,2,3;
|
||||
(1,2,3) R= my @a;
|
||||
2
Task/Inverted-syntax/Perl-6/inverted-syntax-5.pl6
Normal file
2
Task/Inverted-syntax/Perl-6/inverted-syntax-5.pl6
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
my @a <== 1,2,3;
|
||||
1,2,3 ==> my @a;
|
||||
7
Task/Inverted-syntax/Perl-6/inverted-syntax-6.pl6
Normal file
7
Task/Inverted-syntax/Perl-6/inverted-syntax-6.pl6
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
repeat {
|
||||
$_ = prompt "Gimme a number: ";
|
||||
} until /^\d+$/;
|
||||
|
||||
repeat until /^\d+$/ {
|
||||
$_ = prompt "Gimme a number: ";
|
||||
}
|
||||
3
Task/Inverted-syntax/Perl-6/inverted-syntax-7.pl6
Normal file
3
Task/Inverted-syntax/Perl-6/inverted-syntax-7.pl6
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
repeat until my $answer ~~ 42 {
|
||||
$answer = prompt "Gimme an answer: ";
|
||||
}
|
||||
4
Task/Inverted-syntax/Perl-6/inverted-syntax-8.pl6
Normal file
4
Task/Inverted-syntax/Perl-6/inverted-syntax-8.pl6
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
my $answer;
|
||||
repeat {
|
||||
$answer = prompt "Gimme an answer: ";
|
||||
} until $answer ~~ 42;
|
||||
27
Task/Inverted-syntax/Qi/inverted-syntax.qi
Normal file
27
Task/Inverted-syntax/Qi/inverted-syntax.qi
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
(define set-needumbrella
|
||||
Raining -> (set needumbrella true) where (= true Raining)
|
||||
Raining -> (set needumbrella false) where (= false Raining))
|
||||
|
||||
(define set-needumbrella
|
||||
Raining -> (if (= true Raining)
|
||||
(set needumbrella true)
|
||||
(set needumbrella false)))
|
||||
|
||||
|
||||
Alternatives:
|
||||
|
||||
(define set-needumbrella
|
||||
Raining -> (set needumbrella true) where Raining
|
||||
Raining -> (set needumbrella false))
|
||||
|
||||
(define set-needumbrella
|
||||
Raining -> (if Raining
|
||||
(set needumbrella true)
|
||||
(set needumbrella false)))
|
||||
|
||||
(define set-needumbrella
|
||||
true -> (set needumbrella true)
|
||||
false -> (set needumbrella false))
|
||||
|
||||
(define set-needumbrella
|
||||
A -> (set needumbrella A))
|
||||
Loading…
Add table
Add a link
Reference in a new issue