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: "Nędza Darek" | |
version: 0.0.1 | |
license: { | |
use/edit everywhere | |
post link to the gist/github | |
no waranties | |
} | |
] | |
get-draw-element: function [draw] [ |
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: "Nędza Darek" | |
license: "Just point to this gist/github" | |
link: https://gist.github.com/nedzadarek/43878a2eedd31c793e35eac854bcfe3d | |
] | |
; if `n` is in the cache just return `n` else print ['not-cached n] | |
fib: function [n] bind [ | |
cache | |
either c: cache/:n [ |
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
s1: {This is a description without example. | |
} | |
s2: {doc: description of s2 | |
example: foo <baz> <bar> | |
} | |
s3: {example: foo3 <baz> <bar> | |
} | |
f: func [str][ |
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: "Nędza Darek" | |
license: "point to this gist/github" | |
] | |
get-with-paren: function [:word [word! path! paren!]] [ | |
case [ | |
word? word [ | |
get get :word | |
] |
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: "Nędza Darek" | |
license: "Just point to this repository/gist" | |
content-used: [ | |
examples: http://www.red-by-example.org | |
docs: https://doc.red-lang.org/en/vid.html | |
] | |
bugs-new_features: [ | |
printing: {Print in nice form and divide by 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
view [ | |
do [start: end: 0x0 ] | |
b: base red 100x100 draw [] on-down [ | |
start: event/offset | |
] on-up [ | |
end: event/offset | |
append b/draw c: reduce ['box start end] | |
append a/text form c | |
append a/text newline | |
] |
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
probe-event: function [e] [ | |
fields: [ | |
type | |
; face window ; big objects - do you need them? | |
offset key picked flags away? down? mid-down? alt-down? ctrl? shift?] | |
foreach field fields [ | |
prin mold field | |
print ": " | |
probe e/:field | |
] |
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
; stop: 0:0:1 | |
2 -> 2.0 | |
4 -> 4.0 | |
6 -> 6.0 | |
8 -> 8.0 | |
10 -> 9.0 | |
12 -> 11.0 | |
14 -> 13.0 | |
16 -> 16.0 | |
18 -> 16.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: "Nędza Darek" | |
] | |
str: "a1bcvcvba2mcbncva3z" | |
find str "a" | |
iterator: copy #() | |
find-next: func [ | |
str candidate | |
/local |
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
func-set-local: func [spec body] [ | |
locals: copy [] | |
parse body [ | |
to any ['set set w lit-word! (probe w) (append locals w)] | |
to end | |
] | |
func append spec compose [/local (locals)] body | |
] | |
f: func-set-local [a b] [set 'c (a + b) c] |