Björn's can be sped up by not using assoc-map! and replacing
``refine-index`` with this:
:: refine-index ( max-i index prev-index -- )
index keys [ [ prev-index at ] [ index set-at ] bi ] each
index [ nip max-i >= ] assoc-filter! drop ;
That takes it from 2.0 seconds to 1.3 seconds on my
Here is my solution:
https://github.com/bjourne/playground-factor/blob/master/examples/golf/challenge-252/challenge-252.factor
It's a straight transliteration of the Python solution that was posted
in the reddit thread. The hard part was getting the loops right.
Factor doesn't have any iteration
Hi,
when I'm writing a unoptimized solution to a problem, I usually go top
down, thinking about what l lists I have to build and transform. I try
to split code into words with names instead of adding comments. I try
to use the conventions (
Wow, your words are simple and fit in single lines. Do you write pseudo
code that is more expressible in factor or do you write traditional
imperative style pseudo code and then translate them to a factor
representation?
Thanks,
Sankar
On 2/25/16 12:01 PM, Jon Harper wrote:
> "Hi,
> I wrote a
PPS: even shorter:
: remove-after-underscore ( seq -- seq' )
"_" split1 drop ;
---=---
Александр
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App
Hello, Jon!
25.02.2016, 20:02, "Jon Harper" :
> I wrote a basic o(n^4) solution to see how simple it could get. The
> code looks nice to me, but it's sllw :) like 1 hour on the 3200
> chars string.. http://paste.factorcode.org/paste?id=3843
Wow, your code looks very
"Hi,
I wrote a basic o(n^4) solution to see how simple it could get. The
code looks nice to me, but it's sllw :) like 1 hour on the 3200
chars string.. http://paste.factorcode.org/paste?id=3843
I noticed we have 1 function in common : remove-after-underscore. You
can can see how head and
Hi!
> I struggled quite a lot coming up with this. Mainly in keeping things in
> my head and figuring out what I needed to do to bring the stack in order
> for the operations I was attempting..
>
> Coming from an iterative programming background (with a little bit of
> exposure to functional