Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -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]]
|
||||
|
|
|
|||
|
|
@ -9,12 +9,3 @@ main:
|
|||
dup nhword disp }
|
||||
|
||||
disp! : { %d cr << }
|
||||
|
||||
Output:
|
||||
38
|
||||
6
|
||||
14
|
||||
6
|
||||
7
|
||||
1
|
||||
4
|
||||
|
|
|
|||
|
|
@ -1,3 +1 @@
|
|||
main : { (1 2 (3 4) 5 6) unload size %d << }
|
||||
Output:
|
||||
38
|
||||
|
|
|
|||
9
Task/Variable-size-Get/Scala/variable-size-get.scala
Normal file
9
Task/Variable-size-Get/Scala/variable-size-get.scala
Normal 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"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue