Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,3 +1,20 @@
{{omit from|AWK}}
{{omit from|Clojure}}
{{omit from|E}}
{{omit from|gnuplot}}
{{omit from|Groovy}}
{{omit from|GUISS|Does not have variables.}}
{{omit from|Java}}
{{omit from|JavaScript}}
{{omit from|LaTeX}}
{{omit from|Logtalk}}
{{omit from|Make}}
{{omit from|Maxima}}
{{omit from|NetRexx}}
{{omit from|PlainTeX}}
{{omit from|XSLT}}
{{omit from|Unlambda|Does not have variables.}}
Demonstrate how to get the size of a variable.
See also: [[Host introspection]]

View file

@ -9,12 +9,3 @@ main:
dup nhword disp }
disp! : { %d cr << }
Output:
38
6
14
6
7
1
4

View file

@ -1,3 +1 @@
main : { (1 2 (3 4) 5 6) unload size %d << }
Output:
38

View file

@ -0,0 +1,9 @@
def nBytes(x: Double) = ((Math.log(x) / Math.log(2) + 1e-10).round + 1) / 8
val primitives: List[(Any, Long)] =
List((Byte, Byte.MaxValue),
(Short, Short.MaxValue),
(Int, Int.MaxValue),
(Long, Long.MaxValue))
primitives.foreach(t => println(f"A Scala ${t._1.toString.drop(13)}%-5s has ${nBytes(t._2)} bytes"))