Odd words: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: use unix_dict()) |
|||
Line 672: | Line 672: | ||
5: upholstery posey |
5: upholstery posey |
||
</pre> |
</pre> |
||
=={{header|jq}}== |
|||
{{works with|jq}} |
|||
'''Works with gojq, the Go implementation of jq''' if `keys_unsorted` is replaced by `keys` |
|||
Counting the letters from 1... |
|||
<lang jq> def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .; |
|||
INDEX(inputs | select(length>4); .) |
|||
| . as $dict |
|||
| keys_unsorted[] |
|||
| select(length > 8) |
|||
| (explode | [.[range(0;length;2)]] | implode) as $odd |
|||
| select( ($odd|length > 4) and $dict[$odd]) |
|||
| "\(lpad(10)) : \($odd)"</lang> |
|||
{{out}} |
|||
Illustrative invocation: jq -nrR -f program.jq unixdict.txt |
|||
<pre> |
|||
barbarian : brain |
|||
childbear : cider |
|||
corrigenda : cried |
|||
gargantuan : grata |
|||
headdress : hades |
|||
palladian : plain |
|||
propionate : point |
|||
salvation : slain |
|||
siltation : slain |
|||
slingshot : sight |
|||
statuette : saute |
|||
supersede : spree |
|||
supervene : spree |
|||
terminable : trial |
|||
</pre> |
|||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
Line 696: | Line 730: | ||
terminable : trial |
terminable : trial |
||
</pre> |
</pre> |
||
=={{header|Nim}}== |
=={{header|Nim}}== |