Post Reply 
Uppercase vs lowercase clarification
04-30-2018, 04:44 AM
Post: #1
Uppercase vs lowercase clarification
I prefer programming in lower case, so usually can get away with programming in lowercase eg.
Code:

is_digit(c)  // is character c a digit or .
begin
  local ch := asc(c);
  ch := ch[0];  // asc returns a list so extract the val we want
  return (ch >= 48 and ch <= 57) or c = ".";
end;

str_to_int(s)  // convert into int if possible, otherwise return original
begin
  local i, result, c, is_int;
  for i from 1 to size(s) do
    if NOT is_digit(s[i, 1]) then 
      return s; end;
  end;
  return expr(s);
end;

export aslist(s)  // split a string of lines into a list
begin
  local i, line := "";
  local result := {};
  for i from 1 to size(s) do
    if s[i] = 10 then
      if size(line) > 0 then 
        line := str_to_int(line);
        result := concat(result, line); end;
      line := "";
    else
      line := line + s[i,1]
    end;
  end;
  if size(line) > 0 then 
    line := str_to_int(line);
    result := concat(result, line); end;
  return result;
end;
which comes from my recent post re RPN simulator helper utility for prime.

I did have to change the 'not' into NOT however.

Can anyone tell me what words cannot be lowercase? And what normal mode (non-cas) functions might clash with lowercase cas functions if they were expressed in lowercase?

The reason I am asking is twofold. I want to program in lowercase, for non-cas mode programs. And I want to extend the syntax highlighter for Mac Textwrangler/BBEdit correctly, see my recent post.
Find all posts by this user
Quote this message in a reply
04-30-2018, 05:22 AM
Post: #2
RE: Uppercase vs lowercase clarification
Hello,

ALL the home functions are case insensitive.
All the home (and system) variables ARE case sensitive (e, i, HAngle, A-Z, ...)
As far as I Can remember, ALL the app specific functions and vars ARE case sensitive

CAS functions are lowercase by default, and most of them accept full uppercase variations (they are not case insensitive "per-say" as it is more of an all of nothing type situation).
CAS variables are case sensitive.

In home, home stull always takes precedent. In CAS, cas stuf takes precedent.

Hope that this helps.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
04-30-2018, 08:13 AM
Post: #3
RE: Uppercase vs lowercase clarification
Thank you Cyrille - very helpful!

Am still curious why 'NOT' could not be expressed as 'not' ? Its arguably neither variable nor function - an operator, I'd say. So perhaps operators are case sensitive. In fact when I type 'and' into the home screen it auto converts to uppercase AND, supporting the case for uppercase operators. On the other hand, I seem to be able to use lowercase 'and' in a program e.g.

Code:

EXPORT test1()
BEGIN
  return NOT (1 and 0);
END;

So amongst operators, 'NOT' is case sensitive yet 'AND' is not case sensitive?
'BITNOT' is not case sensitive either and seems ok expressed as 'bitnot'. Is 'NOT' an exception?

I haven't checked any other operators yet - pending any more comments/thoughts.
Find all posts by this user
Quote this message in a reply
05-02-2018, 05:07 AM
Post: #4
RE: Uppercase vs lowercase clarification
Hello,

Operators display might be mangled by the 2D display system.Actually, come thinking about this, the display will probably "case correct" any of the build ins as it just records a pointer to the function definition (and it's default case), but does not keep the text hat you entered in memory.

as to why not seems to be case sensitive, at a quick glance, it looks like it is due to some speciall hardcodding that is done in the PArser to handle this prefix operator. This code only tests NOT as uppercase.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: