REBOL / Red Shopping Cart - Rebol-red Typing CST Test
Loading…
REBOL / Red Shopping Cart — Rebol-red Code
Adds and removes items in a shopping cart with total cost.
cart: copy []
prices: copy []
addItem: func [item price] [
append cart item
append prices price
print rejoin ["Cart: " cart]
print rejoin ["Total: " sum prices]
]
removeItem: func [index] [
remove cart index
remove prices index
print rejoin ["Cart: " cart]
print rejoin ["Total: " sum prices]
]
; Simulate actions
addItem "Apple" 2
addItem "Banana" 3
removeItem 1Rebol-red Language Guide
Rebol and its modern descendant Red are high-level, cross-platform programming languages designed for simplicity, domain-specific languages, and full-stack development. Rebol emphasizes compact syntax and data exchange, while Red adds native compilation, GUI support, and system-level capabilities.
Primary Use Cases
- ▸Scripting and automation
- ▸Cross-platform GUI applications
- ▸Domain-specific language creation
- ▸Networking and internet protocols
- ▸Rapid prototyping and native applications (Red)
Notable Features
- ▸Minimalist, expressive syntax
- ▸Dialect-based programming (DSLs)
- ▸Cross-platform support (Red: native binaries)
- ▸GUI library support (Red/View)
- ▸Dynamic typing with optional static types (Red)
Origin & Creator
Rebol was created by Carl Sassenrath in 1997 to enable efficient data exchange and scripting. Red was initiated in 2011 by Nenad Rakocevic as a modern, native successor to Rebol.
Industrial Note
Rebol/Red excels in small-footprint tools, cross-platform GUI apps, DSL creation, and scripting tasks that benefit from concise syntax and runtime flexibility.
Quick Explain
- ▸Rebol/Red allows developers to write concise and expressive code for scripting, DSLs, and application logic.
- ▸Rebol is interpreted, while Red can compile to native binaries for multiple platforms.
- ▸Commonly used for GUI apps, networking, DSLs, scripting, and cross-platform tools.
Core Features
- ▸Interpreted language (Rebol) / compiled native (Red)
- ▸Series-based data structures for sequences
- ▸Rich string, block, and object manipulation
- ▸Event-driven GUI programming with Red/View
- ▸Cross-platform binary compilation (Red)
Learning Path
- ▸Learn Rebol/Red syntax and series data structures
- ▸Practice scripting automation tasks
- ▸Explore dialects for DSL design
- ▸Develop GUI apps with Red/View
- ▸Compile and distribute native Red binaries
Practical Examples
- ▸Scripting automated file processing tasks
- ▸Creating cross-platform desktop GUI apps
- ▸Defining domain-specific mini-languages
- ▸Developing networked chat or server apps
- ▸Prototyping native applications with Red compiler
Comparisons
- ▸More compact syntax than Python or Ruby
- ▸DSL-focused design unlike general-purpose languages
- ▸Red binaries are faster than Rebol interpreted scripts
- ▸Less library ecosystem than mainstream languages
- ▸Better suited for prototyping and specialized tasks
Strengths
- ▸Compact and readable syntax
- ▸Rapid prototyping with minimal code
- ▸DSL creation flexibility
- ▸Cross-platform deployment with Red
- ▸GUI programming simplified with Red/View
Limitations
- ▸Smaller community compared to mainstream languages
- ▸Limited libraries and tooling compared to Python or Java
- ▸Rebol is mostly interpreted; Red is newer and evolving
- ▸Performance depends on usage patterns (Rebol slower than Red)
- ▸Not ideal for high-performance computing or large-scale enterprise apps
When NOT to Use
- ▸Large-scale enterprise software
- ▸High-performance computing
- ▸Web backend services (unless lightweight)
- ▸Mobile app development outside Red's experimental targets
- ▸Projects needing large third-party library ecosystem
Cheat Sheet
- ▸print "Hello World" - print output
- ▸func: func [x y][x + y] - define function
- ▸block: [1 2 3 4] - define block/series
- ▸view [button "Click" [print "Clicked"]] - Red/View GUI
- ▸do %script.red - run Red script
FAQ
- ▸Is Rebol still maintained?
- ▸Yes, community versions exist; Red is actively developed.
- ▸Can Red compile native binaries?
- ▸Yes, Red compiles to fast cross-platform native executables.
- ▸Does Rebol support GUI?
- ▸GUI support is limited; Red/View is recommended for GUI.
- ▸Is Red suitable for large projects?
- ▸Mostly for small to medium apps; can scale carefully.
- ▸Are Rebol/Red good for DSLs?
- ▸Yes - dialects allow easy creation of domain-specific mini-languages.
30-Day Skill Plan
- ▸Week 1: Rebol basic syntax and blocks
- ▸Week 2: Functions, objects, and series manipulation
- ▸Week 3: DSL creation using dialects
- ▸Week 4: Red/View GUI development
- ▸Week 5: Compiling and packaging Red native apps
Final Summary
- ▸Rebol/Red are high-level, expressive languages focused on simplicity and DSL creation.
- ▸Rebol is interpreted, excellent for scripting, while Red adds native compilation and GUI support.
- ▸Red/View simplifies cross-platform desktop app development.
- ▸Ideal for small-footprint, high-productivity projects and specialized DSLs.
Project Structure
- ▸src/ - Rebol/Red source files
- ▸lib/ - optional external modules or scripts
- ▸bin/ - compiled binaries (Red)
- ▸assets/ - resources like images or data
- ▸tests/ - test scripts and validation
Monetization
- ▸Commercial lightweight desktop apps
- ▸Cross-platform utilities
- ▸Open-source GUI tools
- ▸DSL products for specialized domains
- ▸Automation and productivity scripts
Productivity Tips
- ▸Leverage dialects for concise DSLs
- ▸Use Red/View for GUI prototyping
- ▸Organize scripts modularly
- ▸Compile Red scripts for distribution
- ▸Reuse common blocks and modules across projects
Basic Concepts
- ▸Series, blocks, and objects as core data structures
- ▸Functions (actions) and word evaluation
- ▸Rebol dialects for domain-specific programming
- ▸Event-driven GUI programming (Red/View)
- ▸Cross-platform compilation with Red
Official Docs
- ▸Rebol Official Documentation
- ▸Red Official Documentation
- ▸Red/View GUI Guide