langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
2
Task/Introspection/OCaml/introspection-1.ocaml
Normal file
2
Task/Introspection/OCaml/introspection-1.ocaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Sys.ocaml_version;;
|
||||
- : string = "3.10.2"
|
||||
3
Task/Introspection/OCaml/introspection-2.ocaml
Normal file
3
Task/Introspection/OCaml/introspection-2.ocaml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Scanf.sscanf (Sys.ocaml_version) "%d.%d.%d"
|
||||
(fun major minor micro -> major, minor, micro) ;;
|
||||
- : int * int * int = (3, 10, 2)
|
||||
14
Task/Introspection/Oz/introspection.oz
Normal file
14
Task/Introspection/Oz/introspection.oz
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
declare
|
||||
Version = {Property.get 'oz.version'}
|
||||
%% Version is an atom like '1.4.0'. So we can not compare it directly.
|
||||
%% Extract the version components:
|
||||
[Major Minor Release] = {Map {String.tokens {Atom.toString Version} &.} String.toInt}
|
||||
in
|
||||
if Major >= 1 andthen Minor >= 4 then
|
||||
%% check whether module Number exports a value 'abs':
|
||||
if {HasFeature Number abs} then
|
||||
{Show {Number.abs ~42}}
|
||||
end
|
||||
else
|
||||
{System.showInfo "Your Mozart version is too old."}
|
||||
end
|
||||
3
Task/Introspection/PARI-GP/introspection.pari
Normal file
3
Task/Introspection/PARI-GP/introspection.pari
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if(lex(version(), [2,4,3]) < 0, quit()); \\ Compare the version to 2.4.3 lexicographically
|
||||
|
||||
if(bloop!='bloop && type(abs) == "t_CLOSURE", abs(bloop))
|
||||
3
Task/Introspection/PL-I/introspection.pli
Normal file
3
Task/Introspection/PL-I/introspection.pli
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
S = SYSVERSION();
|
||||
if substr(S, 6, 6) < '050000' then
|
||||
do; put skip list ('Version of compiler is too old'); stop; end;
|
||||
9
Task/Introspection/Perl-6/introspection.pl6
Normal file
9
Task/Introspection/Perl-6/introspection.pl6
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use v6.0; # require Perl 6.0
|
||||
|
||||
my $bloop = -123;
|
||||
|
||||
if MY::{'$bloop'}.defined and CORE::{'&abs'}.defined { say abs $bloop }
|
||||
|
||||
my @ints = ($_ when Int for PROCESS::.values);
|
||||
say "Number of PROCESS vars of type Int: ", +@ints;
|
||||
say "PROCESS vars of type Int add up to ", [+] @ints;
|
||||
4
Task/Introspection/Pop11/introspection-1.pop11
Normal file
4
Task/Introspection/Pop11/introspection-1.pop11
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
;;; Exit if version below 15.00
|
||||
if pop_internal_version < 150000 then
|
||||
sysexit()
|
||||
endif;
|
||||
17
Task/Introspection/Pop11/introspection-2.pop11
Normal file
17
Task/Introspection/Pop11/introspection-2.pop11
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
;;; We do main task in a procedure
|
||||
define check_and_call(x, y);
|
||||
lvars wx=consword(x), wy=consword(y);
|
||||
if identprops(wx) = 0 and isprocedure(valof(wx))
|
||||
and identprops(wy) = 0 then
|
||||
return(valof(wx)(valof(wy)));
|
||||
else
|
||||
return("failed");
|
||||
endif;
|
||||
enddefine;
|
||||
|
||||
;;; Prints failed because bloop is undefined
|
||||
check_and_call('abs' , 'bloop') =>
|
||||
;;; Define bloop
|
||||
vars bloop = -5;
|
||||
;;; Now prints 5
|
||||
check_and_call('abs' , 'bloop') =>
|
||||
14
Task/Introspection/PowerShell/introspection.psh
Normal file
14
Task/Introspection/PowerShell/introspection.psh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# version is found in $PSVersionTable
|
||||
if ($PSVersionTable['PSVersion'] -lt '2.0') {
|
||||
exit
|
||||
}
|
||||
|
||||
if ((Test-Path Variable:bloop) -and ([Math]::Abs)) {
|
||||
[Math]::Abs($bloop)
|
||||
}
|
||||
|
||||
# find integer variables and their sum
|
||||
Get-Variable -Scope global `
|
||||
| Where-Object { $_.Value -is [int] } `
|
||||
| Measure-Object -Sum Value `
|
||||
| Select-Object Count,Sum
|
||||
9
Task/Introspection/PureBasic/introspection.purebasic
Normal file
9
Task/Introspection/PureBasic/introspection.purebasic
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
CompilerIf #PB_Compiler_Version<441
|
||||
CompilerError "You failed the version check!"
|
||||
CompilerEndIf
|
||||
|
||||
CompilerIf Defined(bloop,#PB_Variable)
|
||||
CompilerIf Defined(Abs(),#PB_Function)
|
||||
Abs(bloop)
|
||||
CompilerEndIf
|
||||
CompilerEndIf
|
||||
5
Task/Introspection/Raven/introspection.raven
Normal file
5
Task/Introspection/Raven/introspection.raven
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
VERSION 0 prefer 20071104 <
|
||||
if 'version >= 20071104 required' print bye
|
||||
|
||||
'bloop' GLOBAL keys in && 'abs' CORE keys in
|
||||
if bloop abs print
|
||||
1
Task/Introspection/Retro/introspection-1.retro
Normal file
1
Task/Introspection/Retro/introspection-1.retro
Normal file
|
|
@ -0,0 +1 @@
|
|||
version ^strings'splitAtChar: . drop toNumber 3 < &bye ifTrue
|
||||
1
Task/Introspection/Retro/introspection-2.retro
Normal file
1
Task/Introspection/Retro/introspection-2.retro
Normal file
|
|
@ -0,0 +1 @@
|
|||
build toNumber 1309798464 < &bye ifTrue
|
||||
6
Task/Introspection/Retro/introspection-3.retro
Normal file
6
Task/Introspection/Retro/introspection-3.retro
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
( Checks for existance of "bloop" and "abs" )
|
||||
: executeByName ( $- )
|
||||
find drop [ @d->xt ] [ @d->class ] bi withClass ;
|
||||
|
||||
"bloop" "abs" [ find nip ] bi@ and
|
||||
[ "bloop" executeByName "abs" executeByName ] ifTrue
|
||||
1
Task/Introspection/Retro/introspection-4.retro
Normal file
1
Task/Introspection/Retro/introspection-4.retro
Normal file
|
|
@ -0,0 +1 @@
|
|||
0 0 last [ dup @d->class &.integer = [ @d->xt @ + [ 1+ ] dip ] [ drop ] if ] ^types'LIST each@
|
||||
1
Task/Introspection/Slate/introspection-1.slate
Normal file
1
Task/Introspection/Slate/introspection-1.slate
Normal file
|
|
@ -0,0 +1 @@
|
|||
Platform run: StartupArguments first ; ' --version'.
|
||||
2
Task/Introspection/Slate/introspection-2.slate
Normal file
2
Task/Introspection/Slate/introspection-2.slate
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(lobby hasSlotNamed: #bloop) /\ [(#abs findOn: {lobby bloop}) isNotNil] ifTrue: [inform: bloop abs printString].
|
||||
lobby slotValues inject: 0 into: [| :sum :value | (value is: Integer) ifTrue: [sum + value] ifFalse: [sum]].
|
||||
24
Task/Introspection/TI-89-BASIC/introspection.ti-89
Normal file
24
Task/Introspection/TI-89-BASIC/introspection.ti-89
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
()
|
||||
Prgm
|
||||
Local l, i, vers
|
||||
getConfg() → l
|
||||
For i,1,dim(l),2
|
||||
If l[i] = "OS Version" or l[i] = "Version" Then
|
||||
l[i + 1] → vers
|
||||
Disp "Version: " & vers
|
||||
If expr(right(vers, 4)) < 2005 Then © Lousy parsing strategy
|
||||
Disp vers & " is too old"
|
||||
Stop
|
||||
EndIf
|
||||
EndIf
|
||||
EndFor
|
||||
|
||||
If isVar(bloop) Then © Dynamic name check can be done with isVar(#aString)
|
||||
© Builtin functions cannot be tested for.
|
||||
Disp abs(bloop)
|
||||
Else
|
||||
Disp "No bloop"
|
||||
EndIf
|
||||
|
||||
© There is no way to get a list of global variables.
|
||||
EndPrgm
|
||||
1
Task/Introspection/Toka/introspection-1.toka
Normal file
1
Task/Introspection/Toka/introspection-1.toka
Normal file
|
|
@ -0,0 +1 @@
|
|||
VERSION 101 > [ bye ] ifFalse
|
||||
1
Task/Introspection/Toka/introspection-2.toka
Normal file
1
Task/Introspection/Toka/introspection-2.toka
Normal file
|
|
@ -0,0 +1 @@
|
|||
` VERSION FALSE = [ bye ] ifTrue
|
||||
1
Task/Introspection/Toka/introspection-3.toka
Normal file
1
Task/Introspection/Toka/introspection-3.toka
Normal file
|
|
@ -0,0 +1 @@
|
|||
` bloop FALSE <> ` abs FALSE <> and [ ` bloop invoke @ ` abs invoke ] ifTrue
|
||||
13
Task/Introspection/Ursala/introspection.ursala
Normal file
13
Task/Introspection/Ursala/introspection.ursala
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#import std
|
||||
#import flo
|
||||
#import lag
|
||||
|
||||
maybe_abs = math.|fabs (%QI flo)-:~&! 'abs'
|
||||
|
||||
#preprocess version==-[0.10.2]-?\<'wrong version'>!% *^0 ||~& -&
|
||||
-&~&vitB,~&d.lexeme=='=',~&vhd.lexeme=='bloop',~&vthd.lexeme=='(evaluated)'&-,
|
||||
&vthd.semantics:= !+ !+ maybe_abs+ ~&vthd.semantics.&iNHiNH&-
|
||||
|
||||
#cast %e
|
||||
|
||||
bloop = -1.
|
||||
7
Task/Introspection/ZX-Spectrum-Basic/introspection.zx
Normal file
7
Task/Introspection/ZX-Spectrum-Basic/introspection.zx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
10 LET totram=PEEK 23732 + 256 * PEEK 23733: REM Check that we have a 48k machine
|
||||
20 IF totram < 65535 THEN PRINT "Your 16k Spectrum is too old": STOP
|
||||
30 REM variables must exist before they are used, otherwise we get an error
|
||||
40 REM we can poke a new error handler and check for variable not found.
|
||||
50 REM I haven't implemented this, because I have forgotten the handler address
|
||||
60 LET bloob = -4: REM make sure bloob exists, by creating it.
|
||||
70 PRINT ABS(bloob): REM function will be present, ZX Spectrum Basic is standardized.
|
||||
Loading…
Add table
Add a link
Reference in a new issue