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: "Demo how to serialize/deserialize a face tree on disk" | |
] | |
mold-face: function [root [object!] return: [string!]][ | |
foreach-face root [ | |
face/parent: none face/state: none | |
if font: face/font [font/parent: none font/state: none] | |
if para: face/para [para/parent: none] | |
] |
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: "Parse Info" | |
Purpose: { | |
Provides some stats about internal parse states usage for a given parsing job. | |
Could be used as a way to compare efficiency of different parsing strategies. | |
} | |
Date: 06-Oct-2017 | |
] | |
context [ |
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: {Implementation of a "capture-by-value" closure generator} | |
Date: 4-Oct-2017 | |
] | |
collect-words: function [ | |
spec [any-list!] | |
/deep | |
/set | |
/to-set |
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 [ | |
Note: "https://gitter.im/red/red?at=59d0e788f7299e8f539496d3" | |
] | |
time-it: func [block /count ct /local t baseline][ | |
ct: any [ct 1] | |
t: now/time/precise | |
loop ct [do []] | |
baseline: now/time/precise - t | |
t: now/time/precise |
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
turtle: #() | |
win: layout [ panel [ | |
tfield: base 500x500 white draw [] | |
origin tfield/offset tlayer: base 500x500 255.255.255.255 draw [] ] | |
panel [ | |
text "History" return history: text-list 200x350 data [] return | |
panel [ button "Save" [save request-file history/data] | |
button "Load" [commands: load request-file foreach cmd commands [process-cmd cmd]] ] | |
return status: text "" 200x25 ] |
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: "Dynamic View usage example" | |
Author: "Nenad Rakocevic" | |
Date: 08/07/2017 | |
] | |
generate: function [board [pair!] sz [pair!] return: [block!]][ | |
pane: make block! sz/x * sz/y | |
pos: 1x1 | |
count: 1 |
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
; We have other reflective functions (words-of, body-of, etc.), but | |
; this is a little higher level, sounded fun to do, and may prove | |
; useful as we write more Red tools. It also shows how to make your | |
; own typesets and use them when parsing. | |
arity-of: function [ | |
"Returns the fixed-part arity of a function spec" | |
spec [any-function! block!] | |
/with refs [refinement! block!] "Count one or more refinements, and add their arity" | |
][ |
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 [] | |
load-any: function [input [string!]][ | |
out: make block! 100 | |
junk: none | |
until [ | |
result: load/trap/next input 'pos | |
either error? result/3 [ | |
append any [junk junk: make string! 20] result/2/1 |
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: "ifgem" | |
] | |
#do [ | |
macro: context [ | |
make-object-spec: function [words] [ | |
spec: copy [] |
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: "Heart animation" | |
author: "Didier Cadieu" | |
notes: { | |
Traduction in Red/Rebol of Terebus Volodymyr javascript demo : http://codepen.io/tvolodimir/pen/wqKuJ | |
} | |
Needs: View | |
] | |
;*** Settings |