Good morning to all,

I have the following unicon program

procedure main()
local inp, outp, line, trials, credit, items, itemsl, itemol, i, j, cnt, eli, p1, p2, el2, trace
    inp := open("sc.txt", "rt")
    outp := open("scr.txt", "w")
    trace := open("trace.txt", "w")
    itemol := list()
    itemsl := list()
    items := set()
    trials := read(inp) + 0
    write(trace, "$", trials, "$")
    every i := 1 to trials do {
        credit := read(inp) + 0
        write(trace, "credit:", credit)
        cnt := read(inp) + 0
        write(trace, "cnt:", cnt)
        j := 1
        write(trace, line := read(inp)) ? while j <= cnt do {
            write(trace, "j:", j)
            write(trace, "&subject:", &subject)
            write(trace, "&pos:", &pos)
            move(many(" "))
            write(trace, "&pos:", &pos)
            write(trace, "#", &digits, "#")
            (eli := move(many(&digits))) # <==== problem line
            write(trace, "&pos:", &pos)
            write(trace, eli)
            insert(items, credit >= eli)
            itemol := put(itemol, eli)
            itemsl := put(itemsl, credit >= eli)
            j +:= 1
        }
        itemsl := sort(itemsl)
        while /p1 | /p2 do {
            eli := pop(itemsl)
            el2 := credit - eli
            if member(items, el2) then
                every j := 1 to cnt do {
                    /p1 := (itemol[j] = eli) & j
                    p2 := (itemol[j] = el2) & j
                }
        }
        write(outp, "case #", i, (p1 > p2) | p1 ,(p1 <= p2) | p1)
    }
end


which is giving the following error

Run-time error 102
File storecredit.icn; Line 27
numeric expected
offending value: "75 25"
Traceback:
   main()
   {100 >= "75 25"} from line 27 in storecredit.icn

The data file being used is attached as well as the trace file created during the program run. Is there an error between keyboard and chair or is it in the function many(). I expected that the value being returned back from the line marked above should have been "75". What I did notice was that the first time through, the value of &pos was expected to be 2 but was 3 instead.

I am running 32 bit linux Fedora 17 on a Toshiba NB500 netbook.with the following Unicon version

unicon -version
Unicon Version 12.1.  November 19, 2012

regards

Bruce Rennie


3
100
3
5 75 25
200
7
150 24 79 50 88 345 3
8
8
2 1 9 4 4 56 90 3
$3$
credit:100
cnt:3
5 75 25
j:1
&subject:5 75 25
&pos:1
&pos:1
#0123456789#
&pos:3
5 
j:2
&subject:5 75 25
&pos:3
&pos:3
#0123456789#
&pos:8
75 25
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to