RosettaCode

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stam
Posts: 3092
Joined: Sun Jun 04, 2006 9:39 pm

RosettaCode

Post by stam » Sun Nov 07, 2021 9:19 pm

Hi all,

i came across a really useful resource: RosettaCode
Many of you have undoubtedly come across this before, but as i've not seen mention of it in the forums i though i'd post it here.
RosettaCode implements a number of common algorithms across a huge variety of languages, including liveCode, and I've found useful solutions there more than once.

I'd highly recommend this as a resource as the solutions tend to be as concise as possible and often very useful and thought-provoking - as well as having access to the same algorithm in all other languages for comparison.

They have basically set a number of algorithms to be performed in all languages and there is a list of algos still not being done in each language.

For liveCode, the pending algorithms are listed here: https://rosettacode.org/wiki/Reports:Ta ... n_LiveCode
I'll work on some but thought this might be good for the community at large both to consult and to contribute to - quite an interesting site.

Stam

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: RosettaCode

Post by richmond62 » Mon Nov 08, 2021 11:00 am

"Tasks not implemented in LiveCode"

Quite bewildering, but, Yes, a good landing place for
those in need of a spot of mental stretching. 8)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: RosettaCode

Post by dunbarx » Mon Nov 08, 2021 3:33 pm

I could not find "LiveCode" in the long list of programming environments.

Anyway, I thought I would try one of the simpler tasks, right at the top, the "99 bottles of beer". With a field 1 containing the first stanza, in a button script:

Code: Select all

on mouseUp
   put fld 1 into baseText
   put baseText into workingText
   repeat 98
      subtract 1 from word 1 of workingText
      subtract 1 from word 8 of workingText
      subtract 1 from word 18 of workingText
      put return & workingText after basetext
   end repeat
   replace "0" with "No more" in basetext
end mouseUp
Works fine, if a bit brute-force. But I could not publish it because my Safari browser is out of date for them.To get it updated, I would have to change from Catalina to Big Sur. I have heard odd things about LC and Big Sur. Anyone think it is not an issue?

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: RosettaCode

Post by richmond62 » Mon Nov 08, 2021 4:08 pm

Let's go OT . . .
I have heard odd things about LC and Big Sur. Anyone think it is not an issue?
My own experiences with MacOS 11 (Big Sur) were awful (especially re LiveCode),
so I got onto the beta programme for MacOS 12 (Monterey), and all the problems went away.

Now running the stable release of MacOS 12.

But I have a 2018 Mac Mini which does upgrade to MacOS 12.

My advice is that:

1. If your machine will upgrade to MacOS 12, upgrade it.

2. If your machine will NOT upgrade to MacOS 12 stick with MacOS 10.15 (Catalina),
and do NOT touch MacOS 11 (Big Sur) with a 10 foot pole.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: RosettaCode

Post by dunbarx » Mon Nov 08, 2021 5:00 pm

Richmond.

You of all people will love this about 10 foot poles.

https://www.milesgeek.com/decomposing-n ... ns-culture

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: RosettaCode

Post by richmond62 » Mon Nov 08, 2021 5:11 pm

Wow: interesting stuff.

Although a good Gaelic word comes to mind: Fioch. 8)

stam
Posts: 3092
Joined: Sun Jun 04, 2006 9:39 pm

Re: RosettaCode

Post by stam » Mon Nov 08, 2021 8:25 pm

dunbarx wrote:
Mon Nov 08, 2021 3:33 pm
I could not find "LiveCode" in the long list of programming environments.
erm... the page is already on the LiveCode section, the list is to navigate to all other languages, which is why you won't find LiveCode there lol ;)
Also note the 2nd link is the landing page missing/incomplete algorithms - and this is for the LiveCode language.

If you go to their homepage you can navigate to a link for all items for specific languages. For LiveCode, this is https://rosettacode.org/wiki/Category:LiveCode

It's a great resource for looking for algorithms like how to check if a certain year is a leap year, how to traverse folder structures recursively etc. Many have already contributed, but if people don't know about it, it's no good (much like this great language ;) )

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10339
Joined: Wed May 06, 2009 2:28 pm

Re: RosettaCode

Post by dunbarx » Tue Nov 09, 2021 4:30 am

Stam.

Right you are.

Craig

stam
Posts: 3092
Joined: Sun Jun 04, 2006 9:39 pm

Re: RosettaCode

Post by stam » Tue Nov 09, 2021 10:42 am

dunbarx wrote:
Mon Nov 08, 2021 3:33 pm
I have heard odd things about LC and Big Sur. Anyone think it is not an issue?
The change to Big Sur did bring some bugs but these were squashed in subsequent release candidates (best version was 9.6.2 RC2 - subsequent versions have included acknowledged issues with graphic objects, but the Big Sur bugs were resolved in my use cases).

The upgrade to MacOS Monterey 12.0.1 was much better in that respect; Ive not experienced a single new bug so far in LC.

However, curiously, LiveCloudManager (LiveCloud's tool for viewing online databases) seems to hang on startup every single time i launch this. This does not affect LiveCloud in any other way (ie it works just fine within LC), but it's a monumental PITA if trying to work on a new project.
So that was an unanticipated casualty...

simon.schvartzman
Posts: 665
Joined: Tue Jul 29, 2014 12:52 am

Re: RosettaCode

Post by simon.schvartzman » Tue Nov 09, 2021 1:52 pm

I have heard odd things about LC and Big Sur. Anyone think it is not an issue?
I have been using LC with Big Sur for several months now (on a MacBook Air M1) with no problem whatsoever, as a matter of fact I'm in doubt if I should upgrade to Monterrey right now of wait a bit to thing to settle a bit...
Simon
________________________________________
To ";" or not to ";" that is the question

Post Reply