2017-10-22 05:12:14 +02:00
|
|
|
It's sometimes interesting to take some measurements of dictionary names.
|
|
|
|
|
|
|
|
Determine the number of words in the dictionary.
|
|
|
|
|
|
|
|
~~~
|
|
|
|
#0 [ drop n:inc ] d:for-each
|
2018-05-07 18:36:37 +02:00
|
|
|
'%n_names_defined\n s:format s:put
|
2017-10-22 05:12:14 +02:00
|
|
|
~~~
|
|
|
|
|
|
|
|
Determine the average length of a word name.
|
|
|
|
|
|
|
|
~~~
|
|
|
|
#0 [ d:name s:length + ] d:for-each
|
|
|
|
#0 [ drop n:inc ] d:for-each
|
2018-05-07 18:36:37 +02:00
|
|
|
/ 'Average_name_length:_%n\n s:format s:put
|
2017-10-22 05:12:14 +02:00
|
|
|
~~~
|
|
|
|
|
2021-03-30 13:58:25 +02:00
|
|
|
And without the namespaces...
|
2017-10-24 16:55:53 +02:00
|
|
|
|
|
|
|
~~~
|
2021-06-04 20:34:59 +02:00
|
|
|
#0 #0 [ d:name dup $: s:index/char n:inc + s:length + [ n:inc ] dip ] d:for-each swap /
|
2018-05-07 18:36:37 +02:00
|
|
|
'Average_name_without_namespace:_%n\n s:format s:put
|
2017-10-24 16:55:53 +02:00
|
|
|
~~~
|
|
|
|
|
2017-10-22 05:12:14 +02:00
|
|
|
Longest name are...
|
|
|
|
|
|
|
|
~~~
|
|
|
|
#0 [ d:name s:length n:max ] d:for-each
|
2018-05-07 18:36:37 +02:00
|
|
|
'Longest_names_are_%n_characters\n s:format s:put
|
2017-10-22 05:12:14 +02:00
|
|
|
~~~
|