This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "Red help functions" | |
Author: "Gregg Irwin" | |
File: %help.red | |
Tabs: 4 | |
Rights: "Copyright (C) 2013-2017 All Mankind. All rights reserved." | |
License: { | |
Distributed under the Boost Software License, Version 1.0. | |
See https://github.com/dockimbel/Red/blob/master/BSL-License.txt | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
author: ["Maxim Velesyuk" "Gregg Irwin"] | |
description: "Dynamic variables implementation for Red" | |
notes: { | |
http://www.gigamonkeys.com/book/variables.html | |
TBD: Better names. | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Author: "Gregg Irwin" | |
Purpose: "COMPOSE for strings" | |
Notes: { | |
TBD: Security model for eval'ing expressions | |
} | |
] | |
; The name of the function (`composite`) is tricky. Rebol calls this | |
; `build-markup`, which isn't bad, but defines a more limited view of its |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bottles: func [n][ | |
switch/default n [ | |
0 ["no more bottles"] | |
1 ["1 bottle"] | |
][form reduce [n "bottles"]] | |
] | |
verse: func [n][ | |
either n = 0 [ | |
{No more bottles of beer on the wall, no more bottles of beer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sing: function [input][ | |
input: copy input | |
n: orig-num: first input | |
sing-verse: func [n][ | |
print [ | |
n =phrase "on the wall," n =phrase ".^/" | |
"Take one down and pass it around," | |
either n > 1 [n - 1]["no more"] =phrase "on the wall.^/" | |
] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] | |
e.g.: :comment | |
; Using a context here, because Red's compiler doesn't like inner funcs yet. | |
defaulting-ctx: context [ | |
def: func [w "Word" v "Value"][ | |
; We're setting one word, so don't need to use set/only. | |
if any [not value? :w none? get w][set w :v] | |
get w |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datatype-doc-strings: [ | |
action! "Polymorphic native datatype function" | |
binary! "Series of byte values" | |
bitset! "Set of bit flags, used with parse as charsets" | |
block! "Series of heterogeneous values" | |
char! "Single unicode character" | |
datatype! "Value category, determines form and behavior" | |
date! "Combined date, time, and timezone" | |
decimal! "Accurate decimal value, no floating point error" | |
email! "Email address" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "Nsource - native source" | |
Purpose: "Print source for native functions" | |
Author: "Boleslav Březovský" | |
Date: "8-6-2017" | |
] | |
indent: func [ | |
"(Un)indent text by tab" | |
string [string!] "Text to (un)indent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Purpose: "Simple tile game where you can set the the board and button size." | |
Author: "Gregg Irwin" | |
Notes: { | |
Based on https://github.com/red/code/blob/master/Showcase/tile-game.red | |
Shows how to dynamically generate a VID GUI, including static elements. | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
title: "Drop-down demo" | |
author: "Gregg Irwin" | |
] | |
; The data facet accepts arbitrary values, but only string values will be added | |
; to the list and displayed. Extra, non-string values can be used to create | |
; associative arrays, using strings as keys. The `selected` facet is a 1-based | |
; integer index, indicating the position of the selected string in the list, | |
; not in the `data` facet. |