Assessments

Chapter 1

  1. Red/System is the part of Red needed to do lower-level programming like C.
  2. A full-stack language is a language that can be used on the whole spectrum of programming, from systems level to high-level language construction. Red together with Red/System is able to do that.
  3. Red and LISP both have the block (or list) as its basic structure, for code as well as for data.
  4.  1) Red has a very small tool-chain, with no installation and configuration

                    2) The size of its executables is around 1 Mb

                    3) The reduced size of its source files.

  1. A dialect is a specialized high-level language written in Red. Examples: parse, view, Red/C3
  2. Red is compiled to native code, while REBOL is always interpreted.
  3. Red runs in Windows, Linux, Android, OS X and FreeBSD environments in a 32 bit version, also on ARMv5 processors.

Chapter 2

  1. Refer to exercise1.red

  2. red.r is the REBOL script used currently to compile Red to Red/System, and Red/System to native code
  3. A self-hosting language has a compiler that is written in itself (in the case of Red, written in Red)
  4. The do function
  5. libRedRT is not needed in release mode
  6. The compiled code of libRedRT is contained within the program's executable
  7. Visual Studio Code with the Red plugin gives you code completion

Chapter 3

  1. It gives a *** Script Error: John has no value. Corrected: name: "John"
  2. See explanation in text
  3. i1 ;== 1   i2  ;= 
    The point is that (i1: 1) itself has the value 1 and the effect that i1 refers to 1 from then on.
  4. print [10 * 5] ;== 50

                   probe [10 * 5]  ;== [10 * 5]

  1.  to_float 42 *** Script Error: to_float has no value.
    to_float is not a known word.
  1. (Chapter03/evaluation.red):
        print (6 < 13) and (42 < 33)   ;== false
print (43 < 42) xor (44 < 43) ;== false
print complement 3 ;== -4
  1. a: "red" ;== "red"
    b: copy a ;== "red"
    a = b ;== true ;same value
    a == b ;== true ;same value and datatype
    a =? b ;== false ;not the same object!
  1. print [3 = 2 tab 5 = 5 tab 1 = 1.0]     ; == false     true     true
  2. on = (5 = 5) ;== true
  3. ? now
      REFINEMENTS:

/year => Returns year only.

/month => Returns month only.

/day => Returns day of the month only.

/time => Returns time only.

/zone => Returns time zone offset from UCT (GMT) only.

/date => Returns date only.

/weekday => Returns day of the week as integer (Monday is day 1).

/yearday => Returns day of the year (Julian).

/precise => High precision time.

/utc => Universal time (no zone).
  1. square-root 9 + square-root 9

    Same as:  square-root (9 + square-root 9)

    Same as:  square-root (9 + 3)

    Same as:  square-root (12)  ;== 3.464101615137754

      (square-root 9) + square-root 9     ;== 6.0

  1. minimal.red
      –c compilation:  66kB
–r compilation: 583 kB

 

Chapter 4

  1. see testing-conditions.red QA 1
  2. out ;== "bad luck"
  3. see raining.red
  4. see testing_conditions.red ; QA 4
  5. see testing_conditions.red ; QA 5
  6. see repetitions.red ; QA 6
  7. see count-down.red

Chapter 5

  1. data: ["A" "B" "C" "D"] is a series of strings, the following is a series of characters: data: [#"A" #"B" #"C" #"D"]
  2. see navigating-and-looping.red section ; moving to the tail.
  3. see navigating-and-looping.red section ; back.
  4. see navigating-and-looping.red section ; skip.
  5. see navigating-and-looping.red  ; QA 5.
  1. see getting-info.red section ; selecting an item
  2. see getting-info.red section ; QA 7
  3. see getting-info.red section ; QA 8
  4. see getting-info.red section ; QA 9
  5. see getting-info.red ; QA 10
  6. see changing-series.red ; QA 11
  7. see strings-as-series.red ; QA 12

Chapter 6

  1. see do-error-runtime.red for an explanation about the error and when you get to see it.
  2. see do-does-has-func.red section ; QA 1
  3. see do-does-has-func.red section ; QA 2 ?
    The variable num defined in has1 becomes a global variable, whereas has2 turns its num2 argument into a local variable.
  1. see do-does-has-func.red section ; QA 4
  2. see function-atrributes.red section ; QA 5
  3. see function-atrributes.red section ; QA 6
  4. see working-with-functions.red section ; QA 7
  5. see working-with-functions.red section ; QA 8
    Restricting the type of n with  n [integer!] is also ok, but would provoke an exception.
    To test if n = 0 you can also write if zero? n
  6. see working-with-functions.red section ; QA 9
  7. see objects.red ; QA 10
  8. see objects.red QA 11

Chapter 7

  1. see reading-and-writing-files.red, section QA 1: each item is written on a different line.
  2. idem QA 2
  3. idem QA 3
  1. see saving-and-loading.red QA 4: after load the block structure is recovered.
  2. see saving-and-loading.red QA 5
  3. see currency-rates3.red

Chapter 8

  1. see bitsets.red section QA 1
  2. see bitsets.red section QA 2
  3. see bitsets.red section QA 3
  4. see how-parse-works.red section QA 4
  5. see how-parse-works.red section QA 5
  6. see searching-and-changing.red QA 6
  7. see searching-and-changing.red QA 7
  8. see searching-and-changing.red QA 8
  9. see searching-and-changing.red QA 9
  10. see more-features.red QA 10

Chapter 9

  1. see currency-rates-gui2.red
  2. see faces-are-objects.red
  3. see close-window-quit.red and close-window-unview.red
  4. see container-layout.red section QA 4
  5. see button-check.red
  6. see sorted-text-list.red
  7. see extracted-text-list.red
  8. see text-hover-wheel.red
  9. see drawing-lines.red

Chapter 10

  1. see reactive-drag.red
  2. Non-reactive version is box-color-non-reactive.red, reactive version is box-color-reactive.red
  1. see hello.reds
      Compile it with: red –r hello.reds
To execute: ./hello
  1. print-test.red calls print-test.reds
  2. see perf-datatypes.red, section QA 5
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.103.5