19 lines
427 B
Text
19 lines
427 B
Text
{def longest_string
|
|
{def longest_string.r
|
|
{lambda {:max :s}
|
|
{if {S.empty? {S.rest :s}}
|
|
then
|
|
else {if {= {W.length {S.first :s}} :max} then {br}{S.first :s} else}
|
|
{longest_string.r :max {S.rest :s}}}}}
|
|
{lambda {:s}
|
|
{longest_string.r {max {S.map W.length :s}} :s #}}}
|
|
-> longest_string
|
|
|
|
{def words a bb ccc ddd ee f ggg} // it's a sentence, not a list
|
|
-> words
|
|
|
|
{longest_string {words}}
|
|
->
|
|
ccc
|
|
ddd
|
|
ggg
|