Points

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
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Points

Post by MaxV » Fri Jun 21, 2013 10:49 am

Hi,
I tried this:

Code: Select all

2,2 + 3,3
I expected 5,5 as result, on the contrary Livecode result is 2,5,3 .
Why?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Points

Post by Klaus » Fri Jun 21, 2013 11:39 am

Hi Max,

sorry, but as a long time LC user I am asking myself, why you are exspecting 5,5? :-)
The addition seem correct behavior to me:
A comma delimited list with an addition in the middle.

Did you enter this into the message box?
Without any command? Hmmm 8-)

In any way this is not how Liveocde works, you will need to add the ITEMS of the points separately.


Best

Klaus

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Points

Post by Dixie » Fri Jun 21, 2013 12:03 pm

Code: Select all

put 2.2 + 3.3
will return 5.5 in the message box...

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Points

Post by MaxV » Fri Jun 21, 2013 12:23 pm

Yes, I understood.
I tried also:

Code: Select all

(2,2) + (3,3)
but I can't act on points directly.
There are some features that I'd like introduced on Livecode:
  • working directly on point and rect
  • working on date and time directly (12/Mar/2013 + 1 = 13/Mar/2013; 3:02 + 1:00 = 4:02)
On rebol language is a standard, and now rebol is open source, rebol it's in C and C++ like LiveCode, so an inclusion of these features could be possible.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Points

Post by Klaus » Fri Jun 21, 2013 12:43 pm

Hi Max,
MaxV wrote:Yes, I understood.
I tried also:

Code: Select all

(2,2) + (3,3)
but I can't act on points directly.
Exactly!
MaxV wrote:[*]working on date and time directly (12/Mar/2013 + 1 = 13/Mar/2013; 3:02 + 1:00 = 4:02)[/list]
You can use "dateitems" to work with time and dates (almost) directly!
MaxV wrote:On rebol language is a standard, and now rebol is open source, rebol it's in C and C++ like LiveCode, so an inclusion of these features could be possible.
No idea about Rebol 8-)


Best

Klaus

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Points

Post by magice » Fri Jun 21, 2013 3:54 pm

you can create a custom function to do this. something like:

Code: Select all

function addPoints firstPoint secondPoint 
   add the first item of firstPoint to the first item of secondPoint
   add the second item of firstPoint to the second item of secondPoint
   return secondPoint
end addPoints

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Points

Post by Klaus » Fri Jun 21, 2013 4:07 pm

Dixie wrote:

Code: Select all

put 2.2 + 3.3
will return 5.5 in the message box...
Go figure! A little bored? :-D

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Points

Post by Dixie » Fri Jun 21, 2013 5:00 pm

Klaus, you can laugh... but that is what I thought the poster was trying to figure out... but I did get bored when the 'old chesnut' of comparing what 'liveCode' does, or does not do compared to some 'other' language reared its ugly head...

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Points

Post by Klaus » Fri Jun 21, 2013 5:07 pm

I guessed, Dixie, I guessed... ;-)

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Points

Post by mwieder » Fri Jun 21, 2013 11:52 pm

LOL.

Your message contains 4 characters. The minimum number of characters you need to enter is 10.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Points

Post by mwieder » Fri Jun 21, 2013 11:58 pm

@MaxV- I'm curious about what you expect to get if you add two points together.
Another point?
Is the second set of coordinates supposed to be an offset to the first set?
If that's the case, what would you expect for a rectangle? (100,200,200,300) + (3,3) = ?
I think there's a limit to the guessing that the parser can do with the input it's given.

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Points

Post by MaxV » Mon Jun 24, 2013 3:27 pm

mwieder wrote:@MaxV- I'm curious about what you expect to get if you add two points together.
Another point?
Yes
mwieder wrote: Is the second set of coordinates supposed to be an offset to the first set?
Yes
mwieder wrote: If that's the case, what would you expect for a rectangle? (100,200,200,300) + (3,3) = ?
Nothing, type mismatch.
mwieder wrote: I think there's a limit to the guessing that the parser can do with the input it's given.
Well, it's my fault; I was used with this:

Code: Select all

type? 2x5  = point!
type? 125.212.101 = color! (rgb format)
type? 2/3/2103 =  date!
type? "hello"  = string!
type?  20.30.150.200 = rect!
type?  10:20 = time!
# operations
2x2 + 3 = 5x5
2x2 + 3x4 = 5x6
150.3.200 + 1 =  151.4.201
151.3.200 + 10.25.37 = 161.28.237
 2/3/2013 + 35 = 6-Apr-2013
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Points

Post by MaxV » Mon Jun 24, 2013 3:32 pm

However I'm sorry, I didn't want start a war LangA is better than LangB.

I prefer LiveCode, absolutely. Rebol was definitely abandoned in 12/12/2012. If LiveCode developers are interested to take some nice feature, sources and examples are here:
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply