Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
23
Task/Inverted-syntax/EchoLisp/inverted-syntax.echolisp
Normal file
23
Task/Inverted-syntax/EchoLisp/inverted-syntax.echolisp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
;; use reader macros to transform (a OP b) into (OP b a)
|
||||
|
||||
(lib 'match)
|
||||
(define-macro invert-= (a <- b) (set! b a))
|
||||
(define-macro invert-IF (a 'IF b) (when b a))
|
||||
|
||||
(define raining #f)
|
||||
|
||||
(#t <- raining)
|
||||
raining
|
||||
→ #t
|
||||
('umbrella-need IF raining)
|
||||
→ umbrella-need
|
||||
|
||||
(#f <- raining)
|
||||
('umbrella-need IF raining)
|
||||
→ #f
|
||||
|
||||
;; debug mode
|
||||
(debug 3)
|
||||
('umbrella-need IF raining)
|
||||
💡 [0] invert-IF → ('umbrella-need IF raining)
|
||||
compiled :: (#when raining 'umbrella-need)
|
||||
13
Task/Inverted-syntax/FreeBASIC/inverted-syntax.freebasic
Normal file
13
Task/Inverted-syntax/FreeBASIC/inverted-syntax.freebasic
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
#Define ThenIf(a, b) If b Then a
|
||||
#Define InvertAssign(a, b) b = a
|
||||
|
||||
Dim As Boolean needUmbrella = False, raining = True
|
||||
ThenIf(needUmbrella = True, raining = True)
|
||||
Print "needUmbrella = "; needUmbrella
|
||||
|
||||
Dim As Integer b = 0, a = 3
|
||||
InvertAssign(a, b)
|
||||
Print "b is"; b
|
||||
Sleep
|
||||
8
Task/Inverted-syntax/Sidef/inverted-syntax.sidef
Normal file
8
Task/Inverted-syntax/Sidef/inverted-syntax.sidef
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Inverted syntax with assignment
|
||||
var raining = true;
|
||||
[false]»(\var needumbrella);
|
||||
|
||||
# Inverted syntax with conditional expressions
|
||||
if (raining==true) {needumbrella=true};
|
||||
{needumbrella=true} -> if (raining==true);
|
||||
(needumbrella=true) if (raining==true);
|
||||
29
Task/Inverted-syntax/Swift/inverted-syntax.swift
Normal file
29
Task/Inverted-syntax/Swift/inverted-syntax.swift
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
infix operator ~= {}
|
||||
infix operator ! {}
|
||||
|
||||
func ~=(lhs:Int, inout rhs:Int) {
|
||||
rhs = lhs
|
||||
}
|
||||
|
||||
func !(lhs:(() -> Void), rhs:Bool) {
|
||||
if (rhs) {
|
||||
lhs()
|
||||
}
|
||||
}
|
||||
|
||||
// Traditional assignment
|
||||
var a = 0
|
||||
|
||||
// Inverted using a custom operator
|
||||
20 ~= a
|
||||
|
||||
let raining = true
|
||||
let tornado = true
|
||||
var needUmbrella = false
|
||||
var stayInside = false
|
||||
|
||||
// Traditional conditional expression
|
||||
if raining {needUmbrella = true}
|
||||
|
||||
// Inverted using a custom operator
|
||||
_ = {stayInside = true} ! tornado
|
||||
8
Task/Inverted-syntax/Wortel/inverted-syntax.wortel
Normal file
8
Task/Inverted-syntax/Wortel/inverted-syntax.wortel
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
; a = expr
|
||||
:a expr
|
||||
; expr = a
|
||||
~:expr a
|
||||
; if cond expr
|
||||
@if cond expr
|
||||
; if expr cond
|
||||
~@if expr cond
|
||||
1
Task/Inverted-syntax/jq/inverted-syntax-1.jq
Normal file
1
Task/Inverted-syntax/jq/inverted-syntax-1.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
v as $x
|
||||
2
Task/Inverted-syntax/jq/inverted-syntax-2.jq
Normal file
2
Task/Inverted-syntax/jq/inverted-syntax-2.jq
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
o["a"] = 2
|
||||
# or equivalently: o.a = 2
|
||||
Loading…
Add table
Add a link
Reference in a new issue