In article
<af50505e-1bb8-40c4-beae-5e2671ca71d4@[EMAIL PROTECTED]
>,
Slava Pestov <slava@[EMAIL PROTECTED]
> wrote:
>On Apr 29, 4:30=A0pm, Jonah Thomas <jethom...@[EMAIL PROTECTED]
> wrote:
>> Oh well. We don't mind useing RPN, or a data stack, or weak typing.
>
>You don't have to give up RPN or the stack to solve this problem in a
>concise way. Here is the Factor solution:
>
>: alpha-value ( str -- n )
> >lower [ CHAR: a - 1+ ] sigma ;
>
>: source-022 ( -- seq )
> "resource:extra/project-euler/022/names.txt"
> ascii file-contents [ quotable? ] filter "," split ;
>
>: name-scores ( seq -- seq )
> [ 1+ swap alpha-value * ] map-index ;
>
>: euler-022 ( -- answer )
> source-022 natural-sort name-scores sum ;
>
>We have solutions to about 70 project euler problems so far, and most
>of them are very short:
Nice! I would be interested in the running time on a machine
where Marcel Hendrix uses up 5 mS (and hundreds of WOC).
Has somebody both factor and iforth installed?
>http://factorcode.org/responder/cgi/gitweb.cgi?p=3Dfactor.git;a=3Dtree;f=3De=
>xtra/project-euler;h=3Dc5ba0c4ac8b33de81d0030cbd5abce2ac990e7fa;hb=3DHEAD
Where do these ugly urls come from?
Groetjes Albert
--
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert@[EMAIL PROTECTED]
&=n http://home.hccnet.nl/a.w.m.van.der.horst


|