Q1: why the type each GList not give -11h -7h -10h instead of -11 -7 -10h with only 3rd element with h for short value?
Q2: the ipynb notebook seems to give results not following the command order,
shouldn't it be below if it respects the command query order?
my query and expected results:
type `a
type 1
type "b"
-11h
-7h
-10h
while the offical query and results look -11 -7 -10h so -11 is long -7 is long? or shorthand it is all short for h but just show for the last 3rd element?
1. The h at the end of the list isn't related to the last value. The h is placed at the end of the list to indicate this is a list of data type values.
2. Do you mean why are the results showing the types before displaying the list even though the "show" query comes before the "type" query?
1. thanks prompt reply, but it's a bit confusing indeed, so after your explanation it's for the WHOLE LIST of same type value h, the type each in type each GList: (`a; 1 ; "b") shows a list of value of each element data type and then an "h" char at the last to show these values of data type are of short type only. I thought as if it would show the same as the individual type command i.e.type `a
type 1
type "b"
will get same expected results from type each (`a;1;"b") but it does not.
quite the opposite to what I thought would give the same result to individual type query to 3 value. I still cannot convey myself and dry run in brain when and why "type each" would show like this.
I can only think of a reasonable answer - type each would generate a list of same value, in this case it must be "h" for short
2. yes your understanding to the question is correct,
1. When running the type function, it will return the type code (an integer) indicating the data type of the value. The h represents that it is returning a short type code.
Whether we run it individually on each item e.g.
type `a
type 1
type "b"
Output:
-11h //short type code for symbol
-7h //short type code for int
-10h //short type code for char
Or in one go over a list:
type each GList
Output:
-11 -7 -10h //short type codes for symbol, int, char
The “h” at the end indicates that it is displaying the short type code for those items.
2. I believe the output format is due to Jupyter’s output model. Commands such as show x prints the result of evaluating x, but does not return a value. Jupyter cells only display the value of the last expression, and show returns nothing (:: or null), the output is printed directly as a side effect, not as a result.
For example, running show L will output the query last but outputting L as a variable will run before the second query (screenshots provided below)