Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -25,7 +25,8 @@ void main() {
|
|||
|
||||
int tot = 0;
|
||||
/*static*/ foreach (name; __traits(allMembers, mixin(__MODULE__)))
|
||||
static if (is(int == Unqual!(typeof(mixin("." ~ name)))))
|
||||
static if (name != "object" &&
|
||||
is(int == Unqual!(typeof(mixin("." ~ name)))))
|
||||
tot += mixin("." ~ name);
|
||||
writeln("Total of the module-level ints (could overflow): ", tot);
|
||||
}
|
||||
|
|
|
|||
11
Task/Introspection/Forth/introspection-2.fth
Normal file
11
Task/Introspection/Forth/introspection-2.fth
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[hex] 362 [decimal] 4TH# - [if] [abort] [then]
|
||||
|
||||
-32 value bloop
|
||||
[defined] bloop [if]
|
||||
[defined] abs [if]
|
||||
bloop abs . cr
|
||||
[then]
|
||||
[then]
|
||||
|
||||
0 last cell+ first over over - .( User variables: ) .
|
||||
?do i @ + loop .( Sum: ) . cr
|
||||
5
Task/Introspection/Julia/introspection.julia
Normal file
5
Task/Introspection/Julia/introspection.julia
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
julia> VERSION
|
||||
v"0.3.2"
|
||||
|
||||
julia> VERSION > v"0.3.1"
|
||||
true
|
||||
22
Task/Introspection/UNIX-Shell/introspection-1.sh
Normal file
22
Task/Introspection/UNIX-Shell/introspection-1.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
case ${.sh.version} in
|
||||
*93[[:alpha:]]+*) :;; #this appears to be ksh93, we're OK
|
||||
*) echo "version appears to be too old"
|
||||
exit # otherwise, bail out
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ -z ${bloop+bloop has a value} ]]; then
|
||||
print "no bloop variable"
|
||||
elsif (( abs(1) )); then
|
||||
print -- $(( abs(bloop) ))
|
||||
fi
|
||||
|
||||
typeset -a int_vars
|
||||
set | while IFS='=' read -r var value; do
|
||||
if [[ $value == +([[:digit:]]) ]]; then
|
||||
int_vars[n++]=$var
|
||||
let sum += $value
|
||||
fi
|
||||
done
|
||||
print "${int_vars[*]}"
|
||||
print -- $sum
|
||||
26
Task/Introspection/UNIX-Shell/introspection-2.sh
Normal file
26
Task/Introspection/UNIX-Shell/introspection-2.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
if [[ $BASH_VERSION < "4.2" ]]; then
|
||||
echo "version is too old"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ ! -v bloop ]]; then
|
||||
echo "no bloop variable"
|
||||
elif [[ $(type -t abs 2>/dev/null) != function ]]; then
|
||||
echo "abs is not a shell function"
|
||||
else
|
||||
echo $(abs $bloop)
|
||||
fi
|
||||
|
||||
# need to populate the variables and use them within the same subshell in a pipeline.
|
||||
set | {
|
||||
shopt -s extglob
|
||||
int_vars=()
|
||||
while IFS='=' read -r var value; do
|
||||
if [[ $value == +([[:digit:]]) ]]; then
|
||||
int_vars+=($var)
|
||||
(( sum += value ))
|
||||
fi
|
||||
done
|
||||
echo "${int_vars[*]}"
|
||||
echo $sum
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue