You are correct. I'm kind of adding the rule that `f` is smaller than anything else in terms of `math.order:max`.
I also dislike the idea of making a copy of an array in case there are no `f` elements, which `sift` would do.
I'm dealing with pretty big arrays here, so anything postponing the OutOfMemory crash is important to me.
21.06.2017, 18:51, "Alex Vondrak" <[email protected]>:
,Technically that case would be a matter of `supremum` handling empty arrays, not `f` elements per se.On Jun 21, 2017 8:48 AM, "Alexander Ilin" <[email protected]> wrote:```{ f f f f } sift supremum-> error is thrown```21.06.2017, 18:44, "Alex Vondrak" <[email protected]>:,Or you could call `sift supremum`: http://docs.factorcode.org/content/word-sift,sequences.htmlMight be instructive to give the codebase a search, see how often that pattern is used. (Can't do it myself right now - on mobile.)On Jun 21, 2017 8:39 AM, "Alexander Ilin" <[email protected]> wrote:Hello!
How would you like if `supremum` tolerated the `f` elements?
Now:
```
{ f 0 1 2 } supremum
-> error is thrown
{ f f f f } supremum
-> error is thrown
```
Proposition:
```
{ f 0 1 2 } supremum
-> 2
{ f f f f } supremum
-> f
```
Current code:
```
: supremum ( seq -- elt )
[ ] [ max ] map-reduce ;
```
Proposed code:
```
: supremum ( seq -- elt )
[ ] [ 2dup and [ max ] [ dupd ? ] if ] map-reduce ;
```
If you like what you are seeing, I'll make a formal PRoposal.
---=====---
Александр
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk,------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk---=====---Александр
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------
,
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk
---=====---
Александр
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
