How to control if a list isn't void?
|
07-01-2015, 11:02 PM
Post: #1
|
|||
|
|||
How to control if a list isn't void?
hi,
I've this code: Code:
I need a better way to control if the list Long_Lat {} is not void and has two elements with correct format: {-14°30′40″, 37°55′55″} (or almost two reals)... thank you Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
07-02-2015, 01:32 AM
(This post was last modified: 07-02-2015 01:32 AM by Helge Gabert.)
Post: #2
|
|||
|
|||
RE: How to control if a list isn't void?
I would simply test (with "type()") if your HMS construct or your pair of reals belongs to DOM_SPECIALFLOAT or DOM_FLOAT, respectively (works in CAS).
|
|||
07-02-2015, 05:32 AM
Post: #3
|
|||
|
|||
RE: How to control if a list isn't void?
(07-02-2015 01:32 AM)Helge Gabert Wrote: I would simply test (with "type()") if your HMS construct or your pair of reals belongs to DOM_SPECIALFLOAT or DOM_FLOAT, respectively (works in CAS). I'll try, thank you! ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
07-02-2015, 02:20 PM
(This post was last modified: 07-02-2015 02:21 PM by Helge Gabert.)
Post: #4
|
|||
|
|||
RE: How to control if a list isn't void?
When I tried it, I realized you need to convert into a string as well, i.e.
string(type(7°30'))==string(DOM_SPECIALFLOAT) returns 1. |
|||
07-02-2015, 02:26 PM
Post: #5
|
|||
|
|||
RE: How to control if a list isn't void?
(07-02-2015 02:20 PM)Helge Gabert Wrote: When I tried it, I realized you need to convert into a string as well, i.e. I want save into →HMS() format... I'm using this in my astronomy program: the initial input asks to save coordinates, if the user chooses yes it saves into an exported var, otherwise it set a default couple of coordinates, then if the var exists, the program load the var into two fields and set two vars (lat, long)... Maybe to control only for type it's enough (why someone should change a var exported by the program?), but... ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)