<commit_before>local ffi = require "ffi"

local mundos_posibles = 5 -- número de mundos posibles

ffi.cdef[[
  void Sleep(int ms);
  int poll(struct pollfd *fds, unsigned long nfds, int timeout);
]]

if ffi.os == "Windows" then
 function sleep(s)
    ffi.C.Sleep(s*1000)
  end
else
  function sleep(s)
    ffi.C.poll(nil, 0, s*1000)
  end
end

local nec = function (A)
    AI = {}
    AI[1] = A[1] * A[3] * A[5]
    AI[2] = A[2] * A[1] * A[1]
    AI[3] = A[3] * A[5] * A[4]
    AI[4] = A[4] * A[5]
    AI[5] = 1
    return AI
end

local pos = function (A)
  local res = mnot(nec(mnot(A)))
  return res
end

local ctrue  = function () return 1 end -- tautología
local cfalse = function () return 0 end -- contradicción
local cnot   = function (a) return 1 - a end -- negación
local cand   = function (a, b) return math.min(a, b) end
local cor    = function (a, b) return math.max(a, b) end
local cimp   = function (a, b) return b >= a and 1 or 0 end -- implicación

local mmap = function (clf, A, B)
  C = {}
  for i=1,mundos_posibles do C[i] = clf(A and A[i], B and B[i]) end
  return C
 end

mtrue  = function () return mmap(ctrue)  end
mfalse = function () return mmap(cfalse) end
mand   = function (A, B) return mmap(cand, A, B) end
mor    = function (A, B) return mmap(cor,  A, B) end
mimp   = function (A, B) return mmap(cimp, A, B) end
mnot   = function (A)    return mmap(cnot, A) end

local sistema = nec{1,0,1,0,1} -- evalúa sistema

for c, v in ipairs(sistema) do
  local file = io.open("ruta/de/archivo","w")
  file:write(v)
  file:close()
  print(v)
  sleep(1)
end<commit_msg>Update mundos_posibles.lua<commit_after>local ffi = require "ffi"

local mundos_posibles = 5 -- número de mundos posibles

ffi.cdef[[
  void Sleep(int ms);
  int poll(struct pollfd *fds, unsigned long nfds, int timeout);
]]

if ffi.os == "Windows" then
 function sleep(s)
    ffi.C.Sleep(s*1000)
  end
else
  function sleep(s)
    ffi.C.poll(nil, 0, s*1000)
  end
end

local nec = function (A)
    AI = {}
    AI[1] = A[1] * A[3] * A[5]
    AI[2] = A[2] * A[1] * A[1]
    AI[3] = A[3] * A[5] * A[4]
    AI[4] = A[4] * A[5]
    AI[5] = 1
    return AI
end

local pos = function (A)
  local res = mnot(nec(mnot(A)))
  return res
end

local ctrue  = function () return 1 end -- tautología
local cfalse = function () return 0 end -- contradicción
local cnot   = function (a) return 1 - a end -- negación
local cand   = function (a, b) return math.min(a, b) end
local cor    = function (a, b) return math.max(a, b) end
local cimp   = function (a, b) return b >= a and 1 or 0 end -- implicación

local mmap = function (clf, A, B)
  C = {}
  for i=1,mundos_posibles do C[i] = clf(A and A[i], B and B[i]) end
  return C
 end

mtrue  = function () return mmap(ctrue)  end
mfalse = function () return mmap(cfalse) end
mand   = function (A, B) return mmap(cand, A, B) end
mor    = function (A, B) return mmap(cor,  A, B) end
mimp   = function (A, B) return mmap(cimp, A, B) end
mnot   = function (A)    return mmap(cnot, A) end

local sistema = nec{1,0,1,0,1} -- evalúa sistema

for c, v in ipairs(sistema) do
  local file = io.open("/ruta/de/archivo","w")
  file:write(v)
  file:close()
  print(v)
  sleep(1)
end
{'fraction_non_alphanumeric': 0.14921630094043886, 'fraction_numerical': 0.02445141065830721, 'mean_word_length': 3.059796437659033, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4794997', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1311, 'n_words': 428}