Logarithmic Search [Solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Logarithmic Search [Solved]

Post by atout66 » Fri Feb 20, 2015 11:01 am

Hi to all,

This post refers to the lesson from this page:
http://lessons.runrev.com/s/lessons/m/4 ... h-an-array
It refers to the section <function logarithmicSearch > provided in that page.
The problem: at line

Code: Select all

put round ((pLeft + pRight) / 2) into tIndex
the debugger stop with an error as:(Operator +: error in right operand), char 9
char 9 is <+>
Here is a piece of code for this function.

Code: Select all

function logarithmicSearch @pArray pItem pLeft pRight
    local tIndex
    local tResult
    # create a new range pointer that points to the item that lies
    # right between the left and right range pointers
    put round ((pLeft + pRight) / 2) into tIndex
pLeft = 0 and pRight = 35 in my example...

Any idea would be much appreciated.
Thanks
Last edited by atout66 on Fri Feb 20, 2015 11:35 am, edited 1 time in total.
Discovering LiveCode Community 6.5.2.

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

[Solved]Re: Logarithmic Search [Solved]

Post by atout66 » Fri Feb 20, 2015 11:33 am

Oups, sorry to all, I realised that my <pRight> argument was a list ! not a unique number.

I the modo want to remove this post, no problem at all...

Sorry.
Discovering LiveCode Community 6.5.2.

Post Reply