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
b: [] | |
;== [] | |
v1: ["a" "B"] | |
;== ["a" "B"] | |
v2: ["A" "b"] | |
;== ["A" "b"] | |
alter b v1 b | |
;== [["a" "B"]] |
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: {Request a date} | |
Purpose: {To enter a date using a calendar display} | |
Author: "Rudolf W. MEIJER" | |
File: %request-date.red | |
Notes: {Inspired by the corresponding Rebgui facility} | |
Language: 'English | |
Tabs: 4 | |
] ; end prologue |
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
foreach-face: func [{Evaluates body for each face in a face tree matching the condition} | |
face [object!] "Root face of the face tree" | |
body [block! function!] {Body block (`face` object) or function `func [face [object!]]`} | |
/with "Filter faces according to a condition" | |
spec [block! none!] "Condition applied to face object" | |
/post {Evaluates body for current face after processing its children} | |
/sub post? "Do not rebind body and spec, internal use only" | |
/local exec continue ; <-- addition #0 | |
][ | |
unless block? face/pane [exit] |
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: "Loads an INI file and returns a map!" | |
notes: "semi-colons treats as comment" | |
] | |
load-ini: function [ini [file! string!]] [ | |
m: copy #() | |
if file? ini [ini: read ini] | |
parse ini [some [copy word to "=" skip copy value to [";" | newline | end] pos: ( | |
if #";" = pos/1 [ | |
unless pos: find pos newline [pos: tail ini] |
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 [] | |
do %profile.red | |
sum1: func [ | |
"Return sum of numbers in a block" b /safe "Coerce to return float in case of overflow" /local s v | |
] [ | |
s: 0 | |
foreach v b [ |
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: "Find functions with missing doc for their refinements" | |
Date: 2018-07-28 | |
Author: "Endo" | |
License: "MIT" | |
File: %Refinements.red | |
] | |
;find all natives, op, functions, actions that have refinement(s) | |
remove-each word words: words-of system/words [ |
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 | |
delta-time: function [ | |
"Return the time it takes to evaluate a block" | |
code [block! word! function!] "Code to evaluate" | |
/count ct "Eval the code this many times, rather than once" | |
][ | |
ct: any [ct 1] |