September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,2 @@
1 2 SaSbLaLb f
=2 1

View file

@ -0,0 +1,2 @@
1 2 r f
=2 1

View file

@ -0,0 +1,24 @@
import extensions.
singleton swap
{
eval ref:v1 ref:v2
[
var tmp := v1 value.
v1 object := v2 value.
v2 object := tmp.
]
}
program =
[
var n := 2.
var s := "abc".
console printLine(n," ",s).
swap eval ref:n ref:s.
console printLine(n," ",s).
].

View file

@ -0,0 +1,9 @@
Public Sub Main()
Dim vA As Variant = " World"
Dim vB As Variant = 1
Swap vA, vB
Print vA; vB
End

View file

@ -1,9 +1,9 @@
function swap(aName, bName) {
return ('(function(){ arguments[0] = aName; aName = bName; bName = arguments[0] })()'
eval('(function(){ arguments[0] = aName; aName = bName; bName = arguments[0] })()'
.replace(/aName/g, aName)
.replace(/bName/g, bName)
)
}
var x = 1
var y = 2
eval(swap('x', 'y'))
swap('x', 'y')

View file

@ -0,0 +1,20 @@
// version 1.1
fun <T> swap(t1: T, t2: T) = Pair(t2, t1)
fun main(args: Array<String>) {
var a = 3
var b = 4
val c = swap(a, b) // infers that swap<Int> be used
a = c.first
b = c.second
println("a = $a")
println("b = $b")
var d = false
var e = true
val f = swap(d, e) // infers that swap<Boolean> be used
d = f.first
e = f.second
println("d = $d")
println("e = $e")
}

View file

@ -1 +0,0 @@
swap(a, b)

View file

@ -0,0 +1 @@
%A#%B#<%B#%A#<>>

View file

@ -0,0 +1 @@
[&SW,A^,B^],A^<,B^<<,B^<,A^<<>>

View file

@ -0,0 +1 @@
+%A#%B#&SW

View file

@ -0,0 +1,5 @@
mata
a=1,2,3
b="ars longa vita brevis"
swap(a, b)
end

View file

@ -0,0 +1,9 @@
class C{var v; fcn init(n){v=n}}
var c1=C(1), c2=C(2);
println(c1.v," : ",c2.v);
fcn swap(ca,cb,name){
tmp:=ca.resove(name);
ca.setVar(name,cb.resolve(name)); cb.setVar(name,tmp)
}
swap(c1,c2,"v");
println(c1.v," : ",c2.v);