kona
kona copied to clipboard
Feature: sorting for functions
Update KC() ("K compare") to provide a sensible comparison function (results in {-1,0,1}) for 7-types. This will let us sort functions. This will be trickier than for dictionaries since there are several differents types of functions and projections.
< ({x+1};{x+y};{x*2}) /????
What should they be sorted on?
Whoever runs with this can dictate the sort order. There are certain natural attributes that should be respected (e.g. the verbs have a particular sort order in memory, {} should probably be sorted either lexicographically or by length & then lexicographically). There are some things that aren't entirely clear. How to sort dynamically loaded functions, how to differentiate between the same function with different projections. Whoever builds it should pick. The more deterministic the better.
I do not believe that "sorting for functions" was a feature of k2.x or k3.x. I am changing the label to "enhancement". If this is incorrect, let me know.
Note that this capability exists in k3.2 So ... this would not be an enhancement (if it does not work in Kona)
c:\k3.2>k
K 3.2 2005-06-25 Copyright (C) 1993-2004 Kx Systems
WIN32 4CPU 4095MB tszczesny-e7270.corp.1010data.com 0 EVAL
<3 1 2
1 2 0
<({x+1};{x+y};{x*2})
0 2 1
It does not work in Kona. Kona always gives the same result, no matter what the order:
c:\kona>k
K Console - Enter \ for help
<({x+1};{x+y};{x*2})
0 1 2
<({x*2};{x+1};{x+y})
0 1 2
<({x+y};{x*2};{x+1})
0 1 2
I'm changing this issue from "enhancement" to "feature".