Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Special-variables/00-META.yaml
Normal file
5
Task/Special-variables/00-META.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
category:
|
||||
- Special variables
|
||||
from: http://rosettacode.org/wiki/Special_variables
|
||||
note: Basic language learning
|
||||
6
Task/Special-variables/00-TASK.txt
Normal file
6
Task/Special-variables/00-TASK.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Special variables have a predefined meaning within a computer programming language.
|
||||
|
||||
|
||||
;Task:
|
||||
List the special variables used within the language.
|
||||
<br><br>
|
||||
56
Task/Special-variables/ALGOL-68/special-variables-1.alg
Normal file
56
Task/Special-variables/ALGOL-68/special-variables-1.alg
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/usr/local/bin/a68g --script #
|
||||
|
||||
FORMAT f = $g": ["g"]"l$;
|
||||
|
||||
printf((f,
|
||||
"pi", pi,
|
||||
"random", random, # actually a procedure #
|
||||
|
||||
"flip", flip,
|
||||
"flop", flop,
|
||||
"TRUE", TRUE,
|
||||
"FALSE", FALSE,
|
||||
|
||||
"error char", error char,
|
||||
"null character", null character,
|
||||
CO "NIL", NIL, NIL is not printable END CO
|
||||
|
||||
# "lengths" details how many distinctive precisions are permitted. #
|
||||
# e.g. int length = 3 suggests 3 distincts types: #
|
||||
# INT, LONG INT, and LONG LONG INT #
|
||||
"bits shorths", bits shorths,
|
||||
"bits lengths", bits lengths,
|
||||
"bytes shorths", bytes shorths,
|
||||
"bytes lengths", bytes lengths,
|
||||
"int shorths", int shorths,
|
||||
"int lengths", int lengths,
|
||||
"real shorths", real shorths,
|
||||
"real lengths", real lengths,
|
||||
|
||||
"max abs char", max abs char,
|
||||
# short/long int/real also possible #
|
||||
"max int", max int,
|
||||
"small real", small real,
|
||||
"max real", max real,
|
||||
|
||||
# "width" indicates how many characters are require to prepresent the value #
|
||||
# short/long bits/bytes/int/real also possible #
|
||||
"bits width", bits width,
|
||||
"bytes width", bytes width,
|
||||
"int width", int width,
|
||||
"real width", real width,
|
||||
"exp width", exp width
|
||||
));
|
||||
|
||||
# ALL the following are actually procedures #
|
||||
print((
|
||||
"space: [", space, "]", new line,
|
||||
"new line: [", new line, "]", new line,
|
||||
"new page: [", new page, "]", new line
|
||||
CO the following are standard, but not implemented in algol68g
|
||||
"char number: [", char number, "]", new line,
|
||||
"line number: [", line number, "]", new line,
|
||||
"page number: [", page number, "]", new line
|
||||
END CO
|
||||
));
|
||||
SKIP
|
||||
115
Task/Special-variables/ALGOL-68/special-variables-2.alg
Normal file
115
Task/Special-variables/ALGOL-68/special-variables-2.alg
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
#!/usr/local/bin/a68g --script #
|
||||
|
||||
printf(($g": [", g, "] & [",g,"]"l$,
|
||||
"Math constants", "long","long long",
|
||||
"pi", long pi, long long pi,
|
||||
"Physical Constants", "mksa","cgs",
|
||||
"Fundamental constants", "mksa","cgs",
|
||||
" speed of light", mksa speed of light, cgs speed of light,
|
||||
" vacuum permeability", mksa vacuum permeability, "~", # cgs vacuum permeability,#
|
||||
" vacuum permittivity", mksa vacuum permittivity, "~", # cgs vacuum permittivity,#
|
||||
" num avogadro", num avogadro,"~",
|
||||
" faraday", mksa faraday, cgs faraday,
|
||||
" boltzmann", mksa boltzmann, cgs boltzmann,
|
||||
" molar gas", mksa molar gas, cgs molar gas,
|
||||
" standard gas volume", mksa standard gas volume, cgs standard gas volume,
|
||||
" planck constant", mksa planck constant, cgs planck constant,
|
||||
" planck constant bar", mksa planck constant bar, cgs planck constant bar,
|
||||
" gauss", mksa gauss, cgs gauss,
|
||||
" micron", mksa micron, cgs micron,
|
||||
" hectare", mksa hectare, cgs hectare,
|
||||
" miles per hour", mksa miles per hour, cgs miles per hour,
|
||||
" kilometers per hour", mksa kilometers per hour, cgs kilometers per hour,
|
||||
"Astronomy and astrophysics", "mksa","cgs",
|
||||
" astronomical unit", mksa astronomical unit, cgs astronomical unit,
|
||||
" gravitational constant", mksa gravitational constant, cgs gravitational constant,
|
||||
" light year", mksa light year, cgs light year,
|
||||
" parsec", mksa parsec, cgs parsec,
|
||||
" grav accel", mksa grav accel, cgs grav accel,
|
||||
" solar mass", mksa solar mass, cgs solar mass,
|
||||
"Atomic and nuclear physics", "mksa","cgs",
|
||||
" electron charge", mksa electron charge, cgs electron charge,
|
||||
" electron volt", mksa electron volt, cgs electron volt,
|
||||
" unified atomic mass", mksa unified atomic mass, cgs unified atomic mass,
|
||||
" mass electron", mksa mass electron, cgs mass electron,
|
||||
" mass muon", mksa mass muon, cgs mass muon,
|
||||
" mass proton", mksa mass proton, cgs mass proton,
|
||||
" mass neutron", mksa mass neutron, cgs mass neutron,
|
||||
" num fine structure", num fine structure,"~",
|
||||
" rydberg", mksa rydberg, cgs rydberg,
|
||||
" bohr radius", mksa bohr radius, cgs bohr radius,
|
||||
" angstrom", mksa angstrom, cgs angstrom,
|
||||
" barn", mksa barn, cgs barn,
|
||||
" bohr magneton", mksa bohr magneton, cgs bohr magneton,
|
||||
" nuclear magneton", mksa nuclear magneton, cgs nuclear magneton,
|
||||
" electron magnetic moment", mksa electron magnetic moment, cgs electron magnetic moment,
|
||||
" proton magnetic moment", mksa proton magnetic moment, cgs proton magnetic moment,
|
||||
"Time", "mksa","cgs",
|
||||
" minute", mksa minute, cgs minute,
|
||||
" hour", mksa hour, cgs hour,
|
||||
" day", mksa day, cgs day,
|
||||
" week", mksa week, cgs week,
|
||||
"Imperial units", "mksa","cgs",
|
||||
" inch", mksa inch, cgs inch,
|
||||
" foot", mksa foot, cgs foot,
|
||||
" yard", mksa yard, cgs yard,
|
||||
" mile", mksa mile, cgs mile,
|
||||
" mil", mksa mil, cgs mil,
|
||||
"Nautical units", "mksa","cgs",
|
||||
" nautical mile", mksa nautical mile, cgs nautical mile,
|
||||
" fathom", mksa fathom, cgs fathom,
|
||||
" knot", mksa knot, cgs knot,
|
||||
"Volume", "mksa","cgs",
|
||||
" acre", mksa acre, cgs acre,
|
||||
" liter", mksa liter, cgs liter,
|
||||
" us gallon", mksa us gallon, cgs us gallon,
|
||||
" canadian gallon", mksa canadian gallon, cgs canadian gallon,
|
||||
" uk gallon", mksa uk gallon, cgs uk gallon,
|
||||
" quart", mksa quart, cgs quart,
|
||||
" pint", mksa pint, cgs pint,
|
||||
"Mass and weight", "mksa","cgs",
|
||||
" pound mass", mksa pound mass, cgs pound mass,
|
||||
" ounce mass", mksa ounce mass, cgs ounce mass,
|
||||
" ton", mksa ton, cgs ton,
|
||||
" metric ton", mksa metric ton, cgs metric ton,
|
||||
" uk ton", mksa uk ton, cgs uk ton,
|
||||
" troy ounce", mksa troy ounce, cgs troy ounce,
|
||||
" carat", mksa carat, cgs carat,
|
||||
" gram force", mksa gram force, cgs gram force,
|
||||
" pound force", mksa pound force, cgs pound force,
|
||||
" kilopound force", mksa kilopound force, cgs kilopound force,
|
||||
" poundal", mksa poundal, cgs poundal,
|
||||
"Thermal energy and power", "mksa","cgs",
|
||||
" calorie", mksa calorie, cgs calorie,
|
||||
" btu", mksa btu, cgs btu,
|
||||
" therm", mksa therm, cgs therm,
|
||||
" horsepower", mksa horsepower, cgs horsepower,
|
||||
"Pressure", "mksa","cgs",
|
||||
" bar", mksa bar, cgs bar,
|
||||
" std atmosphere", mksa std atmosphere, cgs std atmosphere,
|
||||
" torr", mksa torr, cgs torr,
|
||||
" meter of mercury", mksa meter of mercury, cgs meter of mercury,
|
||||
" inch of mercury", mksa inch of mercury, cgs inch of mercury,
|
||||
" inch of water", mksa inch of water, cgs inch of water,
|
||||
" psi", mksa psi, cgs psi,
|
||||
"Viscosity", "mksa","cgs",
|
||||
" poise", mksa poise, cgs poise,
|
||||
" stokes", mksa stokes, cgs stokes,
|
||||
"Light and illumination", "mksa","cgs",
|
||||
" stilb", mksa stilb, cgs stilb,
|
||||
" lumen", mksa lumen, cgs lumen,
|
||||
" lux", mksa lux, cgs lux,
|
||||
" phot", mksa phot, cgs phot,
|
||||
" footcandle", mksa footcandle, cgs footcandle,
|
||||
" lambert", mksa lambert, cgs lambert,
|
||||
" footlambert", mksa footlambert, cgs footlambert,
|
||||
"Radioactivity", "mksa","cgs",
|
||||
" curie", mksa curie, cgs curie,
|
||||
" roentgen", mksa roentgen, cgs roentgen,
|
||||
" rad", mksa rad, cgs rad,
|
||||
"Force and energy", "mksa","cgs",
|
||||
" newton", mksa newton, cgs newton,
|
||||
" dyne", mksa dyne, cgs dyne,
|
||||
" joule", mksa joule, cgs joule,
|
||||
" erg", mksa erg, cgs erg
|
||||
))
|
||||
45
Task/Special-variables/ALGOL-W/special-variables.alg
Normal file
45
Task/Special-variables/ALGOL-W/special-variables.alg
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
% the Algol W standard environment includes the following standard variables: %
|
||||
|
||||
integer I_W % field width for integer output %
|
||||
integer R_W % field width for real output %
|
||||
integer R_D % number of decimal places for real output %
|
||||
string(1) R_FORMAT % format for real output:
|
||||
S - "scaled" normalised mantissa with exponent
|
||||
A - "aligned" fixed point format
|
||||
F - "free" either scaled or aligned as appropriate
|
||||
for the value and field width
|
||||
%
|
||||
integer S_W % separator width - number of spaces following non-string output items %
|
||||
integer MAXINTEGER % largest integer value %
|
||||
real EPSILON % largest positive real number such that 1 + epsilon = 1 %
|
||||
long real LONGEPSILON % largest positive long real number such that 1 + longepsilon = 1 %
|
||||
long real MAXREAL % largest real number %
|
||||
long real PI % approximation to pi %
|
||||
|
||||
% the following reference(EXCEPTION) variables control how errors are handled:
|
||||
ENDFILE - end-of-file
|
||||
OVFL - overflow
|
||||
UNFL - underflow
|
||||
DIVZERO - division by zero
|
||||
INTOVFL - integer overflow
|
||||
INTDIVZERO - integer division by zero or modulo 0
|
||||
SQRTERR - invalid SQRT parameter
|
||||
EXPERR - invalid EXP parameter
|
||||
LNLOGERR - invalid LN or LOG parameter
|
||||
SINCOSERR - invalid SIN or COS parameter
|
||||
|
||||
The EXCEPTION record is defined as follows:
|
||||
|
||||
record EXCEPTION( logical XCPNOTED - true if the exception has occurred
|
||||
; integer XCPLIMIT - number of times the exception can occur
|
||||
before the program terminates
|
||||
, XCPACTION - if the program continues, controls how to
|
||||
replace the erroneous value
|
||||
; logical XCPMARK - true if an error message should be printed
|
||||
even if the program continues
|
||||
; string(64) XCPMSG - message to describe the exception
|
||||
)
|
||||
|
||||
if the relevant EXCEPTION variable is null, the exception is ignored,
|
||||
otherwise it is processed according to the settings of XCPLIMIT etc.
|
||||
%
|
||||
25
Task/Special-variables/C++/special-variables.cpp
Normal file
25
Task/Special-variables/C++/special-variables.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include <iostream>
|
||||
|
||||
struct SpecialVariables
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
SpecialVariables& operator++()
|
||||
{
|
||||
// 'this' is a special variable that is a pointer to the current
|
||||
// class instance. It can optionally be used to refer to elements
|
||||
// of the class.
|
||||
this->i++; // has the same meaning as 'i++'
|
||||
|
||||
// returning *this lets the object return a reference to itself
|
||||
return *this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
SpecialVariables sv;
|
||||
auto sv2 = ++sv; // makes a copy of sv after it was incremented
|
||||
std::cout << " sv :" << sv.i << "\n sv2:" << sv2.i << "\n";
|
||||
}
|
||||
1
Task/Special-variables/Clojure/special-variables.clj
Normal file
1
Task/Special-variables/Clojure/special-variables.clj
Normal file
|
|
@ -0,0 +1 @@
|
|||
(apply str (interpose " " (sort (filter #(.startsWith % "*") (map str (keys (ns-publics 'clojure.core)))))))
|
||||
12
Task/Special-variables/Common-Lisp/special-variables.lisp
Normal file
12
Task/Special-variables/Common-Lisp/special-variables.lisp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(defun special-variables ()
|
||||
(flet ((special-var-p (s)
|
||||
(and (char= (aref s 0) #\*)
|
||||
(find-if-not (lambda (x) (char= x #\*)) s)
|
||||
(char= (aref s (1- (length s))) #\*))))
|
||||
(let ((lst '()))
|
||||
(do-symbols (s (find-package 'cl))
|
||||
(when (special-var-p (symbol-name s))
|
||||
(push s lst)))
|
||||
lst)))
|
||||
|
||||
(format t "~a~%" (sort (special-variables) #'string<))
|
||||
4
Task/Special-variables/Dyalect/special-variables.dyalect
Normal file
4
Task/Special-variables/Dyalect/special-variables.dyalect
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
func Integer.Double() {
|
||||
this + this
|
||||
}
|
||||
print(8.Double())
|
||||
5
Task/Special-variables/Erlang/special-variables.erl
Normal file
5
Task/Special-variables/Erlang/special-variables.erl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
-module( special_variables ).
|
||||
|
||||
-export( [task/0] ).
|
||||
|
||||
task() -> ok.
|
||||
4
Task/Special-variables/Fortran/special-variables.f
Normal file
4
Task/Special-variables/Fortran/special-variables.f
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
INQUIRE(FILE = FILENAME(1:L),EXIST = EXIST, !Here we go. Does the file exist?
|
||||
1 ERR = 666,IOSTAT = IOSTAT) !Hopefully, named in good style, etc.
|
||||
IF (EXIST) THEN !So, does the named file already exist?
|
||||
...etc.
|
||||
16
Task/Special-variables/IS-BASIC/special-variables.basic
Normal file
16
Task/Special-variables/IS-BASIC/special-variables.basic
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
BLACK - The code of colour black.
|
||||
BLUE - The code of colour blue.
|
||||
CYAN - The code of colour cyan.
|
||||
DATE$ - The current date in the standard format.
|
||||
EXLINE - The number of the last statement that caused an exception.
|
||||
EXTYPE - The error code of the last exception.
|
||||
FREE - The amount of memory free and avaible to the current program.
|
||||
GREEN - The code of colour green.
|
||||
INF - The largest positive number that the IS-BASIC can handle.
|
||||
MAGENTA - The code of colour magenta.
|
||||
PI - Value of the Pi. This is rounded to 3.141592654
|
||||
RED - The code of colour red.
|
||||
TIME$ - The current time in the standard format.
|
||||
WHITE - The code of colour white.
|
||||
YELLOW - The code of colour yellow.
|
||||
VERNUM - Version number of the BASIC
|
||||
77
Task/Special-variables/Icon/special-variables.icon
Normal file
77
Task/Special-variables/Icon/special-variables.icon
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# &keyword # type returned(indicators) - brief description
|
||||
# indicators:
|
||||
# * - generates multiple values
|
||||
# = - modifiable
|
||||
# ? - may fail (e.g. status inquiry)
|
||||
# U - Unicon
|
||||
# G - Icon or Unicon with Graphics
|
||||
#
|
||||
&allocated # integer(*) - report memory allocated in total and by storage regions
|
||||
&ascii # cset - ASCII character set
|
||||
&clock # string - time of day
|
||||
&col # integer(=G) - column location of pointer
|
||||
&collections # integer(*) - garbage collection activity in total and by storage region
|
||||
&column # integer(U) - source code column
|
||||
&control # null(?G) - control key state
|
||||
&cset # cset - universal character set
|
||||
¤t # co-expression - current co-expression
|
||||
&date # string - today's date
|
||||
&dateline # string - time stamp
|
||||
&digits # cset - digit characters
|
||||
&dump # integer(=) - termination dump
|
||||
&e # real - natural log e
|
||||
&error # integer(=) - enable/disable error conversion/fail on error
|
||||
&errno # integer(?) - variable containing error number from previous posix command
|
||||
&errornumber # integer(?) - error number of last error converted to failure
|
||||
&errortext # string(?) - error message of last error converted to failure
|
||||
&errorvalue # any(?) - erroneous value of last error converted to failure
|
||||
&errout # file - standard error file
|
||||
&eventcode # integer(=U) - program execution event in monitored program
|
||||
&eventsource # co-expression(=U) - source of events in monitoring program
|
||||
&eventvalue # any(=U) - value from event in monitored program
|
||||
&fail # none - always fails
|
||||
&features # string(*) - identifying features in this version of Icon/Unicon
|
||||
&file # string - current source file
|
||||
&host # string - host machine name
|
||||
&input # file - standard input file
|
||||
&interval # integer(G) - time between input events
|
||||
&lcase # cset - lowercase letters
|
||||
&ldrag # integer(G) - left button drag
|
||||
&letters # cset - letters
|
||||
&level # integer - call depth
|
||||
&line # integer - current source line number
|
||||
&lpress # integer(G) - left button press
|
||||
&lrelease # integer(G) - left button release
|
||||
&main # co-expression - main task
|
||||
&mdrag # integer(G) - middle button drag
|
||||
&meta # null(?G) - meta key state
|
||||
&mpress # integer(G) - middle button press
|
||||
&mrelease # integer(G) - middle button release
|
||||
&now # integer(U) - current time
|
||||
&null # null - null value
|
||||
&output # file - standard output file
|
||||
&pick # string (U) - variable containing the result of 3D selection
|
||||
&phi # real - golden ratio
|
||||
&pos # integer(=) - string scanning position
|
||||
&progname # string(=) - program name
|
||||
&random # integer(=) - random number seed
|
||||
&rdrag # integer(G) - right button drag
|
||||
®ions # integer(*) - region sizes
|
||||
&resize # integer(G) - window resize
|
||||
&row # integer(=G) - row location of pointer
|
||||
&rpress # integer(G) - right button press
|
||||
&rrelease # integer(G) - right button release
|
||||
&shift # null(?G) - shift key state
|
||||
&source # co-expression - invoking co-expression
|
||||
&storage # integer(*) - memory in use in each region
|
||||
&subject # string - string scanning subject
|
||||
&syserr # integer - halt on system error
|
||||
&time # integer(=) - elapsed time in milliseconds
|
||||
&trace # integer(=) - trace program
|
||||
&ucase # cset - upper case letters
|
||||
&version # string - version
|
||||
&window # window(=G) - the current graphics rendering window
|
||||
&x # integer(=G) - pointer horizontal position
|
||||
&y # integer(=G) - pointer vertical position
|
||||
# keywords may also fail if the corresponding feature is not present.
|
||||
# Other variants of Icon (e.g. MT-Icon) will have different mixes of keywords.
|
||||
16
Task/Special-variables/J/special-variables.j
Normal file
16
Task/Special-variables/J/special-variables.j
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{{ y }} 1
|
||||
1
|
||||
1000 {{ x + y }} 1
|
||||
1001
|
||||
100 {{ m + y }} 1
|
||||
101
|
||||
(1000) 100 {{ x + m + y }} 1
|
||||
1101
|
||||
100 {{ m + n + y }} 10 (1)
|
||||
111
|
||||
(1000) 100 {{ x + m + n + y }} 10 (1)
|
||||
1111
|
||||
(1000) + {{ x u n u y }} 10 (1)
|
||||
1011
|
||||
(1000) 100 {{ x v m v y }} + (1)
|
||||
1101
|
||||
1
Task/Special-variables/Java/special-variables-1.java
Normal file
1
Task/Special-variables/Java/special-variables-1.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
Object object = null
|
||||
1
Task/Special-variables/Java/special-variables-2.java
Normal file
1
Task/Special-variables/Java/special-variables-2.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
boolean value = true
|
||||
1
Task/Special-variables/Java/special-variables-3.java
Normal file
1
Task/Special-variables/Java/special-variables-3.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
this.object
|
||||
1
Task/Special-variables/Java/special-variables-4.java
Normal file
1
Task/Special-variables/Java/special-variables-4.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
super(value)
|
||||
1
Task/Special-variables/Java/special-variables-5.java
Normal file
1
Task/Special-variables/Java/special-variables-5.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
import static java.lang.Math.*;
|
||||
1
Task/Special-variables/Java/special-variables-6.java
Normal file
1
Task/Special-variables/Java/special-variables-6.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
double area = PI * (2 * 2);
|
||||
1
Task/Special-variables/Java/special-variables-7.java
Normal file
1
Task/Special-variables/Java/special-variables-7.java
Normal file
|
|
@ -0,0 +1 @@
|
|||
public static void main(String[] args)
|
||||
30
Task/Special-variables/Java/special-variables-8.java
Normal file
30
Task/Special-variables/Java/special-variables-8.java
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import java.util.Arrays;
|
||||
|
||||
public class SpecialVariables {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//String-Array args contains the command line parameters passed to the program
|
||||
//Note that the "Arrays.toString()"-call is just used for pretty-printing
|
||||
System.out.println(Arrays.toString(args));
|
||||
|
||||
//<Classname>.class might qualify as a special variable, since it always contains a Class<T>-object that
|
||||
//is used in Reflection
|
||||
System.out.println(SpecialVariables.class);
|
||||
|
||||
|
||||
//The following are not really "variables", since they are properly encapsulated:
|
||||
|
||||
//System.getenv() returns a String-String-Map of environment-variables
|
||||
System.out.println(System.getenv());
|
||||
|
||||
//System.getProperties() returns a Map of "things somebody might want to know", including OS and architecture
|
||||
// the Java VM runs on, various paths like home direcoty of the user that runs the program, class (library) paths,
|
||||
System.out.println(System.getProperties());
|
||||
|
||||
//Runtime.getRuntime() returns a Runtime-Object that contains "changing" data about the running Java VM's
|
||||
// environment, like available processor cores or available RAM
|
||||
System.out.println(Runtime.getRuntime().availableProcessors());
|
||||
|
||||
}
|
||||
}
|
||||
5
Task/Special-variables/JavaScript/special-variables-1.js
Normal file
5
Task/Special-variables/JavaScript/special-variables-1.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var obj = {
|
||||
foo: 1,
|
||||
bar: function () { return this.foo; }
|
||||
};
|
||||
obj.bar(); // returns 1
|
||||
8
Task/Special-variables/JavaScript/special-variables-2.js
Normal file
8
Task/Special-variables/JavaScript/special-variables-2.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
function concat() {
|
||||
var s = "";
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
s += arguments[i];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
concat("a", "b", "c"); // returns "abc"
|
||||
2
Task/Special-variables/Jq/special-variables.jq
Normal file
2
Task/Special-variables/Jq/special-variables.jq
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$ jq -n -M --arg x 1 '$x|type' # (*)
|
||||
"string"
|
||||
1
Task/Special-variables/Julia/special-variables.julia
Normal file
1
Task/Special-variables/Julia/special-variables.julia
Normal file
|
|
@ -0,0 +1 @@
|
|||
join(sort(filter(sym -> let n=eval(sym); !(isa(n, Function) || isa(n, Type) || isa(n, Module)); end, names(Base))), ", ")
|
||||
24
Task/Special-variables/Kotlin/special-variables.kotlin
Normal file
24
Task/Special-variables/Kotlin/special-variables.kotlin
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// version 1.0.6
|
||||
|
||||
class President(val name: String) {
|
||||
var age: Int = 0
|
||||
set(value) {
|
||||
if (value in 0..125) field = value // assigning to backing field here
|
||||
else throw IllegalArgumentException("$name's age must be between 0 and 125")
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val pres = President("Donald")
|
||||
pres.age = 69
|
||||
val pres2 = President("Jimmy")
|
||||
pres2.age = 91
|
||||
val presidents = mutableListOf(pres, pres2)
|
||||
presidents.forEach {
|
||||
it.age++ // 'it' is implicit sole parameter of lambda expression
|
||||
println("President ${it.name}'s age is currently ${it.age}")
|
||||
}
|
||||
println()
|
||||
val pres3 = President("Theodore")
|
||||
pres3.age = 158
|
||||
}
|
||||
1
Task/Special-variables/Lasso/special-variables-1.lasso
Normal file
1
Task/Special-variables/Lasso/special-variables-1.lasso
Normal file
|
|
@ -0,0 +1 @@
|
|||
{return #1 + ':'+#2}('a','b') // a:b
|
||||
2
Task/Special-variables/Lasso/special-variables-2.lasso
Normal file
2
Task/Special-variables/Lasso/special-variables-2.lasso
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
define test(a,b) => #1+':'+#2
|
||||
test('y','z') // y:z
|
||||
|
|
@ -0,0 +1 @@
|
|||
put the constantNames
|
||||
|
|
@ -0,0 +1 @@
|
|||
the colornames
|
||||
1
Task/Special-variables/Lua/special-variables.lua
Normal file
1
Task/Special-variables/Lua/special-variables.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
for n in pairs(_G) do print(n) end
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
Module Checkit {
|
||||
Let inkey$="hello", dir$="Something Else"
|
||||
\\ using a dot we tell to interpreter to skip internal identifiers,
|
||||
\\ and look for user variables
|
||||
Print .inkey$="hello", .dir$="Something Else"
|
||||
|
||||
Print dir$ ' return current path
|
||||
do
|
||||
Print "wait to press space"
|
||||
Until inkey$=" "
|
||||
}
|
||||
Checkit
|
||||
Module check2 {
|
||||
Global inkey$="ok"
|
||||
Print .inkey$="ok"
|
||||
}
|
||||
check2
|
||||
|
||||
Module Check3 {
|
||||
Group A {
|
||||
Module Check3 {
|
||||
\\ using a dot before the name
|
||||
.inkey$="ok"
|
||||
Print .inkey$="ok"
|
||||
}
|
||||
}
|
||||
A.Check3
|
||||
}
|
||||
Check3
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
li $t0,0x4500
|
||||
li $t1,0xFFFF
|
||||
multu $t0,$t1 ;unsigned multiplication of $t0 and $t1
|
||||
mfhi $t0 ;load the top 32 bits of the product into $t0
|
||||
mflo $t1 ;load the bottom 32 bits of the product into $t1
|
||||
32
Task/Special-variables/ML-I/special-variables-1.mli
Normal file
32
Task/Special-variables/ML-I/special-variables-1.mli
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
MCSKIP "WITH" NL
|
||||
"" Special variables
|
||||
"" There are four different kinds of variables in ML/I.
|
||||
"" Permanent (P) variables - these have no special predefined values.
|
||||
"" Character (C) variables - these have no special predefined values.
|
||||
"" Temporary (T) variables - a macro has at least three of these, and
|
||||
"" those have predefined values.
|
||||
"" System (S) variables - these are for control and status. The number
|
||||
"" of these is implementation dependent.
|
||||
MCSKIP MT,<>
|
||||
MCINS %.
|
||||
MCDEF TVARDEMO , NL
|
||||
AS <T-variables are local to the current macro call
|
||||
T1 is the number of arguments to current macro call - value is %T1.
|
||||
T2 is the number of macro calls so far - value is %T2.
|
||||
T3 is the current depth of nesting - value is %T3.
|
||||
>
|
||||
TVARDEMO xxx,yyy
|
||||
|
||||
MCDEF SVARDEMO WITHS NL
|
||||
AS <The first nine S-variables are implementation independent
|
||||
S1 controls startline insertion - value is %S1.
|
||||
S2 is the current source text line number - value is %S2.
|
||||
S3 controls error messages related to warning markers - value is %S3.
|
||||
S4 controls context printout after a <MCNOTE> - value is %S4.
|
||||
S5 is the count of processing errors - value is %S5.
|
||||
S6 enables the definition of an atom to be changed - value is %S6.
|
||||
S7, S8 and S9 are currently unused.
|
||||
|
||||
All other S-variables have implementation defined meanings.
|
||||
>
|
||||
SVARDEMO
|
||||
15
Task/Special-variables/ML-I/special-variables-2.mli
Normal file
15
Task/Special-variables/ML-I/special-variables-2.mli
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
T-variables are local to the current macro call
|
||||
T1 is the number of arguments to current macro call - value is 2
|
||||
T2 is the number of macro calls so far - value is 5
|
||||
T3 is the current depth of nesting - value is 1
|
||||
|
||||
The first nine S-variables are implementation independent
|
||||
S1 controls startline insertion - value is 0
|
||||
S2 is the current source text line number - value is 32
|
||||
S3 controls error messages related to warning markers - value is 0
|
||||
S4 controls context printout after a MCNOTE - value is 0
|
||||
S5 is the count of processing errors - value is 0
|
||||
S6 enables the definition of an atom to be changed - value is -1
|
||||
S7, S8 and S9 are currently unused.
|
||||
|
||||
All other S-variables have implementation defined meanings.
|
||||
45
Task/Special-variables/Mathematica/special-variables.math
Normal file
45
Task/Special-variables/Mathematica/special-variables.math
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
Grid[Partition[Names["$*"],4]]
|
||||
->
|
||||
$Aborted $ActivationGroupID $ActivationKey $ActivationUserRegistered
|
||||
$AddOnsDirectory $AllowDataUpdates $AllowDocumentationUpdates $AllowInternet
|
||||
$AssertFunction $Assumptions $BaseDirectory $BatchInput
|
||||
$BatchOutput $BoxForms $ByteOrdering $Canceled
|
||||
$CharacterEncoding $CharacterEncodings $CommandLine $CompilationTarget
|
||||
$ConditionHold $ConfiguredKernels $Context $ContextPath
|
||||
$ControlActiveSetting $CreationDate $CurrentLink $DateStringFormat
|
||||
$DefaultFont $DefaultFrontEnd $DefaultImagingDevice $DefaultPath
|
||||
$Display $DisplayFunction $DistributedContexts $DynamicEvaluation
|
||||
$Echo $Epilog $ExportFormats $Failed
|
||||
$FinancialDataSource $FormatType $FrontEnd $FrontEndSession
|
||||
$GeoLocation $HistoryLength $HomeDirectory $IgnoreEOF
|
||||
$ImagingDevices $ImportFormats $InitialDirectory $Input
|
||||
$InputFileName $Inspector $InstallationDate $InstallationDirectory
|
||||
$InstalledServices $InterfaceEnvironment $InternetProxyRules $IterationLimit
|
||||
$KernelCount $KernelID $Language $LaunchDirectory
|
||||
$LibraryPath $LicenseExpirationDate $LicenseID $LicenseProcesses
|
||||
$LicenseServer $LicenseSubprocesses $LicenseType $Line
|
||||
$Linked $LinkSupported $LoadedFiles $MachineAddresses
|
||||
$MachineDomain $MachineDomains $MachineEpsilon $MachineID
|
||||
$MachineName $MachinePrecision $MachineType $MaxExtraPrecision
|
||||
$MaxLicenseProcesses $MaxLicenseSubprocesses $MaxMachineNumber $MaxNumber
|
||||
$MaxPiecewiseCases $MaxPrecision $MaxRootDegree $MessageGroups
|
||||
$MessageList $MessagePrePrint $Messages $MinMachineNumber
|
||||
$MinNumber $MinorReleaseNumber $MinPrecision $ModuleNumber
|
||||
$NetworkLicense $NewMessage $NewSymbol $Notebooks
|
||||
$NumberMarks $Off $OperatingSystem $Output
|
||||
$OutputForms $OutputSizeLimit $Packages $PacletSite
|
||||
$ParentLink $ParentProcessID $PasswordFile $PatchLevelID
|
||||
$Path $PathnameSeparator $PerformanceGoal $PipeSupported
|
||||
$Post $Pre $PreferencesDirectory $PrePrint
|
||||
$PreRead $PrintForms $PrintLiteral $PrintServiceRequest
|
||||
$PrintServiceResponse $PrintShortErrorMessages $PrintWSDLDebug $ProcessID
|
||||
$ProcessorCount $ProcessorType $ProductInformation $ProgramName
|
||||
$RandomState $RecursionLimit $ReleaseNumber $RootDirectory
|
||||
$ScheduledTask $ScriptCommandLine $SessionID $SetParentLink
|
||||
$SharedFunctions $SharedVariables $SoundDisplay $SoundDisplayFunction
|
||||
$SuppressInputFormHeads $SynchronousEvaluation $SyntaxHandler $System
|
||||
$SystemCharacterEncoding $SystemID $SystemWordLength $TemporaryDirectory
|
||||
$TemporaryPrefix $TextStyle $TimedOut $TimeUnit
|
||||
$TimeZone $TopDirectory $TraceOff $TraceOn
|
||||
$TracePattern $TracePostAction $TracePreAction $Urgent
|
||||
$UserAddOnsDirectory $UserBaseDirectory $UserBasePacletsDirectory $UserDocumentsDirectory
|
||||
7
Task/Special-variables/Maxima/special-variables.maxima
Normal file
7
Task/Special-variables/Maxima/special-variables.maxima
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* There are many special variables in Maxima: more than 250 are used for options, for example */
|
||||
fpprec; /* precision for big floats */
|
||||
obase; /* number base for output */
|
||||
|
||||
/* Other variables are read-only, and give the list of user-defined variables, functions... */
|
||||
infolists; /* give the names of all available lists */
|
||||
[labels, values, functions, macros, arrays, myoptions, props, aliases, rules, gradefs, dependencies, let_rule_packages, structures]
|
||||
|
|
@ -0,0 +1 @@
|
|||
println dumpstack()
|
||||
34
Task/Special-variables/NetRexx/special-variables.netrexx
Normal file
34
Task/Special-variables/NetRexx/special-variables.netrexx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref savelog symbols binary
|
||||
|
||||
class RCSpecialVariables
|
||||
|
||||
method RCSpecialVariables()
|
||||
x = super.toString
|
||||
y = this.toString
|
||||
say '<super>'x'</super>'
|
||||
say '<this>'y'</this>'
|
||||
say '<class>'RCSpecialVariables.class'</class>'
|
||||
say '<digits>'digits'</digits>'
|
||||
say '<form>'form'</form>'
|
||||
say '<[1, 2, 3].length>'
|
||||
say [1, 2, 3].length
|
||||
say '</[1, 2, 3].length>'
|
||||
say '<null>'
|
||||
say null
|
||||
say '</null>'
|
||||
say '<source>'source'</source>'
|
||||
say '<sourceline>'sourceline'</sourceline>'
|
||||
say '<trace>'trace'</trace>'
|
||||
say '<version>'version'</version>'
|
||||
|
||||
say 'Type an answer:'
|
||||
say '<ask>'ask'</ask>'
|
||||
|
||||
return
|
||||
|
||||
method main(args = String[]) public static
|
||||
|
||||
RCSpecialVariables()
|
||||
|
||||
return
|
||||
2
Task/Special-variables/Nim/special-variables.nim
Normal file
2
Task/Special-variables/Nim/special-variables.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
result = value
|
||||
return
|
||||
38
Task/Special-variables/OCaml/special-variables-1.ocaml
Normal file
38
Task/Special-variables/OCaml/special-variables-1.ocaml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
val argv : string array
|
||||
(** The command line arguments given to the process.
|
||||
The first element is the command name used to invoke the program.
|
||||
The following elements are the command-line arguments
|
||||
given to the program. *)
|
||||
|
||||
val executable_name : string
|
||||
(** The name of the file containing the executable currently running. *)
|
||||
|
||||
val interactive : bool ref
|
||||
(** This reference is initially set to [false] in standalone
|
||||
programs and to [true] if the code is being executed under
|
||||
the interactive toplevel system [ocaml]. *)
|
||||
|
||||
val os_type : string
|
||||
(** Operating system currently executing the Caml program. One of
|
||||
- ["Unix"] (for all Unix versions, including Linux and Mac OS X),
|
||||
- ["Win32"] (for MS-Windows, OCaml compiled with MSVC++ or Mingw),
|
||||
- ["Cygwin"] (for MS-Windows, OCaml compiled with Cygwin). *)
|
||||
|
||||
val word_size : int
|
||||
(** Size of one word on the machine currently executing the Caml
|
||||
program, in bits: 32 or 64. *)
|
||||
|
||||
val max_string_length : int
|
||||
(** Maximum length of a string. *)
|
||||
|
||||
val max_array_length : int
|
||||
(** Maximum length of a normal array. The maximum length of a float
|
||||
array is [max_array_length/2] on 32-bit machines and
|
||||
[max_array_length] on 64-bit machines. *)
|
||||
|
||||
val ocaml_version : string
|
||||
(** [ocaml_version] is the version of Objective Caml.
|
||||
It is a string of the form ["major.minor[.patchlevel][+additional-info]"],
|
||||
where [major], [minor], and [patchlevel] are integers, and
|
||||
[additional-info] is an arbitrary string. The [[.patchlevel]] and
|
||||
[[+additional-info]] parts may be absent. *)
|
||||
15
Task/Special-variables/OCaml/special-variables-2.ocaml
Normal file
15
Task/Special-variables/OCaml/special-variables-2.ocaml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
val max_int : int
|
||||
(** The greatest representable integer. *)
|
||||
|
||||
val min_int : int
|
||||
(** The smallest representable integer. *)
|
||||
|
||||
val max_float : float
|
||||
(** The largest positive finite value of type [float]. *)
|
||||
|
||||
val min_float : float
|
||||
(** The smallest positive, non-zero, non-denormalized value of type [float]. *)
|
||||
|
||||
val epsilon_float : float
|
||||
(** The difference between [1.0] and the smallest exactly representable
|
||||
floating-point number greater than [1.0]. *)
|
||||
21
Task/Special-variables/PL-I/special-variables.pli
Normal file
21
Task/Special-variables/PL-I/special-variables.pli
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
Special variables in PL/I are termed "Pseudo-variables".
|
||||
They are used only on the LHS of an assignment statement.
|
||||
|
||||
They include:
|
||||
REAL to assign the real part of a COMPLEX variable;
|
||||
IMAG to assign the imaginary part of a COMPLEX variable;
|
||||
SUBSTR is used to assign part of a string (used on the LHS of an assignment);
|
||||
STRING when used on the left-hand of an assignment;
|
||||
UNSPEC used to assign a bit pattern to a variable;
|
||||
ENTRYADDR is used to assign an address to an ENTRY variable that is
|
||||
to be invoked;
|
||||
ONCHAR resets the current value of the CHAR built-in function (when
|
||||
a data conversion error occurs, and it is desired to re-attempt
|
||||
the conversion);
|
||||
ONSOURCE assigns a new value to the ONSOURCE built-in function
|
||||
(may be used when a data conversion error occurs,
|
||||
and a re-try of the conversion is to be attempted with modified data);
|
||||
ONGSOURCE assigns a new value to the ONGSOURCE built-in function
|
||||
(may be used when a data conversion error occurs,
|
||||
and may be used when a re-try of the conversion is to be
|
||||
attempted with modified data).
|
||||
4
Task/Special-variables/Pascal/special-variables-1.pas
Normal file
4
Task/Special-variables/Pascal/special-variables-1.pas
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
program foo(input, output);
|
||||
begin
|
||||
{ In this program, `input` and `output` have special meaning. }
|
||||
end.
|
||||
6
Task/Special-variables/Pascal/special-variables-2.pas
Normal file
6
Task/Special-variables/Pascal/special-variables-2.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
program foo(output);
|
||||
var
|
||||
input: integer;
|
||||
begin
|
||||
{ In this program only `output` has special meaning. }
|
||||
end.
|
||||
40
Task/Special-variables/PowerShell/special-variables-1.psh
Normal file
40
Task/Special-variables/PowerShell/special-variables-1.psh
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<#
|
||||
$$
|
||||
$?
|
||||
$^
|
||||
$_
|
||||
$Args
|
||||
$ConsoleFileName
|
||||
$Error
|
||||
$Event
|
||||
$EventSubscriber
|
||||
$ExecutionContext
|
||||
$False
|
||||
$ForEach
|
||||
$Home
|
||||
$Host
|
||||
$Input
|
||||
$LastExitCode
|
||||
$Matches
|
||||
$MyInvocation
|
||||
$NestedPromptLevel
|
||||
$NULL
|
||||
$PID
|
||||
$Profile
|
||||
$PSBoundParameters
|
||||
$PsCmdlet
|
||||
$PsCulture
|
||||
$PSDebugContext
|
||||
$PsHome
|
||||
$PSitem
|
||||
$PSScriptRoot
|
||||
$PsUICulture
|
||||
$PsVersionTable
|
||||
$Pwd
|
||||
$Sender
|
||||
$ShellID
|
||||
$SourceArgs
|
||||
$SourceEventArgs
|
||||
$This
|
||||
$True
|
||||
#>
|
||||
|
|
@ -0,0 +1 @@
|
|||
help about_automatic_variables
|
||||
2
Task/Special-variables/Python/special-variables.py
Normal file
2
Task/Special-variables/Python/special-variables.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
names = sorted((set(globals().keys()) | set(__builtins__.__dict__.keys())) - set('_ names i'.split()))
|
||||
print( '\n'.join(' '.join(names[i:i+8]) for i in range(0, len(names), 8)) )
|
||||
29
Task/Special-variables/REXX/special-variables-1.rexx
Normal file
29
Task/Special-variables/REXX/special-variables-1.rexx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*REXX program demonstrates REXX special variables: RC, RESULT, SIGL */
|
||||
/*line two. */
|
||||
/*line three.*/ say copies('═',79)
|
||||
rc=1/3 /*line four. */
|
||||
signal youWho /*line five. */
|
||||
myLoo='this got skipped' /*line six. */
|
||||
youwho: /*line seven.*/
|
||||
sep=copies('─', 9) /*line eight.*/
|
||||
say sep 'SIGL=' sigl /*line nine. */
|
||||
say sep 'REXX source statement' SIGL '=' sourceline(sigl)
|
||||
say copies('═',79)
|
||||
g=44
|
||||
call halve g
|
||||
say sep 'rc=' rc
|
||||
say sep 'result=' result
|
||||
say copies('═',79)
|
||||
h=66
|
||||
hh=halve(h)
|
||||
say sep 'rc=' rc
|
||||
say sep 'result=' result
|
||||
say sep 'hh=' hh
|
||||
say copies('═',79)
|
||||
'DIR /ad /b' /*display the directories (Bare).*/
|
||||
say sep 'rc=' rc
|
||||
say sep 'result=' result
|
||||
say copies('═',79)
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────HALVE subroutine────────────────────*/
|
||||
halve: return arg(1) / 2 /*a simple halving function. */
|
||||
23
Task/Special-variables/REXX/special-variables-2.rexx
Normal file
23
Task/Special-variables/REXX/special-variables-2.rexx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
'dir a2.txt'
|
||||
Say 'rc='rc
|
||||
'dir 33.*'
|
||||
Say 'rc='rc
|
||||
|
||||
Call square 5
|
||||
Say 'RESULT='result
|
||||
Say 'SIGL='sigl
|
||||
|
||||
x2=square(3) /* just a simle example */
|
||||
Say '3**2='||x2
|
||||
|
||||
Signal On Novalue
|
||||
x=y /* y was not yet assigned a value */
|
||||
|
||||
Exit
|
||||
square: Procedure Expose sigl
|
||||
Say 'square was invoked from line' sigl':' sourceline(sigl)
|
||||
Return arg(1)**2
|
||||
|
||||
Novalue:
|
||||
Say 'NOVALUE encountered in line' sigl':' sourceline(sigl)
|
||||
Exit
|
||||
5
Task/Special-variables/Raku/special-variables-1.raku
Normal file
5
Task/Special-variables/Raku/special-variables-1.raku
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
$foo scalar (object)
|
||||
@foo ordered array
|
||||
%foo unordered hash (associative array)
|
||||
&foo code/rule/token/regex
|
||||
::foo package/module/class/role/subset/enum/type/grammar
|
||||
10
Task/Special-variables/Raku/special-variables-2.raku
Normal file
10
Task/Special-variables/Raku/special-variables-2.raku
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
$foo # ordinary scoping
|
||||
$.foo # object attribute public accessor
|
||||
$^foo # self-declared formal positional parameter
|
||||
$:foo # self-declared formal named parameter
|
||||
$*foo # dynamically overridable global variable
|
||||
$?foo # compiler hint variable
|
||||
$=foo # POD variable
|
||||
$<foo> # match variable, short for $/{'foo'}
|
||||
$!foo # object attribute private storage
|
||||
$~foo # the foo sublanguage seen by the parser at this lexical spot
|
||||
45
Task/Special-variables/Raku/special-variables-3.raku
Normal file
45
Task/Special-variables/Raku/special-variables-3.raku
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Lexical variables
|
||||
|
||||
$_ # implicit variable lexically scoped to the current block
|
||||
$! # current Exception object
|
||||
$/ # last match
|
||||
$0, $1, $2... # captured values from match: $/[0], $/[1], $/[2] ...
|
||||
|
||||
# Compile-time variables
|
||||
|
||||
$?PACKAGE # current package
|
||||
$?CLASS # current class
|
||||
$?MODULE # current module
|
||||
$?ROLE # current role
|
||||
$?DISTRIBUTION # which OS distribution am I compiling under
|
||||
$?FILE # current filename of source file
|
||||
$?LINE # current line number in source file
|
||||
&?ROUTINE # current sub or method (itself)
|
||||
&?BLOCK # current block (itself)
|
||||
|
||||
# Dynamic variables
|
||||
|
||||
$*USAGE # value of the auto-generated USAGE message
|
||||
$*PROGRAM-NAME # path to the current executable
|
||||
$*PROGRAM # location (in the form of an IO::Path object) of the Raku program being executed
|
||||
@*ARGS # command-line arguments
|
||||
$*ARGFILES # the magic command-line input handle
|
||||
$*CWD # current working directory
|
||||
$*DISTRO # which OS distribution am I running under
|
||||
%*ENV # system environment variables
|
||||
$*ERR # standard error handle
|
||||
$*EXECUTABLE-NAME # name of the Raku executable that is currently running
|
||||
$*EXECUTABLE # IO::Path absolute path of the Raku executable that is currently running
|
||||
$*IN # standard input handle; is an IO object
|
||||
$*KERNEL # operating system running under
|
||||
$*OUT # standard output handle
|
||||
$*RAKU # Raku version running under
|
||||
$*PID # system process id
|
||||
$*TZ # local time zone
|
||||
$*USER # system user id
|
||||
|
||||
# Run-time variables
|
||||
|
||||
$*COLLATION # object that can be used to configure Unicode collation levels
|
||||
$*TOLERANCE # used by the =~= operator to decide if two values are approximately equal
|
||||
$*DEFAULT-READ-ELEMS # affects the number of bytes read by default by IO::Handle.read
|
||||
3
Task/Special-variables/Raku/special-variables-4.raku
Normal file
3
Task/Special-variables/Raku/special-variables-4.raku
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
* # A standalone term that has no fixed value, instead it captures the notion of "Whatever",
|
||||
# the meaning of which is decided lazily by whatever it is an argument to.
|
||||
# See the docs on Whatever: https://docs.raku.org/type/Whatever
|
||||
1
Task/Special-variables/Smalltalk/special-variables-1.st
Normal file
1
Task/Special-variables/Smalltalk/special-variables-1.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
Smalltalk keys
|
||||
1
Task/Special-variables/Smalltalk/special-variables-2.st
Normal file
1
Task/Special-variables/Smalltalk/special-variables-2.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
Float precision
|
||||
1
Task/Special-variables/Smalltalk/special-variables-3.st
Normal file
1
Task/Special-variables/Smalltalk/special-variables-3.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
Smalltalk version
|
||||
15
Task/Special-variables/Ursa/special-variables.ursa
Normal file
15
Task/Special-variables/Ursa/special-variables.ursa
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# contains arguments passed to the ursa
|
||||
# interpreter on the command line
|
||||
string<> args
|
||||
|
||||
# iodevice that points to the console by default
|
||||
iodevice console
|
||||
|
||||
# contains "\n"
|
||||
string endl
|
||||
|
||||
# represents false
|
||||
boolean false
|
||||
|
||||
# represents true
|
||||
boolean true
|
||||
23
Task/Special-variables/Wren/special-variables.wren
Normal file
23
Task/Special-variables/Wren/special-variables.wren
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
class Parent {
|
||||
construct new(name) {
|
||||
_name = name
|
||||
}
|
||||
|
||||
name { _name }
|
||||
}
|
||||
|
||||
class Child is Parent {
|
||||
construct new(name, parentName) {
|
||||
_name = name
|
||||
super(parentName) // call parent's constructor
|
||||
}
|
||||
|
||||
name { _name } // overrides Parent's name method
|
||||
|
||||
printNames() {
|
||||
System.print("My name is %(this.name) and my parent's name is %(super.name).")
|
||||
}
|
||||
}
|
||||
|
||||
var c = Child.new("John", "Fred")
|
||||
c.printNames()
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
org &0066
|
||||
|
||||
NMI_HANDLER: ;this label is optional, the CPU doesn't need it to know how to jump here.
|
||||
retn ;in this example, the NMI routine will immediately return without doing anything.
|
||||
|
|
@ -0,0 +1 @@
|
|||
ld a,r ;read from the refresh register.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
10 PRINT "The border colour is "; PEEK (23624): REM bordcr
|
||||
20 PRINT "The ramtop address is "; PEEK (23730) + 256 * PEEK (23731): REM ramtop
|
||||
30 POKE 23609,50: REM set keyboard pip to 50
|
||||
1
Task/Special-variables/Zkl/special-variables.zkl
Normal file
1
Task/Special-variables/Zkl/special-variables.zkl
Normal file
|
|
@ -0,0 +1 @@
|
|||
__DATE__, __DEBUG__, __FILE__, __LINE__, __NAME__, __TIME__
|
||||
Loading…
Add table
Add a link
Reference in a new issue