The old Google Groups will be going away soon, but your browser is incompatible with the new version.
TypeError MD0017 Invalid operands given opcode
 There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic. There was an error processing your request. Please try again. Standard view   View as tree
 5 messages

From:
To:
Cc:
Followup To:
Subject:
 Validation: For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon.

More options Apr 17 2012, 9:47 pm
From: Ray Song <emacs...@gmail.com>
Date: Wed, 18 Apr 2012 09:47:12 +0800
Local: Tues, Apr 17 2012 9:47 pm
Subject: [bug?] TypeError MD0017 Invalid operands given opcode
Hi all, I'm working on an implementation of Kuhn-Munkres algorithm when come cross this issue.

falcon: FATAL - Program terminated with error.
TypeError MD0017 at a._lambda#_id_5:11: Invalid operands given opcode
Traceback:
a._lambda#_id_5:11(PC:0)
"/home/ray/a.fal" a._lambda#_id_5:16(PC:232)
"/home/ray/a.fal" a.KuhnMunkres:30(PC:440)
"/home/ray/a.fal" a.__main__:55(PC:168)

The source code in question:

function KuhnMunkres(a)
lx = [].comp(a, {s => reduce({a,b => max(a, b)}, s)})
ly = [].comp(a, {=> 0})
mate = [].comp(a, {=> nil})
fx = nil
fy = nil

n = a.len()

augment = function(x)
fx[x] = true
for y in [0:n]: if not fy[y]
t = lx[x] + ly[y] - a[x][y]
if t == 0
fy[y] = true
if mate[y] == nil or fself(mate[y])
mate[y] = x
return true
end
end
end
return false
end

for x in [0:n]
loop
fx = [].comp(a, {=> false})
fy = [].comp(a, {=> false})
delta = nil
if augment(x): break
for xx in [0:n]: if fx[xx]
for yy in [0:n]: if not fy[yy]
t = lx[xx] + ly[yy] - a[xx][yy]
if delta == nil or t < delta: delta, optx, opty = t, xx, yy
end
end

for i in [0:n]
if fx[i]: lx[i] -= delta
if fy[i]: ly[i] += delta
end
> fx.describe(), fy.describe()
input()
end
end

sum = {s => reduce({a,b => a+b}, s)}
return sum(lx) + sum(ly)
end

a = .[ .[1 2 3]
.[5 0 2]
.[3 2 1] ]

> KuhnMunkres(a)

Thanks in advance for any suggestions.

To post a message you must first join this group.
You do not have the permission required to post.
 Discussion subject changed to "{FalconPL} [bug?] TypeError MD0017 Invalid operands given opcode" by Giancarlo Niccolai
More options Apr 18 2012, 9:01 am
From: Giancarlo Niccolai <g...@niccolai.cc>
Date: Wed, 18 Apr 2012 15:01:45 +0200
Local: Wed, Apr 18 2012 9:01 am
Subject: Re: {FalconPL} [bug?] TypeError MD0017 Invalid operands given opcode
On 18/04/2012 03:47, Ray Song wrote:

I didn't run it, but isn't ...

function ...

fx = nil
fy = nil

n = a.len()

function ...
fx[ ... ]

closing a nil in fx?  -- if so, fx[...] will always be invalid, as the value it had when closed was a nil (invalid operands can refer to a nil[x] accessor).

Gian.

To post a message you must first join this group.
You do not have the permission required to post.
More options Apr 18 2012, 9:13 am
From: Ray Song <emacs...@gmail.com>
Date: Wed, 18 Apr 2012 21:13:50 +0800
Local: Wed, Apr 18 2012 9:13 am
Subject: Re: {FalconPL} [bug?] TypeError MD0017 Invalid operands given opcode

This issue is triggered when the function `augment' is called by `fself(mate[y])' . The most reliable guess I come up with is that a nested called inner function does not have access to variables in the outer function, which a directly called inner function has.

Is there any other approach to circumvent this issue?

To post a message you must first join this group.
You do not have the permission required to post.
More options Apr 18 2012, 9:32 am
From: Giancarlo Niccolai <g...@niccolai.cc>
Date: Wed, 18 Apr 2012 15:32:23 +0200
Local: Wed, Apr 18 2012 9:32 am
Subject: Re: {FalconPL} [bug?] TypeError MD0017 Invalid operands given opcode
On 18/04/2012 15:13, Ray Song wrote:

Uhm, tested the  program; it seems there's something wrong with fself:
it calls the function, but not the closure. A working workaround is:

augment = function(x, func)
...
if mate[y] == nil or func(mate[y],func)
....

if augment(x, augment): break

Gian.

To post a message you must first join this group.
You do not have the permission required to post.
More options Apr 18 2012, 12:03 pm
From: Giancarlo Niccolai <g...@niccolai.cc>
Date: Wed, 18 Apr 2012 18:03:44 +0200
Local: Wed, Apr 18 2012 12:03 pm
Subject: Re: {FalconPL} [bug?] TypeError MD0017 Invalid operands given opcode
On 18/04/2012 15:32, Giancarlo Niccolai wrote:

Just committed a patch on the main git branch where fself points to the
actual closure. This requries a bit of extra time at call frame, but
since we're nearing an alpha release in the new engine (which deals with
performance of call frames), the performance issue is not very relevant.

Gian.