== %/C/$Recycle.Bin/S-1-5-21-2591063332-1437243679-3381992044-1002/ >> ll $IJZSB9O.adoc $IOOBK12.html $RD8ECNO/ .����0003000000061666d56ae6179e777be2 .����00030000000616e8dd50a72ab4668b33 .����000400000006f0624d774787a48947ac desktop.ini
>> cd .. == %/C/ >> next-dir *** Access Error: cannot open: %/C/$Recycle.Bin/0ddcedc6dddb6b5384675bcf1728/ *** Where: do *** Stack: next-dir change-dir cause-error >> next-dir == %/C/$Recycle.Bin/S-1-5-21-2591063332-1437243679-3381992044-1002/
lcs: func [a b][ lens: make block! 1 + x: length? a loop x + 1 [append/only lens append/dup make block! 1 + y: length? b 0 y + 1] repeat i x [ repeat j y [ lens/(i + 1)/(j + 1): either a/:i = b/:j [ lens/:i/:j + 1 ][ max lens/(i + 1)/:j lens/:i/(j + 1) ] ] ] result: make type? a min x y while [all [0 < x 0 < y]][ case [ lens/(x + 1)/(y + 1) = lens/:x/(y + 1) [x: x - 1] lens/(x + 1)/(y + 1) = lens/(x + 1)/:y [y: y - 1] 'else [ if a/:x = b/:y [ insert/only result a/:x ] x: x - 1 y: y - 1 ] ] ] result ]
>> lcs "12462" "1224533324"
== "1242"
>> lcs [1 two [three] 3 #(four: 4)] [one two three #(four 4)]
== [two #(
four: 4
)]
>> lcs "12462" [#"1" #"2" #"2" #"3" #"4"]
== "124"
; But no alternatives
>> lcs [#"1" #"2" #"2" #"3" #"4"] "12462"
== [#"1" #"2" #"2"]lcs: function [a b][ case [ a == b [return copy a] empty? a empty? b [return copy ""] ] while [all [a b a/1 == b/1]][a: next a b: next b] start: index? a x: length? a y: length? b while [all [x > 0 y > 0 a/:x == b/:y]][x: x - 1 y: y - 1] lens: make block! 1 + x;: length? a loop x + 1 [append/only lens append/dup make block! 1 + y 0 y + 1];: length? b repeat i x [ repeat j y [ lens/(i + 1)/(j + 1): either a/:i = b/:j [ lens/:i/:j + 1 ][ max lens/(i + 1)/:j lens/:i/(j + 1) ] ] ] result: make type? a min x y insert result at head a start + x ;- 1 while [all [0 < x 0 < y]][ case [ lens/(x + 1)/(y + 1) = lens/:x/(y + 1) [x: x - 1] lens/(x + 1)/(y + 1) = lens/(x + 1)/:y [y: y - 1] 'else [ if a/:x == b/:y [ insert/only result a/:x ] x: x - 1 y: y - 1 ] ] ] insert result copy/part head a start - 1 result ]
"""", changed near the top of lcs: any [empty? a empty? b] [return copy ""]any [empty?...] On mobile now, can’t check.any [empty? a empty? b] [return copy ""]?Red [] skp: charset " ^/^-[]()" addr: func [s1 s2 style] bind [keep as-pair i: index? s1 (index? s2) - i keep style] :collect rule: bind [any [s: skp | #";" [if (s2: find s newline) | (s2: tail s)] (addr s s2 reduce ['italic beige - 50]) :s2 | (el: load/next s 's2)( case [ string? el [addr s s2 gray] any-string? el [addr s s2 orange] word? el [case [ any-function? get/any el [addr s s2 reduce ['bold blue]] immediate? get/any el [addr s s2 blue] ]] path? el [if any-function? get/any el/1 [addr s s2 reduce ['bold blue]]] any-word? el [addr s s2 navy] any-path? el [addr s s2 water] number? el [addr s s2 mint] scalar? el [addr s s2 teal] immediate? el [addr s s2 leaf] ] ) :s2 ]] :collect view/no-wait [ files: drop-list 200 with [data: read %.] on-change [ rt/text: read pick face/data face/selected clear rt/data collect/into [parse rt/text rule] rt/data ] button "Dir..." [ files/data: read change-dir request-dir/dir normalize-dir %. clear rt/data clear rt/text ] return rt: rich-text 800x800 "" with [data: []] ]
gui-console-ctx/terminal/theme colors, but the datatype based colorization feels a bit limited. I like how you are differentiating words based on their value typesnext is just walking across the expressions, but not evaluating, and do is like next but also evaluates? I wonder if the behavior of skip and intocould be combined, so that for block! it goes into the block, but for other things it goes to the next value. I can't help the feeling that I am looking at a debugger :smile: Do is same as Next + evaluating. But about Skip and Into I have to see, may be I can unite these indeed. Thanks! /all), places for sample inputs and their associated output, with a way to have it run and just click to say "That's correct. Make it a test." and all tests auto run as you work. Stuff like that.constructed and then its words incrementally set from the original spec block. Otherwise, when stepping into spec block and incrementally evaluating it, words are set in default context, and this distorts the state. What do you think?any-function! word and get help textcause-error a block is a typo compared to an earlier version I've been using and thanks!gui-console-ctx/terminal/update-theme in the end of file should make it work.gui-console-ctx/caret-clr will change the caret color.#include path to help.redupper as a var name shows help for uppercase. This is a good start for an Intellisense type feature.Red [] headers in the content confuse the line numbering. Red [] is found. Then it goes back to the default for the remaining text.Construct do?{...} strings? They aren't an expression, per se.Red [] causes line numbering to fix immediately, but the font issue persists.34 This is line 34 ... . and the part of line 34 that would wrap. 35 This is line 35
if exists? %red.exe [call/shell {rename red.exe red.exe.old}]
write/binary %red.exe read/binary https://static.red-lang.org/dl/auto/win/red-latest.execall, could fire off the console compiling.forever [browse %/C/]hint doesn't work compiledhints may not work w/ 064 stable. working with latest interpreteddelta-time [x: 0 loop 1000000 [x: x + 1]]
first?last: func [value [series! tuple! pair! time! date!]][
case [
series? value [back tail value]
tuple? value [pick reverse value 1]
any [pair? value time? value] [pick value false]
date? value [pick value (length? system/catalog/accessors/date!) - 1]
]
]first seems to return nonelast: func [value [series! tuple! pair! time! date!]][
case [
series? value [either empty? value [none][back tail value]]
tuple? value [pick reverse value 1]
any [pair? value time? value] [pick value false]
date? value [pick value (length? system/catalog/accessors/date!) - 1]
]
]first accepts those same datatypes, that's why I added themlast: func [value [series! tuple! pair! time! date!]][
case [
any [series? value tuple? value] [pick value length? value]
pair? value [second value]
time? value [third value]
date? value [value/14]
]
]text
last: func [value [series! tuple! pair! time! date!]][
pick value length? any skip [
next select system/catalog/accessors type?/word value
value
] make integer! not date? value
]system/catalog/accessors beyond datenewline?pick value : length? : any : skip : [next value] : select system/catalog/accessors : type?/word value : make integer! : not : date? valuemake integer! not date? value returns 1 and series starts from second element, i.e. select.... If the value is date! series starts from next select.... So if valueś type is found in system/catalog/accessors the length? is that of the corresponding accessors' block, which in case of date is 1 shorter, as length is counted from the second (next) element. If it is not found in accessors (block!, tuple!), the length? is calculated from the value itself returned by any.last? They are not ordered values. first accepts them?first instead.#"A" 15951 #"B" 32427 #"C" 14897 #"D" 32302 #"E" 32433 #"F" 32400
Asegment?parse, i.e. based on op!s and function!s only, and it appears at least in some domains it can come quite close. I tried in family relations:parse: [toy genealogy](https://toomasv.red/images/Deduction/infer.gif)op!s don't let to use mixed lit- and not-lit- arguments. If one is given as lit-word both are interpreted as lit-words. Thus funcs can't be used as second arg if first is lit-word. I wonder if this is intended.ast to recognize spec-dsl and added colors:collect function:[%/C/Users/dave/Source/red/redcodex.red [[on-over: on-down: function] 85/4/14/5]]
[%/C/Users/dave/Source/red/tests/source/units/function-test.red [[
a:
b: function
] 1110/2/8/1]]loaded, or...more fun, track locations in blocks and new-line markers. parse. May require a refinement, though, to avoid the overhead of checking at every value.system/lexer/transcode already has some newline counting logic in it.system/console/prompt: rejoin ["Line " length? system/console/history " >>"]console session line numbers?system/console/prompt: func [][rejoin ["Line " length? system/console/history " >> "]]
system/console/history, because I forget everything over the past year or sodiagram-style is ~ able to produce all their example diagrams, just not automatically. They seem to use totally different hierarchical description method. I'll try that for automatic generation.switch.switch line to run the tests? What about having a little GUI that let's you run the demos? Nice to have all of it in one script, which makes adding anything interactive conflict with loading a library, so the demo running could be extracted and separate. If still mainly for experimenting, build it in.each.array func. Not perfect, but with expressions:a b c a single expression, or just c as the test condition. Same for a b in while. And should there be a decision diamond? I do like the flow going down, with the while body out of that flow. But that's tricky too, because until's body is inline. Did Edward Tufte do anything with flowcharts? I came across a Small Multiples article that led to [this](http://www.visual-literacy.org/periodic_table/periodic_table.html) recently. until block there are three expressions. While until block might be easier to follow if c was source of logic links, with while it would get scrumbled if yes link runs from b to c and back-link from e to a. Besides, if no-link runs back up inside the until block, it would become computationally much more complex as each expression-box may be of different length and we have to navigate around these. About diamond for decision-expressions -- it is nice for short expressions, but with long expressions angles become such that borders will cut text. Especially if condition is of the form e.g. all [ ...] . Diamond boxes seem to be suitable if we truncate expression to predefined length and show it on hover. So, currently I traded diamond for sky-color, applied to expression or to a block, if we have a condition-block as in case of until and while, where condition depends on the result of the computations in block.array is now fully generated:any and all understandable and agreeable?t/f affordances there. That makes sense, as the functions they display are as well. But I'll throw out a quick thought, then ponder other ideas.all expressions butt right up against each other, without an intervening arrow, to show that they are a collective? Then your true arrow comes out of the last expression (which is returned), while false falls out the bottom of the enclosing blue frame.all, any and others, that way we can distinguish them easily. Or putting a small text on top-left corner of the boxes. bb (the world/space), you could have the world be a reactor, which notifies agents of changes to the world state. They could still run logic on timers, which are just another type of world event (time passing).shift to get some interesting variations.hardness do? My darts seem to meet a lot of resistance if I set it to 1.Clear then shows errors in the console.*** Script Error: path wpn/2: is not valid for none! type *** Where: set-path *** Stack: view do-events do-actor do-safe
*** Script Error: hop has no value *** Where: + *** Stack: view do-events do-actor do-safe
high arc left and rotate slowly. If a component is made up of sub-parts (rim and spokes in wheel), you could choose to keep them together or separate them.unit! type. draw to suss things out. I expected a lot more code. What's there is just...magic.stylize in place, I can see people leveraging this a lot. Could be used for GUI designers as well as drawing and diagramming tools.x! what's the probability that the next value will be of typey!? Probably not, I know. But I've got the stats anyway (for some random script that I used for testing):#(
word!: #(
block!: 20.92675635277%
file!: 0.1494768310912%
word!: 54.85799701046%
set-word!: 7.772795216741%
refinement!: 3.139013452915%
paren!: 5.231689088191%
lit-word!: 0.5979073243647%
char!: 1.046337817638%
integer!: 1.644245142003%
string!: 2.092675635277%
get-word!: 0.1494768310912%
path!: 2.391629297459%
)
block!: #(
word!: 46.15384615385%
set-word!: 53.84615384615%
)
file!: #(
set-word!: 100%
)
set-word!: #(
word!: 64.70588235294%
map!: 1.960784313725%
block!: 14.70588235294%
path!: 7.843137254902%
integer!: 4.901960784314%
string!: 4.901960784314%
char!: 0.9803921568627%
)
string!: #(
word!: 66.66666666667%
set-word!: 19.04761904762%
char!: 4.761904761905%
paren!: 4.761904761905%
block!: 4.761904761905%
)
refinement!: #(
refinement!: 14.81481481481%
word!: 85.18518518519%
)
map!: #(
word!: 50%
set-word!: 50%
)
paren!: #(
word!: 76.08695652174%
paren!: 4.347826086957%
string!: 10.86956521739%
path!: 2.173913043478%
set-word!: 2.173913043478%
get-word!: 4.347826086957%
)
lit-word!: #(
word!: 58.33333333333%
lit-word!: 33.33333333333%
string!: 8.333333333333%
)
path!: #(
block!: 27.27272727273%
word!: 54.54545454545%
set-word!: 6.060606060606%
set-path!: 3.030303030303%
path!: 6.060606060606%
string!: 3.030303030303%
)
char!: #(
path!: 7.142857142857%
word!: 57.14285714286%
string!: 7.142857142857%
set-word!: 21.42857142857%
paren!: 7.142857142857%
)
integer!: #(
word!: 52.94117647059%
integer!: 5.882352941176%
set-word!: 23.52941176471%
path!: 5.882352941176%
block!: 5.882352941176%
set-path!: 5.882352941176%
)
get-word!: #(
word!: 100%
)
set-path!: #(
word!: 100%
)
)func block! block!without looking at func definition.--assert: 42872
--test--: 25730
=: 18293
strict-equal?: 12517
i: 6983
j: 6476
a: 4688
parse: 3996
not: 3449
make: 3431
b: 2588
none: 2519
to: 2367
equal?: 2268
===start-group===: 2171
===end-group===: 2157
-: 1995
skip: 1768
try: 1758
+: 1705===end-group=== marks missing in tests. For example https://github.com/red/red/blob/master/tests/source/units/find-test.red#L368 Looks like the statistics aren't that useless as I thought :smile: series! arg, how often is it called with each type or pseudotype of series? If it dispatches on type with switch/case, are all possible types covered? Do refinements get used? Do they lead to bugs? Are well-doc'd funcs less prone to errors in usage, or to internal bugs? Are there patterns associated with reliability based on bodies? It's a world of ways to look at things.load-safe: function ["Loads all values, convert unloadable values to string" value] [
ws: charset " ^-^/^M^(00A0)"
r: load/trap value
while [error? r/3] [
;Stringfy the unloadable value
either pos: find insert r/2 {"} ws [insert pos {"}] [append r/2 {"}]
r: load/trap/into r/2 r/1
]
r/1
]
>> load "a 1k b 2xx4"
*** Syntax Error: invalid integer! at "1k b 2xx4"
>> load-safe "a 1k b 2xx4"
== [a "1k" b "2xx4"]load/trap points to the string position where the issue happen for invalid value/syntax:load/trap {3"a}
== [[3] {"a} make error! [ <-- points to "
code: 200
type: 'syntax
id: 'invalidmissing:load/trap {] 3}
== [[] " 3" make error! [ <-- point to space char after ]
code: 201
type: 'syntax
id: 'missinginteger!: 748
|: 661
if: 631
=: 436
make: 382
func: 350
either: 312
as: 301
value: 300
logic!: 261
block!: 259
any: 247
all: 240
+: 237
-: 228
none: 206
red-value!: 200
cmd: 194
function: 189
face: 188red-value! is from routines? Taking file extension (.red / .reds) and headers into account would be a good start, and also #system with #call.%func-tools.redfrom my red-tools repo.either interpreted? checker https://gist.github.com/ne1uno/a5d79c0b7a8f9dac65f4737834b900b4numbers and ordered is same already? numbers: random ordered: [1 2 3 4 5 6 7 8 9], random will shuffle in place.copy there? I didn't test it, that's from comments on the game link page.copy, but random in R2 returns a copy the series (I misremembered this).do read-clipboard, the console dies. >> split: func ['path][to-block path] == func ['path][to-block path] >> split my/path == [my path]
MY/PATH would be split as [MY PATH] and [ANOTHER PATH POINTED BY] MY/PATHany-typo!. It would accept anything I write and convert my typos to valid values.any-typo!. It would accept anything I write and convert my typos to valid values. for reboot resistant strings?system/words context. any-typo!. It would accept anything I write and convert my typos to valid values.