JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
585 stars 73 forks source link

?d^?d no longer finds non-unique elements #78

Closed jordancurve closed 4 years ago

jordancurve commented 5 years ago

In https://codegolf.stackexchange.com/a/60648/84951 (2015), JohnEarnest wrote:

  nu: {?x^?x}
  nu'(();-1 0 1;1 1;3 0 0 1 1 0 5 3;-34 0 1 -34 4 8 4)
(()
 ()
 ,1
 0 1 3
 -34 4)

Now, though, the oK REPL gives all blanks for that input:

Welcome to oK v0.1
(inspired by K5)
  nu: {?x^?x}

{[x]?x^?x}
    nu'(();-1 0 1;1 1;3 0 0 1 1 0 5 3;-34 0 1 -34 4 8 4)

(()
 ()
 ()
 ()
 ())
ngn commented 5 years ago

x^y was changed to remove all occurrences

a possible replacement is nu:{?x@,/1_'.=x}, unfortunately longer

JohnEarnest commented 4 years ago

@ngn's reply is accurate.

It's too bad we lost a cute idiom. I brought it up to Arthur during the k5/k6 transition and as it turned out he was totally unaware that except had been "broken" as I discovered in k5.