ShoneSharp Language (S #) design and use introduction series (7)-Boolean Bool and Object,

Source: Internet
Author: User
Tags acos asin natural logarithm

ShoneSharp Language (S #) design and use introduction series (7)-Boolean Bool and Object,

 

 

ShoneSharp Language (S #) design and use introduction series (7)-Boolean Bool and Object Author: Shone

Disclaimer: you are welcome to repost the original article, but please indicate the source, https://www.cnblogs.com/shonesharp.

Abstract: Boolean value (corresponding to the bool of C #) indicates the status "yes" or "no", corresponding to the keywords "true" and "false. An object (corresponding to the object in C #) represents any object. It is a base type of all types, and the keyword null indicates an empty object. Objects have a lot of usage in S #. If you are familiar with them, you will understand:Check whether a mountain is a mountain, whether a mountain is a mountain, or whether a mountain is a mountain..

Software: S # language editor, runtime environment. NET 4.0, green software, single EXE run directly, no side effects. Online drive download link for https://pan.baidu.com/s/1dF4e08p

 

Blog writing is still very hard, so please stick to it. After introducing the Boolean and Object types today, we will go to the S # special introduction, let's look at it to see if it can attract more popularity:

Series (7)-the best "formula" Style

Series (8)-first-class citizens "functions" are cool

Series (9)-rich children's "statement" does not show off wealth

Series (10)-"class" dressing and dressing into "table"

1. Boolean

Boolean (corresponding to the bool of C #) indicates yes or no. S # reserves two keywords true and false. Of course, you can also enter True/False, or/No.

Boolean values are generally used for logical judgment. Almost all modern languages support this type.

Ii. Object

An object (corresponding to the object in C #) represents any object and is a base type of all types. S # reserves a keyword null for it, indicating a null object.

Programming Languages have always argued about the advantages and disadvantages of strong and weak types. The root cause is the existence of objects (pointers in C ++. My personal opinions on strong and weak types take the moderate way, and I think it is necessary to support them. They have their own advantages and disadvantages.

ObjectThere is a lot of use in S #. If you are familiar with it, you can reach the realm of Meditation: Watching mountains are mountains, watching water is water; watching mountains are not mountains, watching water is not water; see mountains or mountains, see water or water.

Let alone S # code:

{
     1 + 2,
     1 + [10, 20],
     [1, 2] + 10,
     [10, 20, 30] + [1, 2],
     cos (30),
     cos ([10, 20, 30]),
     cos ({10, [20, 30], 40}),
     cos ({
         a = 10,
         b = 20,
         c = [30, 40],
         d = {50, 60},
         f = {m = 90}
     })
}
//Calculation results:
{
     3,
     [11, 21],
     [11, 12],
     [11, 22, 32],
     0.86602540378443871,
     [
         0.984807753012208,
         0.93969262078590843,
         0.86602540378443871
     ],
     {
         0.984807753012208,
         [
             0.93969262078590843,
             0.86602540378443871
         ],
         0.766044443118978
     },
     {
         0.984807753012208,
         0.93969262078590843,
         [
             0.86602540378443871,
             0.766044443118978
         ],
         {0.64278760968653936, 0.5},
         {0}
     }
} 

The parameters accepted by many operators, functions, attributes, and methods are objects, indicating that they can accept multiple data types. For details, see the Member description.

3. Constants

Bool False

Note: No

Input: False

 

Bool True

Note: Yes

Input: True

 

Object Null

Description: null.

Input: Null

 

Iv. Single Object Operator

! Object → Object

Returns the inverse of a Boolean value.

Enter :! True

Evaluate: False

 

-Object → Object

Description: Negative object removal.

Input:-10

 

~ Object → Object

Views: array and list inversion.

Input :~ [1, 2, 3]

Evaluate: [3, 2, 1]

 

V. binary operator

Object! = Object → Bool

Determines whether the values of two objects are completely different.

Input: 5! = 10

Evaluate: True

 

Object ?? Object → Object

Description: non-empty values

Input: null ?? 10

Evaluate: 10

 

Object <Object → Object

Determines whether the value is smaller

Input: 5 <10

Evaluate: True

 

Object <= Object → Object

Determines whether the value is less than or equal

Input: 5 <= 10

Evaluate: True

 

Object = Object → Bool

Determines whether the values of two objects are completely equal.

Input: 5 = 10

Evaluate: False

 

Object> Object → Object

Determines whether the value is greater

Input: 5> 10

Evaluate: False

 

Object> = Object → Object

Determines whether the value is greater than or equal

Input: 5> = 10

Evaluate: False

 

Object % Object → Object

Note: Object Redundancy

Input: 10% 3

Evaluate: 1

 

Object & Object → Object

Description: boolean values and Phases

Input: true & false

Evaluate: False

 

Object & Object → Object

Notes: array concatenation

Input: [1, 2] & [10, 20]

Evaluate: [1, 10, 20, 2]

 

Object * Object → Object

Description: Multiplication of Objects

Input: 5*10

Evaluate: 50

 

Object/Object → Object

Note: Object Division

Input: 10/3

Evaluate: 3.3333333333333335

 

Object ^ Object → Object

Description: Object multiplication party

Input: 5 ^ 3

Evaluate: 125

 

Object-Object → Object

Note: Object Subtraction

Input: 5-10

Evaluate:-5

 

Object | Object → Object

Note: insert an array

Input: [1, 2] | [10, 20]

Evaluate: [1, 10, 2, 20]

 

Object | Object → Object

Description: boolean values or

Input: true | false

Evaluate: True

 

Object + Object → Object

Description: object addition

Input: 5 + 10

Evaluate: 15

 

6. Other Symbols

Object [Double: Double] → Object

Returns an array of child elements.

Input: [,] []

Evaluate: [20, 30]

 

Object [Object | Object [],...] → Object

Description: obtains child elements.

Input: [10, 20, 30] [1]

Evaluate: 20

 

VII. Functions

Bool assert (bool arg ,...)

Description: boolean values of assertion series (true is normal and false is incorrect)

Input: assert (true)

Evaluate: True

 

Object abs (Object obj)

Description: returns the absolute value.

Input: abs (-100)

Evaluate: 100

 

Object acos (Object obj)

Description: returns the arc cosine angle value.

Input: acos (0.5)

Evaluate: 60

 

Object ACO (Object obj)

Description: returns the arc hyperbolic cosine radian value.

Input: acosh (1.5)

Evaluate: 0.96242365011920694

 

Object actg (Object obj)

Description: Reverse tangent angle value.

Input: actg (1)

Evaluate: 45

 

Object actgh (Object obj)

Description: returns the arc-Hyperbolic arc tangent radians.

Input: actgh (1.5)

Evaluate: 0.80471895621705014

 

Object among (Object t, Double d1, Double d2)

(For linear interpolation of the [d1, d2] interval parameter t)

Input: among (0.25)

Evaluate: 8

 

Object asin (Object obj)

Description: returns the arc sine angle.

Input: asin (0.5)

Evaluate: 30

 

Object asinh (Object obj)

Description: returns the arc-hyperbolic sine-radian value.

Input: asinh (0.5)

Evaluate: 0.48121182505960347

 

Object atg (Object obj)

Description: returns the arc tangent angle value.

Input: atg (1)

Evaluate: 45

 

Object atgh (Object obj)

Description: returns the arc hyperbolic tangent radians.

Input: atgh( 0.5)

Evaluate: 0.54930614433405489

 

Object ceil (Object obj)

Returns the rounded value.

Input: ceil (9.8)

Evaluate: 10

 

Object ceil (Object obj, Double d)

Description: calculates the integer value based on the step size.

Input: ceil (10.4, 0.5)

Evaluate: 10.5

 

Object cos (Object obj)

Description: returns the cosine of an angle.

Input: cos (60)

Evaluate: 0.5

 

Object cosh (Object obj)

Returns the hyperbolic cosine of radians.

Input: cosh (0.5)

Evaluate: 1.1276259652063807

 

Object ctg (Object obj)

Description: returns the reverse angle value.

Input: ctg (45)

Evaluate: 1

 

Object ctgh (Object obj)

Description: returns the hyperbolic inverse tangent of radians.

Input: ctgh( 0.5)

Evaluate: 2.1639534137386529

 

Object exp (Object obj)

Description: Evaluate the power of nature.

Input: exp (10)

Evaluate: 22026.465794806718

 

Object floor (Object obj)

Description: calculates the rounded value.

Input: floor (9.4)

Evaluate: 9

 

Object floor (Object obj, Double d)

Description: calculates the integer value based on the step size.

Input: floor (10.4, 0.5)

Evaluate: 10

 

Object lg (Object obj)

Description: returns the base logarithm of 10.

Input: lg (10)

Evaluate: 1

 

Object ln (Object obj)

Description: Calculate the natural logarithm value.

Input: ln (10)

Evaluate: 2.3025850929940459

 

Object log (Object obj, Double newBase)

Description: calculates the specified base logarithm value.

Input: log (10, 2)

Evaluate: 3.3219280948873626

 

Object param (Object d, Double d1, Double d2)

Description: evaluate the value of d in the range [d1, d2 ].

Input: param (4,0, 8)

Evaluate: 0.5

 

Object round (Object obj)

Returns the rounded integer value.

Input: round (10.5)

Evaluate: 11

 

Object round (Object obj, Double d)

Returns the integer rounded by step.

Input: round (10.4, 0.5)

Evaluate: 10.5

 

Object sign (Object obj)

Description: calculates the symbolic value.

Input: sign (-10)

Evaluate:-1

 

Object sin (Object obj)

Description: returns the sine of an angle.

Input: sin (30)

Evaluate: 0.5

 

Object sinh (Object obj)

Description: returns the hyperbolic sine of radians.

Input: sinh (0.5)

Evaluate: 0.52109530549374738

 

Object sqrt (Object obj)

Description: calculates the square root value.

Input: sqrt (10)

Evaluate: 3.1622776601683795

 

Object tg (Object obj)

Description: returns the tangent of an angle.

Input: tg (45)

Evaluate: 1

 

Object tgh (Object obj)

Returns the hyperbolic tangent of radians.

Input: tgh (0.5)

Evaluate: 0.46211715726000974

 

Object trunc (Object obj)

Description: truncates an integer.

Input: trunc (9.5)

Evaluate: 9

 

Object trunc (Object obj, Double d)

Description: truncates an integer by step.

Input: trunc (10.4, 0.5)

Evaluate: 10

 

8. Attributes

Object. cm_print

Description: Print 1 CM = 10mm/WcsScale

Input: x. cm_print

 

Object. cm_unit

Description: converts 1 cm to 10mm.

Input: x. cm_unit

 

Object. dm_print

Note: Print 1 cent meter = 100mm/WcsScale

Input: x. dm_print

 

Object. dm_unit

Description: 1-byte meter = 100

Input: x. dm_unit

 

Object. dmm_print

Note: Print 1-wire meter = 0.01mm/WcsScale

Input: x. dmm_print

 

Object. dmm_unit

Description: 1-wire meter = 0.01

Input: x. dmm_unit

 

Object. ft_print

Note: Print 1 feet = 304.8/WcsScale

Input: x. ft_print

 

Object. ft_unit

Description: The conversion rate is 1 feet = 304.8.

Input: x. ft_unit

 

Double Object. HashCode

Description: hash code.

Input: x. HashCode

 

Object. in_print

Note: Print 1 inch = 25.4/WcsScale

Input: x. in_print

 

Object. in_unit

Description: The conversion rate is 1 inch = 25.4.

Input: x. in_unit

 

Object. km_print

Note: Print 1Km = 1000000mm/WcsScale

Input: x. km_print

 

Object. km_unit

Description: 1Km = 1000000

Input: x. km_unit

 

Object. m_print

Note: Print 1 m = 1000mm/WcsScale

Input: x. m_print

 

Object. m_unit

Description: 1 meter = 1000mm

Input: x. m_unit

 

Object. mi_print

Note: Print 1 mile = 1609344mm/WcsScale

Input: x. mi_print

 

Object. mi_unit

Description: 1 mile = 1609344

Input: x. mi_unit

 

Object. mm_print

Note: Print 1mm = 1mm/WcsScale

Input: x. mm_print

 

Object. mm_unit

Description: converts 1mm to 1mm.

Input: x. mm_unit

 

Object. nm_print

Note: Print 1 Nm = 0.000001mm/WcsScale

Input: x. nm_print

 

Object. nm_unit

Description: 1 Nm = 0.000001mm

Input: x. nm_unit

 

Object. nmi_print

Note: Print 1 nautical mile = 1852000/WcsScale

Input: x. nmi_print

 

Object. nmi_unit

Description: 1 nautical mile = 1852000

Input: x. nmi_unit

 

String Object. OutCsv

Returns the corresponding Csv string.

Input: x. OutCsv

 

String Object. OutStr

Description: returns the corresponding string.

Input: x. OutStr

 

String Object. SpanStr

Converts a string to a span string.

Input: x. SpanStr

 

String Object. ToStr

Description: converts a string to a corresponding string.

Input: x. ToStr

 

String Object. TypeName

Description: type name.

Input: x. TypeName

 

Object. um_print

Description: Print 1 micron = 0.001mm/WcsScale

Input: x. um_print

 

Object. um_unit

Description: 1 micron = 0.001

Input: x. um_unit

 

String Object. xy‑str

Description: Simplified XY text

Input: x. xy1_str

 

String Object. XYStr

Description: Corresponding XY text

Input: x. XYStr

 

String Object. xyz1_str

Description: Corresponding XYZ simplified text

Input: x. xyz1_str

 

String Object. XYZStr

Description: Corresponding XYZ text

Input: x. XYZStr

 

Object. yd_print

Note: Print 1 code = 914.4mm/WcsScale

Input: x. yd_print

 

Object. yd_unit

Description: 1 yard = 914.4

Input: x. yd_unit

 

Object. Ruler _ print

Note: Print 1-foot = 333.33333mm/WcsScale

Input: x. Ruler _ print

 

Object. Ruler _ unit

Description: 1-foot = 333.33333

Input: x. Ruler _ unit

 

Object. Inch _ print

Note: Print 1-inch = 33.3333333mm/WcsScale

Input: x. Inch _ print

 

Object. Inch _ unit

Description: 1-inch = 33.3333333

Input: x. Inch _ unit

 

Object. Minute _ print

Note: Print 1 point = 3.3333333mm/WcsScale

Input: x. Minute _ print

 

Object. Minute _ unit

Description: 1 point = 3.3333333

Input: x. Minute _ unit

 

Object. PCT _ print

Note: Print 1 cent = 0.3333333mm/WcsScale

Input: x. PCT _ print

 

Object. PCT _ unit

Description: 1 cent = 0.3333333mm

Input: x. PCT _ unit

 

_ Print in Object.

Note: Print 1 to 500000mm/WcsScale

Input: x. In _ print

 

_ Unit in Object.

Description: Converting 1 to 500000mm

Input: x. Li _ unit

 

Object. zhang_print

Note: Print 1-foot = 3333.3333333mm/WcsScale

Input: x. zhang_print

 

Object. zhang_unit

Description: conversion: 1 Zhang = 3333.3333333

Input: x. zhang_unit

 

IX. Methods

Object. Mirror (Object axis)

Description: The image relative to the specified axis

Input: x. Mirror (axis (30 ))

 

Object. 3D 3D (Object plane)

Description: a flat image is relative to a specified image.

Input: x. mega3d (plane3d (0, 0), vect3d (0, 0 )))

 

Object. Oblique (Object)

Note: The relative origin does not have rotation skew.

Input: x. Oblique (10)

 

Object. Oblique (Object a, Object oblique)

(Relatively point O rotation tilt, pay attention to all the line segments in Direct Generation of Qu, oblique = 0 rotation without bias, 1 rotation oblique, 2 rotation oblique, 3 rotation oblique, NaN rotation oblique)

Input: x. Oblique (10, 1)

 

Object. ObliqueAt (Object p, Object a, Object oblique)

(Relatively point O rotation tilt, pay attention to all the line segments in Direct Generation of Qu, oblique = 0 rotation without bias, 1 rotation oblique, 2 rotation oblique, 3 rotation oblique, NaN rotation oblique)

Input: x. ObliqueAt (0, 0), 10, 1)

 

Object. Pan (Object dx, Object dy)

Note: Step Size Translation

Input: x. Pan (10, 10)

 

Object. Pan3d (Object dx, Object dy, Object dz)

Note: Step Size Translation

Input: x. Pan3d (10, 10, 10)

 

Object. Pan3dP (Object p)

Note: Reference Translation

Input: x. Pan3dP (10, 10, 10 ))

 

Object. Pan3dV (Object v)

Note: vector Translation

Input: x. Pan3dV (vect3d (10, 10, 10 ))

 

Object. Pan3dX (Object dx)

Note: horizontal translation

Input: x. Pan3dX (10)

 

Object. Pan3dY (Object dy)

Note: vertical translation

Input: x. Pan3dY (10)

 

Object. Pan3dZ (Object dz)

Description: normal Translation

Input: x. Pan3dZ (10)

 

Object. PanLA (Object l, Object)

Description: Translation of length and Angle

Input: x. PanLA (10, 30)

 

Object. PanLI (Object l, Object I)

Description: Translation of the length and slope

Input: x. PanLI (10, 0.25)

 

Object. PanP (Object p)

Note: Reference Translation

Input: x. PanP (10, 10 ))

 

Object. PanV (Object v)

Note: vector Translation

Input: x. PanV (vect (10, 10 ))

 

Object. PanX (Object dx)

Note: horizontal translation

Input: x. PanX (10)

 

Object. PanXA (Object dx, Object)

Note: horizontal angle Translation

Input: x. PanXA (10, 30)

 

Object. PanXI (Object dx, Object I)

Description: horizontal slope Translation

Input: x. PanXI (10, 0.25)

 

Object. PanY (Object dy)

Note: vertical translation

Input: x. PanY (10)

 

Object. PanYA (Object dy, Object)

Description: vertical angle Translation

Input: x. PanYA (10, 30)

 

Object. PanYI (Object dy, Object I)

Description: vertical slope Translation

Input: x. PanYI (10, 0.25)

 

Object. Project3d (Object plane)

Description: projection relative to a specified plane

Input: x. Project3d (plane3d (0, 0, 0), vect3d (0, 0 )))

 

Object. Rotate (Object)

Description: it rotates counter-clockwise relative to the origin.

Input: x. Rotate (30)

 

Object. Rotate3d (Object axis, Object)

Description: it rotates counter-clockwise relative to the specified axis.

Input: x. Rotate3d (axis3d (30), 30)

 

Object. Rotate3dX (Object)

Description: it rotates counter-clockwise relative to the X axis.

Input: x. Rotate3dX (30)

 

Object. Rotate3dY (Object)

Description: it rotates counter-clockwise relative to the Y axis.

Input: x. Rotate3dY (30)

 

Object. Rotate3dZ (Object)

Description: it rotates counter-clockwise relative to the Z axis.

Input: x. Rotate3dZ (30)

 

Object. RotateAt (Object o, Object)

Note: The relative point O is rotated counter-clockwise.

Input: x. RotateAt (0, 0), 30)

 

Object. Scale (Object s)

Description: scales proportionally relative to the origin.

Input: x. Scale (2)

 

Object. Scale3d (Object s)

Description: scales proportionally relative to the origin.

Input: x. Scale3d (2)

 

Object. Scale3dAt (Object o, Object s)

Description: proportional scaling relative to point O

Input: x. Scale3dAt (0, 0, 0), 2)

 

