D12074: Solve problem of appearance input of interpreter in interpreter's output in Lua backend

Nikita Sirgienko noreply at phabricator.kde.org
Mon Apr 23 19:57:55 UTC 2018


sirgienko added a comment.


  In D12074#252496 <https://phabricator.kde.org/D12074#252496>, @asemke wrote:
  
  > In D12074#252468 <https://phabricator.kde.org/D12074#252468>, @sirgienko wrote:
  >
  > > Did you test with 'Reevaluate Entries automatically' option? Without this option all works fine, but with the option I often have something like this:
  > >
  > >   final command to be executed  "function bar(a, b, c)\n  print(a, b, c)\n  return 4, 8, 15, 16, 23, 42\nend\n\nx, y = bar('zaphod')  --> prints \"zaphod  nil nil\"\n" 
  > >  
  > >   QSizeF(1131, 157) QSizeF(1131, 126)
  > >   parsing the output  "function fib(n)\n>>   if n < 2 then return 1 end\n>>   return fib(n - 2) + fib(n - 1)\n>> end\n> \n> -- Closures and anonymous functions are ok:\n> function adder(x)\n>>   -- The returned function is created when adder is\n>>   -- called, and remembers the value of x:\n>>   return function (y) return x + y end\n>> end\n> a1 = adder(9)\n> a2 = adder(36)\n> print(a1(16))  --> 25\n25\n> print(a2(64))  --> 100\n100\n> function bar(a, b, c)\n>>   print(a, b, c)\n>>   return 4, 8, 15, 16, 23, 42\n>> end\n> \n> x, y = bar('zaphod')  --> prints \"zaphod  nil nil\"\nzaphod\tnil\tnil\n> "
  > >   final output of the command  "function bar(a, b, c)\n  print(a, b, c)\n  return 4, 8, 15, 16, 23, 42\nend\n\nx, y = bar('zaphod')  --> prints \"zaphod  nil nil\"" :  "function fib(n)\nif n < 2 then return 1 end\nreturn fib(n - 2) + fib(n - 1)\n-- Closures and anonymous functions are ok:\nfunction adder(x)\n-- The returned function is created when adder is\n-- called, and remembers the value of x:\nreturn function (y) return x + y end\na1 = adder(9)\na2 = adder(36)\nprint(a1(16))  --> 25\n25\nprint(a2(64))  --> 100\n100\nzaphod\tnil\tnil" 
  > >  
  > >   settting result to a type  1  result
  > >   update Entry
  > >   new result
  > >   wsStatusChange 1
  > >
  >
  >
  > Yes, same problem here. I was testing without this auto eval. option all the time. With this option the results are sometimes very weird. Did you also observe this error with other backends or is this something specific to lua?
  
  
  Well, I have worked a lot of time with Octave, Maxima and few times with Python 2, Python 3, Lua, Julia. I have this problem only with lua.

REPOSITORY
  R55 Cantor

REVISION DETAIL
  https://phabricator.kde.org/D12074

To: sirgienko, #cantor, asemke
Cc: #cantor, #kde_edu, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20180423/c129c566/attachment-0001.html>


More information about the kde-edu mailing list