This file contains hidden or 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 [] | |
context [ | |
get-function: function [path] [ | |
if path? path [ | |
path: copy path | |
while [ | |
not any [ | |
tail? path | |
any-function? attempt [get/any either last? path [path/1] [path]] | |
] |
This file contains hidden or 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: "Toomas Vooglaid" | |
Date: 7-9-2017 | |
Last-update: 4-10-2017 | |
] | |
mx: context [ | |
ctx: self | |
mtx: object [ | |
rows: cols: data: none | |
get-col: func [col][extract at data col cols] |
This file contains hidden or 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 [ | |
Original: "Gregg Irwin" | |
Source: https://gitter.im/red/help?at=59b3040566c1c7c4772d4172 | |
Purpose: "Toy chatbot about Red functions" | |
Needs: "info.red (https://gist.github.com/toomasv/eaac3829ac5e745f43121aa60b555d68)" | |
] | |
; See: http://www.red-lang.org/2016/03/060-red-gui-system.html blog entry | |
; Lots of name choices to consider. |
This file contains hidden or 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} | |
usage: { | |
abc-score? <block of code> | |
abc-score? %file.red | |
abc-score? :some-function | |
} | |
description: { | |
The ABC software metric defines an ABC score as a triplet of values that represent the size of a set of source code statements. | |
An ABC score is calculated by counting the number of assignments (A), number of branches (B), and number of conditionals (C) in a program. |
This file contains hidden or 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: "Toomas Vooglaid" | |
Date: 25-9-2017 | |
Description: {Experiments with L-System} | |
Last-update: 26-9-2017 | |
Uses: {%models.red https://gist.github.com/toomasv/313e1d8583fb159428222651b76926cd} | |
Repo: https://github.com/toomasv/l-system | |
] | |
context [ | |
ctx: self |
This file contains hidden or 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: "generator function experiments" | |
Author: "Dave Andersen" | |
Date: 27-Sep-2017 | |
] | |
reload: does [do system/options/script] | |
; @JacobGood's closure func | |
closure1: func [ |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 [] | |
context [ | |
cases: copy [] | |
x: sum: probabilities: none | |
set 'pick-random func [items /size num /init probs /local out][ | |
x: random 100% | |
if init [ | |
probabilities: probs | |
cases: copy [] | |
sum: 0% |