Page 1 of 1

Points

Posted: Fri Jun 21, 2013 10:49 am
by MaxV
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?

Re: Points

Posted: Fri Jun 21, 2013 11:39 am
by Klaus
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

Re: Points

Posted: Fri Jun 21, 2013 12:03 pm
by Dixie

Code: Select all

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

Re: Points

Posted: Fri Jun 21, 2013 12:23 pm
by MaxV
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.

Re: Points

Posted: Fri Jun 21, 2013 12:43 pm
by Klaus
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

Re: Points

Posted: Fri Jun 21, 2013 3:54 pm
by magice
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

Re: Points

Posted: Fri Jun 21, 2013 4:07 pm
by Klaus
Dixie wrote:

Code: Select all

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

Re: Points

Posted: Fri Jun 21, 2013 5:00 pm
by Dixie
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...

Re: Points

Posted: Fri Jun 21, 2013 5:07 pm
by Klaus
I guessed, Dixie, I guessed... ;-)

Re: Points

Posted: Fri Jun 21, 2013 11:52 pm
by mwieder
LOL.

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

Re: Points

Posted: Fri Jun 21, 2013 11:58 pm
by mwieder
@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.

Re: Points

Posted: Mon Jun 24, 2013 3:27 pm
by MaxV
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

Re: Points

Posted: Mon Jun 24, 2013 3:32 pm
by MaxV
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: