Rosetta Code Analysis
PicoLisp has 370 functions/globals documented in the reference. One way to prioritize learning is to identify the most commonly used functions to solve tasks. The Rosetta Code solutions are a sample of idiomatic ways of solving common tasks.Using this code below, we can understand which functions are most commonly used
(de token (Line) (when (sub? "(" Line) (mapcar pack (split (diff (chop Line) '("(" ")")) " ") ) ) ) (de flatten (List) (fish atom List) ) (setq Tokens (flatten (in "rosettacode.l" (make (until (eof) (link (token (line))) ) ) ) ) ) (setq Counts (by name group Tokens)) (mapc '((X) (accu 'WordCount (car X) (length X))) Counts ) (in "tokens.txt" (until (eof) (accu 'Functions (pack (line)) 0) ) ) (mapc '((X) (when (assoc (car X) Functions) (accu 'Functions (car X) (length X)) ) ) Counts ) (out "counts.txt" (mapc '((X) (prinl (car (car X)) "," (cdr X)) ) (reverse (by cdr sort Functions)) ) )
There are some false positives (e.g. ':' because it's used in the output) however it still may be useful to understand the most commonly used functions.
Results as compact table
| de | 1145 | apply | 70 | | | 27 | space | 14 | bin | 8 | intern | 4 | le0 | 1 | fold | 0 | | : | 612 | pop | 69 | recur | 26 | prog1 | 14 | assoc | 8 | flush | 4 | later | 1 | fmt64 | 0 | | let | 554 | loop | 69 | off | 26 | name | 14 | args | 8 | dep | 4 | fun? | 1 | fin | 0 | | prinl | 495 | char | 69 | key | 26 | memq | 14 | text | 7 | delq | 4 | flg? | 1 | fill | 0 | | for | 458 | out | 68 | diff | 26 | match | 14 | tell | 7 | sym? | 3 | finally | 1 | extra | 0 | | setq | 407 | not | 67 | con | 26 | ge0 | 14 | sub? | 7 | str? | 3 | circ? | 1 | extern | 0 | | + | 318 | line | 63 | case | 26 | pipe | 13 | send | 7 | pp | 3 | center | 1 | extend | 0 | | * | 298 | cond | 62 | == | 26 | hex | 13 | run | 7 | nor | 3 | beep | 1 | ext? | 0 | | car | 293 | class | 62 | find | 25 | glue | 13 | pre? | 7 | n== | 3 | arg | 1 | expr | 0 | | - | 290 | with | 61 | fifo | 25 | eval | 13 | pick | 7 | local | 3 | acquire | 1 | err | 0 | | = | 251 | dm | 60 | balance | 25 | default | 13 | min | 7 | loc | 3 | accept | 1 | eol | 0 | | inc | 228 | push | 58 | caar | 24 | chain | 13 | made | 7 | full | 3 | $ | 1 | dirname | 0 | | cdr | 223 | bye | 58 | quote | 23 | cdar | 13 | lowc | 7 | dir | 3 | zap | 0 | daemon | 0 | | and | 206 | need | 57 | filter | 23 | asoq | 13 | lines | 7 | del | 3 | yoke | 0 | cdadr | 0 | | if | 194 | % | 57 | file | 23 | =T | 13 | let? | 7 | cdddr | 3 | wipe | 0 | cdaar | 0 | | link | 191 | round | 56 | cddr | 23 | reverse | 12 | insert | 7 | caadr | 3 | var: | 0 | caaar | 0 | | in | 185 | =: | 56 | copy | 22 | redef | 12 | getl | 7 | undef | 2 | var | 0 | box? | 0 | | cons | 185 | on | 54 | align | 22 | num? | 12 | cadddr | 7 | type | 2 | upp? | 0 | abort | 0 | | */ | 178 | sum | 53 | zero | 21 | max | 12 | bind | 7 | try | 2 | touch | 0 | *Class | 0 | | println | 176 | idx | 49 | atom | 21 | show | 11 | accu | 7 | super | 2 | timeout | 0 | | | | load | 173 | recurse | 47 | one | 20 | extract | 11 | trim | 6 | state | 2 | tick | 0 | | | | make | 156 | use | 43 | maxi | 20 | echo | 11 | seek | 6 | rc | 2 | subr | 0 | | | | do | 145 | sort | 43 | map | 20 | cnt | 11 | seed | 6 | push1 | 2 | strip | 0 | | | | mapcar | 143 | wait | 42 | lit | 20 | close | 11 | sect | 6 | prog2 | 2 | rewind | 0 | | | | prin | 141 | new | 41 | gt0 | 20 | box | 11 | replace | 6 | prior | 2 | release | 0 | | | | / | 134 | member | 41 | circ | 20 | yield | 10 | queue | 6 | onOff | 2 | qsym | 0 | | | | format | 131 | read | 40 | & | 20 | port | 10 | pr | 6 | mini | 2 | prEval | 0 | | | | length | 130 | def | 40 | catch | 19 | pass | 10 | n0 | 6 | mapcon | 2 | poll | 0 | | | | dec | 126 | flip | 39 | abs | 19 | object | 10 | job | 6 | mail | 2 | place | 0 | | | | pack | 123 | rd | 38 | xchg | 18 | mapcan | 10 | fish | 6 | listen | 2 | path | 0 | | | | when | 117 | from | 37 | last | 18 | index | 10 | connect | 6 | here | 2 | patch | 0 | | | | or | 114 | by | 37 | append | 18 | < | 10 | <= | 6 | delete | 2 | pat? | 0 | | | | list | 114 | until | 36 | any | 18 | x| | 9 | view | 5 | ctl | 2 | opid | 0 | | | | while | 106 | rel | 36 | till | 17 | size | 9 | udp | 5 | cddddr | 2 | once | 0 | | | | call | 106 | quit | 34 | rot | 17 | rest | 9 | sp? | 5 | cddar | 2 | nand | 0 | | | | chop | 105 | e | 34 | curry | 17 | lt0 | 9 | rank | 5 | bool | 2 | nT | 0 | | | | > | 99 | caddr | 34 | can | 17 | info | 9 | open | 5 | ==== | 2 | mix | 0 | | | | This | 98 | ** | 34 | uppc | 16 | group | 9 | msg | 5 | wrap | 1 | meth | 0 | | | | set | 97 | tab | 32 | sys | 16 | co | 9 | getd | 5 | t | 1 | meta | 0 | | | | range | 96 | head | 32 | ifn | 16 | cache | 9 | clip | 5 | sync | 1 | maps | 0 | | | | unless | 95 | >> | 32 | at | 16 | <> | 9 | cadar | 5 | sym | 1 | macro | 0 | | | | val | 94 | put | 31 | tail | 15 | wr | 8 | :: | 5 | stem | 1 | lst? | 0 | | | | get | 90 | conc | 31 | split | 15 | throw | 8 | xor | 4 | script | 1 | low? | 0 | | | | cadr | 86 | ! | 30 | printsp | 15 | symbols | 8 | skip | 4 | remove | 1 | locale | 0 | | | | rand | 84 | task | 29 | print | 15 | prog | 8 | putl | 4 | pretty | 1 | kill | 0 | | | | =0 | 83 | fork | 29 | if2 | 15 | pair | 8 | prop | 4 | offset | 1 | isa | 0 | | | | mapc | 80 | bit? | 29 | as | 15 | pad | 8 | peek | 4 | oct | 1 | ipid | 0 | | | | scl | 79 | all | 29 | ; | 15 | method | 8 | nond | 4 | money | 1 | import | 0 | | | | >= | 75 | sqrt | 28 | uniq | 14 | eof | 8 | nil | 4 | mmeq | 1 | host | 0 | | | | nth | 72 | next | 28 | str | 14 | cut | 8 | lup | 4 | maplist | 1 | hear | 0 | | |
Results as long table
| function | count | | de | 1145 | | : | 612 | | let | 554 | | prinl | 495 | | for | 458 | | setq | 407 | | + | 318 | | * | 298 | | car | 293 | | - | 290 | | = | 251 | | inc | 228 | | cdr | 223 | | and | 206 | | if | 194 | | link | 191 | | in | 185 | | cons | 185 | | */ | 178 | | println | 176 | | load | 173 | | make | 156 | | do | 145 | | mapcar | 143 | | prin | 141 | | / | 134 | | format | 131 | | length | 130 | | dec | 126 | | pack | 123 | | when | 117 | | or | 114 | | list | 114 | | while | 106 | | call | 106 | | chop | 105 | | > | 99 | | This | 98 | | set | 97 | | range | 96 | | unless | 95 | | val | 94 | | get | 90 | | cadr | 86 | | rand | 84 | | =0 | 83 | | mapc | 80 | | scl | 79 | | >= | 75 | | nth | 72 | | apply | 70 | | pop | 69 | | loop | 69 | | char | 69 | | out | 68 | | not | 67 | | line | 63 | | cond | 62 | | class | 62 | | with | 61 | | dm | 60 | | push | 58 | | bye | 58 | | need | 57 | | % | 57 | | round | 56 | | =: | 56 | | on | 54 | | sum | 53 | | idx | 49 | | recurse | 47 | | use | 43 | | sort | 43 | | wait | 42 | | new | 41 | | member | 41 | | read | 40 | | def | 40 | | flip | 39 | | rd | 38 | | from | 37 | | by | 37 | | until | 36 | | rel | 36 | | quit | 34 | | e | 34 | | caddr | 34 | | ** | 34 | | tab | 32 | | head | 32 | | >> | 32 | | put | 31 | | conc | 31 | | ! | 30 | | task | 29 | | fork | 29 | | bit? | 29 | | all | 29 | | sqrt | 28 | | next | 28 | | | | 27 | | recur | 26 | | off | 26 | | key | 26 | | diff | 26 | | con | 26 | | case | 26 | | == | 26 | | find | 25 | | fifo | 25 | | balance | 25 | | caar | 24 | | quote | 23 | | filter | 23 | | file | 23 | | cddr | 23 | | copy | 22 | | align | 22 | | zero | 21 | | atom | 21 | | one | 20 | | maxi | 20 | | map | 20 | | lit | 20 | | gt0 | 20 | | circ | 20 | | & | 20 | | catch | 19 | | abs | 19 | | xchg | 18 | | last | 18 | | append | 18 | | any | 18 | | till | 17 | | rot | 17 | | curry | 17 | | can | 17 | | uppc | 16 | | sys | 16 | | ifn | 16 | | at | 16 | | tail | 15 | | split | 15 | | printsp | 15 | | print | 15 | | if2 | 15 | | as | 15 | | ; | 15 | | uniq | 14 | | str | 14 | | space | 14 | | prog1 | 14 | | name | 14 | | memq | 14 | | match | 14 | | ge0 | 14 | | pipe | 13 | | hex | 13 | | glue | 13 | | eval | 13 | | default | 13 | | chain | 13 | | cdar | 13 | | asoq | 13 | | =T | 13 | | reverse | 12 | | redef | 12 | | num? | 12 | | max | 12 | | show | 11 | | extract | 11 | | echo | 11 | | cnt | 11 | | close | 11 | | box | 11 | | yield | 10 | | port | 10 | | pass | 10 | | object | 10 | | mapcan | 10 | | index | 10 | | < | 10 | | x| | 9 | | size | 9 | | rest | 9 | | lt0 | 9 | | info | 9 | | group | 9 | | co | 9 | | cache | 9 | | <> | 9 | | wr | 8 | | throw | 8 | | symbols | 8 | | prog | 8 | | pair | 8 | | pad | 8 | | method | 8 | | eof | 8 | | cut | 8 | | bin | 8 | | assoc | 8 | | args | 8 | | text | 7 | | tell | 7 | | sub? | 7 | | send | 7 | | run | 7 | | pre? | 7 | | pick | 7 | | min | 7 | | made | 7 | | lowc | 7 | | lines | 7 | | let? | 7 | | insert | 7 | | getl | 7 | | cadddr | 7 | | bind | 7 | | accu | 7 | | trim | 6 | | seek | 6 | | seed | 6 | | sect | 6 | | replace | 6 | | queue | 6 | | pr | 6 | | n0 | 6 | | job | 6 | | fish | 6 | | connect | 6 | | <= | 6 | | view | 5 | | udp | 5 | | sp? | 5 | | rank | 5 | | open | 5 | | msg | 5 | | getd | 5 | | clip | 5 | | cadar | 5 | | :: | 5 | | xor | 4 | | skip | 4 | | putl | 4 | | prop | 4 | | peek | 4 | | nond | 4 | | nil | 4 | | lup | 4 | | intern | 4 | | flush | 4 | | dep | 4 | | delq | 4 | | sym? | 3 | | str? | 3 | | pp | 3 | | nor | 3 | | n== | 3 | | local | 3 | | loc | 3 | | full | 3 | | dir | 3 | | del | 3 | | cdddr | 3 | | caadr | 3 | | undef | 2 | | type | 2 | | try | 2 | | super | 2 | | state | 2 | | rc | 2 | | push1 | 2 | | prog2 | 2 | | prior | 2 | | onOff | 2 | | mini | 2 | | mapcon | 2 | | mail | 2 | | listen | 2 | | here | 2 | | delete | 2 | | ctl | 2 | | cddddr | 2 | | cddar | 2 | | bool | 2 | | ==== | 2 | | wrap | 1 | | t | 1 | | sync | 1 | | sym | 1 | | stem | 1 | | script | 1 | | remove | 1 | | pretty | 1 | | offset | 1 | | oct | 1 | | money | 1 | | mmeq | 1 | | maplist | 1 | | le0 | 1 | | later | 1 | | fun? | 1 | | flg? | 1 | | finally | 1 | | circ? | 1 | | center | 1 | | beep | 1 | | arg | 1 | | acquire | 1 | | accept | 1 | | $ | 1 | | zap | 0 | | yoke | 0 | | wipe | 0 | | var: | 0 | | var | 0 | | upp? | 0 | | touch | 0 | | timeout | 0 | | tick | 0 | | subr | 0 | | strip | 0 | | rewind | 0 | | release | 0 | | qsym | 0 | | prEval | 0 | | poll | 0 | | place | 0 | | path | 0 | | patch | 0 | | pat? | 0 | | opid | 0 | | once | 0 | | nand | 0 | | nT | 0 | | mix | 0 | | meth | 0 | | meta | 0 | | maps | 0 | | macro | 0 | | lst? | 0 | | low? | 0 | | locale | 0 | | kill | 0 | | isa | 0 | | ipid | 0 | | import | 0 | | host | 0 | | hear | 0 | | hax | 0 | | fold | 0 | | fmt64 | 0 | | fin | 0 | | fill | 0 | | extra | 0 | | extern | 0 | | extend | 0 | | ext? | 0 | | expr | 0 | | err | 0 | | eol | 0 | | dirname | 0 | | daemon | 0 | | cdadr | 0 | | cdaar | 0 | | caaar | 0 | | box? | 0 | | abort | 0 | | *Class | 0 |
https://picolisp.com/wiki/?rosettacodeanalysis
20aug21 | tankf33der |