SHARE
TWEET

Untitled

a guest Nov 15th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function minfree(xs) {
  2.   var _a = 0;
  3.   var _n = List.length(xs);
  4.   var _xs = xs;
  5.   while(true) {
  6.     var xs$1 = _xs;
  7.     var n = _n;
  8.     var a = _a;
  9.     var b = (a + 1 | 0) + (n / 2 | 0) | 0;
  10.     var match = List.partition((function(b){
  11.         return function (x) {
  12.           return +(x < b);
  13.         }
  14.         }(b)), xs$1);
  15.     var us = match[0];
  16.     var m = List.length(us);
  17.     if (n) {
  18.       if (m === (b - a | 0)) {
  19.         _xs = match[1];
  20.         _n = n - m | 0;
  21.         _a = b;
  22.         continue ;
  23.        
  24.       } else {
  25.         _xs = us;
  26.         _n = m;
  27.         continue ;
  28.        
  29.       }
  30.     } else {
  31.       return a;
  32.     }
  33.   };
  34. }
RAW Paste Data
Top