Getting Snakey

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 2:16 pm

mag.jpg
-
I bought this in an airport bookshop . . . possibly the easiest, simplest intro I have seen for 12 Euros.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 2:19 pm

So . . . I am getting started with Python because market forces are pushing me that way

(fancy way of saying that parents here in Bulgaria have been asking if I can teach an "Intro to Python" course
for kiddos this summer: now I no longer have to lie. :D )

From a personal point of view it is not a bad thing to look at Python as it throws up questions
about LiveCode . . .

bogs
Posts: 5101
Joined: Sat Feb 25, 2017 10:45 pm

Re: Getting Snakey

Post by bogs » Sat Feb 15, 2020 2:33 pm

What... no assembly ? :D
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 2:35 pm

So; here we go . . .
-
pq1.png
pq1.png (12.4 KiB) Viewed 2871 times
-

Code: Select all

put 99/2 -- 49.5

Code: Select all

put 99 mod 2 --remainder
but I am not sure how to get non-floating point result in LiveCode.
Last edited by richmond62 on Sat Feb 15, 2020 2:46 pm, edited 3 times in total.

bogs
Posts: 5101
Joined: Sat Feb 25, 2017 10:45 pm

Re: Getting Snakey

Post by bogs » Sat Feb 15, 2020 2:42 pm

Hm. Not sure, but do you mean this?
aPic_Remainder.png
It 'remains' to be seen...
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 2:45 pm

No:

I mean this:

99 / 2 = 49

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 2:55 pm

What is the point of this?
-
pq2.png
pq2.png (6.43 KiB) Viewed 2861 times

bogs
Posts: 5101
Joined: Sat Feb 25, 2017 10:45 pm

Re: Getting Snakey

Post by bogs » Sat Feb 15, 2020 2:58 pm

I'm sorry, I have no idea what you are talking about.
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 3:02 pm

What... no assembly ?
Ouch . . . did some Assembly in 1984, and it was, frankly, pretty Orwellian!

Round these parts (Bulgaria) the voices I hear in my head are whispering "C++", "C#", "Java script" and "Python."

Interestingly enough no-one seems to be teaching Python; so, at the risk of slipping on a banana-skin I'm attempting
to fill a niche.

Frankly, in spit of the very, very clear Black Dog Magazine the whole thing feels like the PASCAL 5 I studied in 1984 . . .
retro and completely 'anal' about formatting, indenting and so on.

But, whatever my personal objections it is rather nice to open the fridge and find food there. 8)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 3:04 pm

I'm sorry, I have no idea what you are talking about.
Oh, well, that isn't the first time . . . :D

bogs
Posts: 5101
Joined: Sat Feb 25, 2017 10:45 pm

Re: Getting Snakey

Post by bogs » Sat Feb 15, 2020 3:34 pm

Well, I like playing with assembly, since it was the first language I messed with. As long as you kept things moving smoothly through the registers, it all came out ok.

I also like Pascal (and Delphi) which came after it, I thought Borland did a fantastic job with it, and there were no surprises with how things worked. Not sure how you consider Pascal to be anal about formatting, but I see a lot in common between Lc and Delphi, especially in the syntax.

I agree you should have food in the fridge as well, but what I'm not sure I understand is, you said - before you edited the post, which was after I replied - that you were unsure how to get a remainder in Lc from division. You then put some (what I assume are) examples using print in Python. I put an example of division with a remainder.

After you edited your post, it looks like your not looking for remainders, even though 99/2 would leave a '.5' remainder. So now I am unsure what exactly your trying to accomplish :roll:

The point of your last example, using .upper appears to be the equivalent of Lc's toUpper (also could use 'upper') function, turning lower case into upper case. However, since I know you already know that, I really don't get where your going. Were you mixing vodka with your orange juice this morning ?
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 5:13 pm

No Vodka this morning, nor, frankly this afternoon as I exist in a different time zone to thee. 8)

Also: I do NOT drink Vodka; a drink that, presumably exists only for getting sloshed (after all it has very little taste) strikes
me as fairly foul.

I have never seen any value in something that changes everything to upper case or the other way round.
Last edited by richmond62 on Sat Feb 15, 2020 5:28 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 5:24 pm

as to this:-
-
pq1.png
pq1.png (12.4 KiB) Viewed 2809 times
-
The first thing performs a floating-point division.

The second thing performs a a division that rounds DOWN to an integer.

The third thing performs a a division that rounds DOWN to an integer and then gives you the REMAINDER.

Now I know how to perform the first and the third operation, but not the second in LiveCode,
and as those operationsin Python are explained on "page 2" of that magazine (page 43).
.

bogs
Posts: 5101
Joined: Sat Feb 25, 2017 10:45 pm

Re: Getting Snakey

Post by bogs » Sat Feb 15, 2020 5:45 pm

richmond62 wrote:
Sat Feb 15, 2020 5:24 pm
Now I know how to perform the first and the third operation, but not the second in LiveCode,
The second in Lc is 'div', as in
aPic_integerDivision.png
I thought something was dangling there...
aPic_integerDivision.png (6.98 KiB) Viewed 2805 times
richmond62 wrote:
Sat Feb 15, 2020 5:13 pm
I have never seen any value in something that changes everything to upper case or the other way round.
The upper function changes what you specify (or not) to upper, handy if say, you chop a sentence in half, and want the first character recapitalized, you might use (psuedo code)

Code: Select all

put upper(char 1 of line 12 of field "newSentence")
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Getting Snakey

Post by richmond62 » Sat Feb 15, 2020 6:18 pm

Thanks for div, I have never come across that before. :oops:

Post Reply

Return to “Off-Topic”