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
flatten: func [tree [block!] /level lvl /local rule l][ | |
(l: -1) | |
rule: [(l: l + 1) some [ | |
ahead block! if (any [not level l < lvl]) into rule (l: l - 1) | |
| keep skip | |
| none | |
]] | |
parse tree [collect rule] | |
] |
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 [] | |
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 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 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 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 [] | |
swap*: func [a b /part length /local tmp] [ | |
either part [ | |
tmp: copy/part a length | |
change/part a copy/part b length length | |
change/part b tmp length | |
head a | |
][ | |
swap 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 [ | |
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 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
#( | |
title: "Blocky 1" | |
language: [#"L" "L+L-L-LL+L+L-L"] | |
initial: "L+L+L+L" | |
iterations: 3 | |
options: [angle 90 length 0x100 scale 1.0 origin 200x470 anti-aliasing? (false)] | |
) | |
#( | |
title: "Blocky 2" | |
language: [#"L" "LL+L-L+L+LL"] ; FF-F+F-F-FF |
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: "Toomas Vooglaid" | |
Started: 2-10-2017 | |
Uses: {%matrix.red (https://github.com/toomasv/matrix)} | |
Last-update: 6-10-2017 | |
] | |
do https://tinyurl.com/ybvyqxcu | |
cx: context [ | |
m: size: cell: _Img: _Cyc: cyc: steps: real-size: data: i: sz: go: _Size: _Cell: d: o: offset: none | |
history: 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 [] | |
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% |
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: "Toomas Vooglaid" | |
Date: 2017-10-24 | |
Needs: View | |
] | |
context [ | |
system/view/auto-sync?: dragable?: off-the-post?: no | |
offset: pos-x: post: current-post: post1: post2: post3: disc: disc1: disc2: disc3: disc4: steps: thickness: none | |
post1-narrow: charset [ 48 - 52] | |
post2-narrow: charset [148 - 152] |