September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
59
Task/Variables/ARM-Assembly/variables.arm
Normal file
59
Task/Variables/ARM-Assembly/variables.arm
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* ARM assembly Raspberry PI */
|
||||
/* program variable.s */
|
||||
|
||||
/************************************/
|
||||
/* Constantes Définition */
|
||||
/************************************/
|
||||
.equ STDOUT, 1 @ Linux output console
|
||||
.equ EXIT, 1 @ Linux syscall
|
||||
.equ WRITE, 4 @ Linux syscall
|
||||
/*********************************/
|
||||
/* Initialized data */
|
||||
/*********************************/
|
||||
.data
|
||||
szString: .asciz "String définition"
|
||||
sArea1: .fill 11, 1, ' ' @ 11 spaces
|
||||
@ or
|
||||
sArea2: .space 11,' ' @ 11 spaces
|
||||
|
||||
cCharac: .byte '\n' @ character
|
||||
cByte1: .byte 0b10101 @ 1 byte binary value
|
||||
|
||||
hHalfWord1: .hword 0xFF @ 2 bytes value hexa
|
||||
.align 4
|
||||
iInteger1: .int 123456 @ 4 bytes value decimal
|
||||
iInteger3: .short 0500 @ 4 bytes value octal
|
||||
iPointer1: .int 0x4000 @ 4 bytes value hexa
|
||||
@ or
|
||||
iPointer2: .word 0x4000 @ 4 bytes value hexa
|
||||
iPointer3: .int 04000 @ 4 bytes value octal
|
||||
|
||||
TabInteger4: .int 5,4,3,2 @ Area of 4 integers = 4 * 4 = 16 bytes
|
||||
|
||||
iDoubleInt1: .quad 0xFFFFFFFFFFFFFFFF @ 8 bytes
|
||||
|
||||
dfFLOAT1: .double 0f-31415926535897932384626433832795028841971.693993751E-40 @ Float 8 bytes
|
||||
sfFLOAT2: .float 0f-31415926535897932384626433832795028841971.693993751E-40 @ Float 4 bytes (or use .single)
|
||||
|
||||
/*********************************/
|
||||
/* UnInitialized data */
|
||||
/*********************************/
|
||||
.bss
|
||||
sBuffer: .skip 500 @ 500 bytes values zero
|
||||
iInteger2: .skip 4 @ 4 bytes value zero
|
||||
/*********************************/
|
||||
/* code section */
|
||||
/*********************************/
|
||||
.text
|
||||
.global main
|
||||
main: @ entry of program
|
||||
ldr r0,iAdriInteger2 @ load variable address
|
||||
mov r1,#100
|
||||
str r1,[r0] @ init variable iInteger2
|
||||
|
||||
100: @ standard end of the program
|
||||
mov r0, #0 @ return code
|
||||
mov r7, #EXIT @ request to exit program
|
||||
svc #0 @ perform the system call
|
||||
|
||||
iAdriInteger2: .int iInteger2 @ variable address iInteger2
|
||||
|
|
@ -5,7 +5,7 @@ Name: declare -- a local declaration block has an optional name
|
|||
Z : Integer renames Y: -- Rename Y (creates a view)
|
||||
function F (X: Integer) return Integer is
|
||||
-- Inside, all declarations outside are visible when not hidden: X, Y, Z are global with respect to F.
|
||||
X: Integer := Z; -- hides the outer X which however can be refered to by Name.X
|
||||
X: Integer := Z; -- hides the outer X which however can be referred to by Name.X
|
||||
begin
|
||||
...
|
||||
end F; -- locally declared variables stop to exist here
|
||||
|
|
|
|||
3
Task/Variables/Common-Lisp/variables-10.lisp
Normal file
3
Task/Variables/Common-Lisp/variables-10.lisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(defun frobnicate (x)
|
||||
(declare (type fixnum x))
|
||||
(the fixnum (+ x 128)))
|
||||
|
|
@ -1,4 +1,2 @@
|
|||
(declaim (ftype (function (fixnum) fixnum) frobnicate))
|
||||
(defun frobnicate (x)
|
||||
(declare (type fixnum x))
|
||||
(the fixnum (+ x 128)))
|
||||
(setf *x* 42 *y* (1+ *x*))
|
||||
=>43
|
||||
|
|
|
|||
3
Task/Variables/Common-Lisp/variables-8.lisp
Normal file
3
Task/Variables/Common-Lisp/variables-8.lisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(setf *x* 625)
|
||||
(psetf *x* 42 *y* (1+ *x*)
|
||||
=>NIL
|
||||
3
Task/Variables/Common-Lisp/variables-9.lisp
Normal file
3
Task/Variables/Common-Lisp/variables-9.lisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(declaim (ftype (function (fixnum) fixnum) frobnicate))
|
||||
(defun frobnicate (x)
|
||||
(+ x 42))
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
program =
|
||||
[
|
||||
var c := $nil. // declaring variable.
|
||||
var a := 3. // declaring and initializing variables
|
||||
var b := "my string" length.
|
||||
public program
|
||||
{
|
||||
var c := nil; // declaring variable.
|
||||
var a := 3; // declaring and initializing variables
|
||||
var b := "my string".Length;
|
||||
long l := 200l; // declaring strongly typed variable
|
||||
auto l := new List<int>();
|
||||
|
||||
c := b + a. // assigning variable
|
||||
].
|
||||
c := b + a; // assigning variable
|
||||
}
|
||||
|
|
|
|||
5
Task/Variables/Mercury/variables-1.mercury
Normal file
5
Task/Variables/Mercury/variables-1.mercury
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
:- func name = string.
|
||||
name = Name :-
|
||||
Name = Title ++ " " ++ Given,
|
||||
Title = "Dr.",
|
||||
Given = "Bob".
|
||||
4
Task/Variables/Mercury/variables-2.mercury
Normal file
4
Task/Variables/Mercury/variables-2.mercury
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
:- pred greet(string::in, io::di, io::uo) is det.
|
||||
greet(Who, !IO) :-
|
||||
io.write_string("Hello", !IO),
|
||||
io.format(", %s!\n", [s(Who)], !IO).
|
||||
4
Task/Variables/Mercury/variables-3.mercury
Normal file
4
Task/Variables/Mercury/variables-3.mercury
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
:- pred greet(string::in, io::di, io::uo) is det.
|
||||
greet(Who, !.IO, !:IO) :-
|
||||
io.write_string("Hello", !.IO, !:IO),
|
||||
io.format(", %s!\n", [s(Who)], !.IO, !:IO).
|
||||
4
Task/Variables/Mercury/variables-4.mercury
Normal file
4
Task/Variables/Mercury/variables-4.mercury
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
:- pred greet(string::in, io::di, io::uo) is det.
|
||||
greet(Who, IO0, IO) :-
|
||||
io.write_string("Hello", IO0, IO1),
|
||||
io.format(", %s!\n", [s(Who)], IO1, IO).
|
||||
9
Task/Variables/Mercury/variables-5.mercury
Normal file
9
Task/Variables/Mercury/variables-5.mercury
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
:- func dr(string) = string.
|
||||
dr(Name) = Titled :-
|
||||
some [!SB] (
|
||||
!:SB = string.builder.init,
|
||||
put_char(handle, 'D', !SB),
|
||||
put_char(handle, 'r', !SB),
|
||||
format(handle, " %s", [s(Name)], !SB),
|
||||
Titled = to_string(!.SB)
|
||||
).
|
||||
6
Task/Variables/Mercury/variables-6.mercury
Normal file
6
Task/Variables/Mercury/variables-6.mercury
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
% all_under(N, L)
|
||||
% True if every member of L is less than N
|
||||
%
|
||||
:- pred all_under(int::in, list(int)::in) is semidet.
|
||||
all_under(Limit, L) :-
|
||||
all [N] (member(N, L) => N < Limit).
|
||||
23
Task/Variables/Mercury/variables-7.mercury
Normal file
23
Task/Variables/Mercury/variables-7.mercury
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
:- type accumulator == (pred(int, int, io, io)).
|
||||
:- inst accumulator == (pred(in, out, di, uo) is det).
|
||||
|
||||
:- func accumulator >> accumulator = accumulator.
|
||||
:- mode in(accumulator) >> in(accumulator) = out(accumulator).
|
||||
A >> B = C :-
|
||||
C = (pred(!.N::in, !:N::out, !.IO::di, !:IO::uo) is det :-
|
||||
A(!N, !IO),
|
||||
B(!N, !IO)).
|
||||
|
||||
:- pred add(int::in, int::in, int::out, io::di, io::uo) is det.
|
||||
add(N, !Acc, !IO) :-
|
||||
io.format("adding %d to accumulator (current value: %d)\n",
|
||||
[i(N), i(!.Acc)], !IO),
|
||||
!:Acc = !.Acc + N.
|
||||
|
||||
:- pred example2(io::di, io::uo) is det.
|
||||
example2(!IO) :-
|
||||
F = add(5)
|
||||
>> add(5)
|
||||
>> add(-10),
|
||||
F(0, X, !IO),
|
||||
io.print_line(X, !IO).
|
||||
39
Task/Variables/Mercury/variables-8.mercury
Normal file
39
Task/Variables/Mercury/variables-8.mercury
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
:- module evenodd.
|
||||
:- interface.
|
||||
:- import_module io.
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
:- implementation.
|
||||
:- import_module list, string.
|
||||
|
||||
:- type coin
|
||||
---> heads
|
||||
; tails.
|
||||
|
||||
:- inst heads for coin/0
|
||||
---> heads.
|
||||
:- inst tails for coin/0
|
||||
---> tails.
|
||||
|
||||
main(!IO) :-
|
||||
(if heads(heads, N) then
|
||||
print_heads(N, !IO)
|
||||
else true).
|
||||
|
||||
:- pred print_heads(coin::in(heads), io::di, io::uo) is det.
|
||||
print_heads(_, !IO) :-
|
||||
io.write_string("heads\n", !IO).
|
||||
|
||||
:- pred print_tails(coin::in(tails), io::di, io::uo) is det.
|
||||
print_tails(_, !IO) :-
|
||||
io.write_string("tails\n", !IO).
|
||||
|
||||
:- pragma foreign_export_enum("C", coin/0, [prefix("COIN_"), uppercase]).
|
||||
|
||||
:- pred heads(coin::in, coin::out(heads)) is semidet.
|
||||
:- pragma foreign_proc("C",
|
||||
heads(N::in, M::out(heads)),
|
||||
[promise_pure, will_not_call_mercury],
|
||||
"
|
||||
M = N;
|
||||
SUCCESS_INDICATOR = N == COIN_HEADS;
|
||||
").
|
||||
2
Task/Variables/Visual-Basic-.NET/variables-1.visual
Normal file
2
Task/Variables/Visual-Basic-.NET/variables-1.visual
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Dim variable As datatype
|
||||
Dim var1,var2,... As datatype
|
||||
4
Task/Variables/Visual-Basic-.NET/variables-2.visual
Normal file
4
Task/Variables/Visual-Basic-.NET/variables-2.visual
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Dim n1,n2 as Integer
|
||||
Dim x as Double
|
||||
Dim isRaining as Boolean
|
||||
Dim greeting as String
|
||||
2
Task/Variables/Visual-Basic-.NET/variables-3.visual
Normal file
2
Task/Variables/Visual-Basic-.NET/variables-3.visual
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Dim variable As datatype = value
|
||||
Dim var1,var2,... As datatype
|
||||
6
Task/Variables/Visual-Basic-.NET/variables-4.visual
Normal file
6
Task/Variables/Visual-Basic-.NET/variables-4.visual
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Dim wholeNumber1,wholeNumber2 as Integer = 3
|
||||
Dim realNumber as Double = 3.0
|
||||
Dim isRaining as Boolean = False
|
||||
Dim greeting as String = "Hello, this is World speaking."
|
||||
Dim longArray() As Long = {0, 1, 2, 3}
|
||||
Dim twoDimensions(,) As Integer = {{0, 1, 2}, {10, 11, 12}}
|
||||
1
Task/Variables/Visual-Basic-.NET/variables-5.visual
Normal file
1
Task/Variables/Visual-Basic-.NET/variables-5.visual
Normal file
|
|
@ -0,0 +1 @@
|
|||
variable = expression
|
||||
3
Task/Variables/Visual-Basic-.NET/variables-6.visual
Normal file
3
Task/Variables/Visual-Basic-.NET/variables-6.visual
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
v = a
|
||||
d = b^2 - 4*a*c
|
||||
s3 = s1 & mid(s2,3,2)
|
||||
1
Task/Variables/Visual-Basic-.NET/variables-7.visual
Normal file
1
Task/Variables/Visual-Basic-.NET/variables-7.visual
Normal file
|
|
@ -0,0 +1 @@
|
|||
variable <operator>= expression2
|
||||
8
Task/Variables/Visual-Basic-.NET/variables-8.visual
Normal file
8
Task/Variables/Visual-Basic-.NET/variables-8.visual
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
c += a
|
||||
c -= a
|
||||
c *= a
|
||||
c /= a
|
||||
c ^= a
|
||||
c <<= n
|
||||
c >>= n
|
||||
c &= a
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
Dim wholeNumber as Integer = 3
|
||||
Dim realNumber as Double = 3.0
|
||||
Dim isRaining as Boolean = False
|
||||
Dim greeting as String = "Hello, this is World speaking."
|
||||
Loading…
Add table
Add a link
Reference in a new issue