kona icon indicating copy to clipboard operation
kona copied to clipboard

Feature: sorting for functions

Open kevinlawler opened this issue 14 years ago • 5 comments

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}) /????

kevinlawler avatar Mar 12 '11 21:03 kevinlawler

What should they be sorted on?

silentbicycle avatar Mar 14 '11 13:03 silentbicycle

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.

kevinlawler avatar Mar 14 '11 14:03 kevinlawler

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.

tavmem avatar May 23 '14 19:05 tavmem

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

tavmem avatar Jun 30 '16 01:06 tavmem

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".

tavmem avatar Jul 01 '16 03:07 tavmem