Object. ScaleAt (Object o, Object s)

Description: proportional scaling relative to point O

Input: x. ScaleAt (0, 0), 2)

 

Object. ScaleXY (Object sx, Object sy)

Note: scales proportionally relative to the origin. All line segments are replaced directly.

Input: x. ScaleXY (1, 2)

 

Object. ScaleXYAt (Object p, Object sx, Object sy)

Note: scales proportionally relative to the point O, and all line segments are replaced directly.

Input: x. ScaleXYAt (0, 0), 1, 2)

 

Object. Set3dX (Object x)

Note: set X

Input: x. Set3dX (10)

 

Object. Set3dY (Object y)

Description: sets Y.

Input: x. Set3dY (10)

 

Object. Set3dZ (Object z)

Note: set Z

Input: x. Set3dZ (10)

 

Object. SetX (Object x)

Note: set X

Input: x. SetX (10)

 

Object. SetY (Object y)

Description: sets Y.

Input: x. SetY (10)

 

Object. Transform (Object ucs)

Description: it is switched out of the specified coordinate system.

Input: x. Transform (ucs (30 ))

 

Object. Transform3d (Object ucs)

Description: it is switched out of the specified coordinate system.

Input: x. Transform3d (ucs3d (30 )).

The last three chapters are based on data types and member categories, but the disadvantage is that beginners seem easy to confuse and the content is boring. But it's over. With these four unremarkable bricks, let's see what kind of building can be built later.

 

Disclaimer: you are welcome to repost the original article, but please indicate the source, https://www.cnblogs.com/shonesharp.

Software: S # language editor, runtime environment. NET 4.0, green software, single EXE run directly, no side effects. Online drive download link for https://pan.baidu.com/s/1dF4e08p


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.