售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Copyright and Credits
Learn Red – Fundamentals of Red
Dedication
Packt Upsell
Why subscribe?
PacktPub.com
Foreword
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
Red's Mission
Technical requirements
A short history of Red
What Red stands for
Some history
What makes Red special?
A full-stack language – from the metal to the meta
Code is data and data is code
Data types built in
Small toolchain and executables
Dialects
Red's main features
Portability
Like a Swiss Army knife
Summary
Questions
Setting Up for Development
Technical requirements
Installing Red
Installing Red on Windows
Installing Red on Linux and macOS
A look at the source code
Working interactively in the Red console
Running and compiling your first script
Executing a script in the Red console
Compiling a script to an executable
Development mode
Release mode
Other compilation options
Red's compilation model
Development environments for writing Red
Simple text editors
More sophisticated editors
Summary
Questions
Using Words, Values, and Types
Technical requirements
Understanding words and values
Some common datatypes
Using blocks and parens
Comments
Word bindings
Inferring types
Assigning and copying
Working with words
More about types
Converting types
The type system
Evaluating expressions and blocks
Some basic operations
Working with Boolean values
Working with numbers
Making random objects
Order of evaluation
Evaluation with do and reduce
The structure of a Red program
Summary
Questions
Further reading
Code-Controlling Structures
Technical requirements
Getting input from the user – input and ask
Testing conditions
if
unless
either
Stopping a program – halt or quit
switch and case
catch and throw
Structuring repetitions
Repeating a number of times – loop or repeat
Repeating with a condition – while or until
A number-guessing game
Handling errors
attempt and try
Using error?
Creating and catching errors
Checking types
Summary
Questions
Working with Series and Blocks
Technical requirements
Series and blocks
Navigating and looping through a series
A step at a time – head, tail, index?, and next
Looping through a series – foreach and forall
Getting information from a series
Selecting an item – pick and /
Searching for an item – select and find
Sorting
Changing a series
Changing items – poke, replace, and change
Adding new items – append, repend, and insert
append
repend
insert
Deleting items – remove and take
Moving items – move and swap
Series as sets
Copying a series
Strings as series
Splitting a string – split
Turning a series into a string – form
Rejoining a block – rejoin
Clearing part of a string – clear and trim
Adding to a string – append and insert
Other useful tricks
Summary
Questions
Using Functions and Objects
Technical requirements
A fauna of functions
The do word
The does word
The has word
The func word
The function word
Copying a local series
Function attributes
Passing arguments
Typing arguments
Return values – return and exit
Refinements
Code style and documentation strings
Working with functions
Error handling
Recursive functions
Importing functions with do
Code is data and data is code
Using reflection on functions
The source word
The body-of function
Changing the header and body of a function through code
Code is just data – load
Using objects
The make word
Working with objects
Creating objects
Working with fields and functions
Copying objects and inheritance
Looking inside an object
Summary
Questions
Working with Files
Technical requirements
Selecting a file or folder
Working with file paths and directories
Reading and writing data files
Working with binary files
The image! datatype
Downloading a file from the internet
Loading and saving files
Saving and loading the console history
Downloading currency exchange rates
Using query string parameters
Summary
Questions
Parsing Data
Technical requirements
The bitset! datatype
Understanding how parse works
First parse examples
Using some and any
Matching positions
Choosing with |
Searching, extracting, and changing
Working with variables – to, thru, and copy
Executing code on a match
Changing data – change, remove, and insert
More features and examples
Using end
Building special languages
Changing a rule on the fly
Parsing blocks and code
Debugging parse
Summary
Questions
Composing Visual Interfaces
Technical requirements
Structuring an interface
First example – a screen for downloading exchange rates
Running the example
Examining the code
Building a layout
Faces and actions
Two-way binding
Container settings – view
Changing an app's icon
View's refinements
Using do in view
Layout commands
A faces walkthrough
Base, box, and image
Text faces – h1, text, field, and area
Button, check, and radio
List faces – text-list, drop-list, and drop-down
Panel, group-box, and tab-panel
Progress bar and slider
Styles
Events and actors
Multiple events
Timer event
Actors are objects
Detecting the keyboard
Menus
Basic contacts app
An introduction to the draw dialect
Summary
Questions
Further reading
Advanced Red
Technical requirements
Reactive programming
Red/System
Comparing Red and Red/System
Calling a Red/System script from within Red
Interacting with the operating system
Getting input from command-line arguments
Calling an external program – call
Using the OS clipboard – read-clipboard
Datatypes for performance
The vector! datatype
The map! and hash! datatypes
Embedded Red and macros
Embedded Red
Macros
Red for smart contract programming
Red/C3
Using Red for writing dapps
Red's roadmap
Some useful references
Summary
Questions
Further reading
Assessments
Other Books You May Enjoy
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