langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,2 @@
# Sys.ocaml_version;;
- : string = "3.10.2"

View 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)

View 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

View 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))

View 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;

View 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;

View file

@ -0,0 +1,4 @@
;;; Exit if version below 15.00
if pop_internal_version < 150000 then
sysexit()
endif;

View 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') =>

View 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

View 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

View 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

View file

@ -0,0 +1 @@
version ^strings'splitAtChar: . drop toNumber 3 < &bye ifTrue

View file

@ -0,0 +1 @@
build toNumber 1309798464 < &bye ifTrue

View 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

View file

@ -0,0 +1 @@
0 0 last [ dup @d->class &.integer = [ @d->xt @ + [ 1+ ] dip ] [ drop ] if ] ^types'LIST each@

View file

@ -0,0 +1 @@
Platform run: StartupArguments first ; ' --version'.

View 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]].

View 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

View file

@ -0,0 +1 @@
VERSION 101 > [ bye ] ifFalse

View file

@ -0,0 +1 @@
` VERSION FALSE = [ bye ] ifTrue

View file

@ -0,0 +1 @@
` bloop FALSE <> ` abs FALSE <> and [ ` bloop invoke @ ` abs invoke ] ifTrue

View 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.

View 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.