English-like Language Comparison

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

English-like Language Comparison

Post by Simon » Wed Sep 19, 2012 2:02 pm

Hi,
Just watched K Miller's presentation at the Turing festival and wanted to know if there is a text file of the JavaScript vs LC example that I could get? I did see in another video in which LC was compared to many other languages which would be even better.


Thanks,
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: English-like Language Comparison

Post by Simon » Sun Sep 23, 2012 1:19 pm

OK, did it myself:

Code: Select all

Sort by last name decending:

Mr, Kevin, Miller		Mr, Mark, Waddingham
Mr, Ben, Beaumont		Ms, Heather, Nagey
Ms, Heather, Nagey		Mr, Kevin, Miller
Mr, Mark, Waddingham		Mr, Ben, Beaumont

	LiveCode:
sort lines of tText decending by last item of each

	JavaScript:
theText = theText.split("\n");
theText = theText.sort(sort_item_3).join("\n");
function sort_item_3(line1,line2) {
	line1 = line1.split(",");
	line2 = line2.split(",");
	if(line1[2] == line2[2] return 0;
	else if(line1[2] > line2[2] return -1;
	else return 1;
}
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: English-like Language Comparison

Post by Dixie » Sat Sep 29, 2012 12:23 pm

The javaScript snippet of nine lines is just a comparison of how many lines it would take using javaScript to accomplish what liveCode can do in one line... but I think that the most important point is that, the one line of liveCode code is much easier to read... justlike reading an instruction from a book... something that makes immediate sense rather than trying to decipher what the javaScript is trying to achieve...

be well

Dixie

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: English-like Language Comparison

Post by Simon » Mon Oct 01, 2012 2:30 pm

Hi cisprakash,
The JavaScript is not used within LiveCode. The 2 scripts are just an example. They are supposed to do exactly the same thing which is to sort the names by last name decending.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: English-like Language Comparison

Post by Klaus » Mon Oct 01, 2012 3:28 pm

Hi Simon,

I strongly believe that this is just SPAM!

The link in his sig points to a "IT professionals"(sic!) website, so these questions do not fit here somehow :wink:
Besides the fact that the prevevious postings leave no doubt about what is being discussed here.

I give him 2 days to proof that this is no spam... 8)


Best

Klaus

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: English-like Language Comparison

Post by Mark » Mon Oct 01, 2012 4:32 pm

Klaus,

No need to wait: http://qery.us/2l4

I'd remove the spam post and everything following it.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

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

Re: English-like Language Comparison

Post by Klaus » Mon Oct 01, 2012 5:19 pm

OK, and done :D

Post Reply