Hey there!

  Sure, you can ask us here. I'm on sick leave, so got plenty of time.
  Coincidentally, working on my Factor hobby project.

  What you're looking for is called supremum-by.

  Terminology is a bit uncommon. Look up supremum and infimum in the help 
system.

10.12.2018, 17:06, "pet...@riseup.net" <pet...@riseup.net>:
> Hello fellow concatenative fans.
>
> I'm working my way through this year's advent of code[0]. I'm doing it
> in factor with a small twist - everything happening inside the REPL.
> Makes it more fun and challenging (for me), although I don't have any
> code to show for it in the end.
>
> I'm trying to find the right tools for the job since there's a lot of
> words already available. Sometimes I reinvent something before I find
> it, e.g. I wrote a last-n before finding last*.
>
> Would it be OK if I sometimes ask you for tips on what would be
> idiomatic/simpler/shorter/faster than what I have(n't) found?
>
> The first problem I really couldn't find is picking a maximum from a
> sequence based on a quotation pulling out the key. An example will say
> it the best I guess:
>
>>  { { 1 2 } { 1 3 } { -1 4 } } [ second ] max-by .
>
> { -1 4 }
>
> Here is my definition:
>
> : max-by ( seq quot -- result ) [ unclip-slice ] dip '[ [ [ _ call ] bi@
>>  ] 2keep ? ] reduce ; inline
>
> Using fry for such a general word would be a bit of an overkill but for
> demonstration purposes it's OK I guess.
>
> Is there no standard word that already does something similar? Or is
> there a way to write this with the existing sequence combinators that
> it's so short there was no need to create this generic word?
>
> --
> ------------
>   Peter Nagy
> ------------
>
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk

---=====--- 
 Александр



_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to