is, while being an op!, supports literal argument:>> ?? is
is: make op! [[
{Defines a reactive relation whose result is assigned to a word}
'field [set-word!] {Set-word which will get set to the result of the reaction}
reaction [block!] "Reactive relation"
/local words obj rule item
]]op!s don't support neither get arguments nor literal ones. Can this be considered as a bug?op! definition with lit- or get-arguments.>> test: func [:x y][append form :x y] == func [:x y][append form :x y] >> test abracadabra 1 == "abracadabra1" >> test: make op! :test == make op! [[:x y]] >> abracadabra test 1 *** Script Error: abracadabra has no value *** Where: test *** Stack:
unset! in R3 and Red no. Is it by design?>> about REBOL/View 2.7.8.3.1 1-Jan-2011 Copyright 2000-2011 REBOL Technologies. All rights reserved. REBOL is a trademark of REBOL Technologies. WWW.REBOL.COM >> type? == unset!
>> about ***************************************************** ** REBOL 3.0 ** Version: 3.0.0.3.3 ** Platform: Windows win32-x64 ** Build: 12-May-2014/13:36:01 >> type? ** Script error: type? is missing its value argument
>> about Red for Windows version 0.6.3 built 27-Nov-2017/19:24:27+01:00 >> type? *** Script Error: type? is missing its value argument *** Where: type? *** Stack:
better-comment: func [a b [any-type! unset!]] [either not unset? get/any 'b [:b][()] ]
== func ['b [any-type!]][probe type? :b] >> f unset!
position example :-)to-hex stats stats*: func [ ... ] [... integer/box memory/total ... ] >> foo: func [series '?][forall series probe compose [if (?) [print "!"]]] == func [series '?][forall series probe compose [if (?) [print "!"]]] >> foo [1 2 3][odd? index? series] [if odd? index? series [print "!"]] *** Script Error: series has no value *** Where: index? *** Stack: foo >> foo: func [series '?][forall series probe compose [if odd? index? series [print "!"]]] == func [series '?][forall series probe compose [if odd? index? series [print "!"]]] >> foo [1 2 3][odd? index? series] [if odd? index? series [print "!"]] ! !
bind?foo: func [series '?][forall series probe bind compose [if (?) [print "!"]] 'series]bind can accept word too!
>> find {abc'defg} complement charset "a"
== "bc'defg" ; OK
>> find {abc'defg} complement charset "b"
== "abc'defg" ; OK
>> find {abc'defg} complement charset "z"
== "abc'defg" ; OK
>> find {abc'defg} complement charset " "
== "'defg" ; What !?
>> find {abc'defg} complement charset "^-"
== none ; What !?>> about Red for Windows version 0.6.3 built 7-Jan-2018/9:28:41+01:00
Red for Windows version 0.6.3 built 27-Nov-2017/19:24:27+01:00
[1 "a" 1 "b"] here, though, this behavior makes sense too (all keys in records are identical, hence only one record remained)>> unique/skip [1 "a" 1 "b" 1 "a"] 2 == [1 "a"]
unique to 2-element entries as a whole, not specifically to their keys?extract to get a unique set of keys, or select based on a unique key. /skip => Treat the series as fixed size records, I would also expect that each "sub-series" be treated as a single record.>> unique/skip [1 "a" 1 "b" 1 "a"] 2 actual== [1 "a"] expected== [1 "a" 1 "b"]
map! or wrap records in blockskey - record structure is implied/skip is not really well thought out and may have been added as an after thought.next/skip and back/skip if the /skip refinements were meant to provide a way of processing records with a fixed number of values all held in a single block.find/skip treats the data as keyed fixed number of item records with the key in the "first" positionsort has /compare refinement that can be used to pass index in the record. Maybe find should support it also?unique/skip/compare block 2 2[e f g h]/skip works the way it does. Hopefully one of them has time to drop by and tell us.select returns *value*, not *record*record! type might be the answer.select returns a value and not a record, it isn't really treating the series as fixed records is it?record! datatype (or a dialect?) should sufficeselect-record: func [series skp needle][copy/part next find/skip series needle skp skp - 1] select-record [1 a b c 2 s d f 3 e d c] 4 2 == [s d f] select-record [1 a b c 2 s d f 3 e d c] 4 3 == [e d c] select-record [1 a b c 2 s d f 3 e d c] 4 1 == [a b c]
/record refinement?exclude and unique should result in this way?x: [[1 "aa"] [2 "bb"] [3 "cc"]] y: [[1 "aa"] [2 "bc"] [3 "bc"]] z: exclude x y == [[1 "aa"] [2 "bb"] [3 "cc"]] u: union x y == [[1 "aa"] [2 "bb"] [3 "cc"] [1 "aa"] [2 "bc"] [3 "bc"]] >> sort u == [[1 "aa"] [1 "aa"] [2 "bb"] [2 "bc"] [3 "bc"] [3 "cc"]] >> unique u == [[1 "aa"] [1 "aa"] [2 "bb"] [2 "bc"] [3 "bc"] [3 "cc"]]
exclude works as intended, it returns the first set minus all the elements in the second set, same for union, it creates new set which contains all elements from first and second setssort/compare and pass a comparator function to it[1 "aa"]>> b: [["x" 5]["b" 13]["f" 1]] == [["x" 5] ["b" 13] ["f" 1]] >> comparator: func [this that][this/1 < that/1] == func [this that][this/1 < that/1] >> sort/compare b :comparator == [["b" 13] ["f" 1] ["x" 5]] >> comparator: func [this that][this/2 < that/2] == func [this that][this/2 < that/2] >> sort/compare b :comparator == [["f" 1] ["x" 5] ["b" 13]]
>> b: [["x" 5]["b" 13]["f" 1]] == [["x" 5] ["b" 13] ["f" 1]] >> sort b == [["b" 13] ["f" 1] ["x" 5]]
map!?exclude, union and unique. /skip, for consistency, then we'd end up with skip/skip, right? find/select, so the size 2 case is optimal. /record is a very interesting idea, but needs more thought about the ultimate value.[find select sort ] , yes? (new-line shouldn't matter here). And I think we're all good with find/skip, and sort/skip works as expected. That leaves select/skip. The doc string for select is:/record approach work, as @toomasv shows. If we change it, and you want the current behavior, you have to do first select/skip series value size, yes? And, if changed, you don't get the key back with the record, correct? So you say your record size is N, but you get back N-1 values, and would need to insert the key if you want the complete rec. That is, if you visualize chopping the series up into fixed size sub-blocks, the key would be the first item *inside* each one.next/skip and back/skip *do* look appealing at first glance. Then we should also have at/skip and pick/skip for consistency. skip-ba-bop-ba-dop-bop](https://www.youtube.com/watch?v=Hy8kmNEo1i8)query. If you want to build anything like db in red proper you have to have access to records. Of course, records don't need to be copy/part-ed, but appropriate part should be bound to field-words. .. Or something>> parse [please blockify me thanks in advance !][collect some keep [3 skip | thru end]] == [[please blockify me] [thanks in advance] !]
unique/exclude bug. Please report it if there's not already a ticket. Good catch!some [to end]>> intersect [[1][2][3]][[3][4][5]] == [] >> intersect [[1][2][3]] [[3][4][5]] == [] >> intersect [[1] [2] [3]] [[3] [4] [5]] == [[3]]
round's description claims "Returns the nearest **integer**">> round 2.0 == 2.0
round was designed. I would prefer a true integer! result, but it's not *wrong*, because 2.0 is an integral value. "Returns the nearest multiple of 1 of the same datatype." doesn't read so well. For values like time, money, and more, we don't want an integer! result, but for plain numbers, it can be very useful, and intuitive IMO.repeat) that require an integer!.x:\tools>upx -9 lame-gui.exe
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2017
UPX 3.94w Markus Oberhumer, Laszlo Molnar & John Reiser May 12th 2017
File size Ratio Format Name
-------------------- ------ ----------- -----------
upx: lame-gui.exe: InternalError: should not happenRed [] probe enbase "abc"
red/natives/debase* needs to be added to https://github.com/red/red/blob/master/system/utils/libRedRT-exports.r. Please file a ticket.enbase needs to be added.t: (as float! (systime/data3 and FFFFh) * 3600.0)
t: (3600.0 * as float! (systime/data3 and FFFFh))
unsetx wasn't set to any value?none?any [x 'b] from inside func?>> f: func [/refine something][print either something ["Got it!"]["I still don't understand!"]] == func [/refine something][print either something ["Got it!"] ["I still don't understand!"]] >> f I still don't understand! >> f/refine "my understanding" Got it!
/local is a refinement anyway?none, for convenience. As for why it's a refinement, we can ask "How else would you do it?" It's one of those tricks that you don't really notice, and it took a long time for people to even consider that you could sneakily use it when calling a func. >> find "abc" complement charset "a" == "bc" >> find "abc" complement charset "d" == "abc" >> find "abc" complement charset " " == none >> about Red for Windows version 0.6.3 built 27-Jan-2018/15:00:13+01:00
>> non-em: complement charset " "
== make bitset! [not #{0000000080}]
>> repeat i length? non-em [if non-em/:i [prin to-char i]]
<some control chars>
!"#$%&'(
>> find "abc" non-em
== nonenon-em, its only logical. The problem arises from the mechanism of charset allocation.>> space: charset " "
== make bitset! #{0000000080}
>> non-em: make bitset! complement #{00000000800000000000000000}
== make bitset! #{FFFFFFFF7FFFFFFFFFFFFFFFFF}
>> find "abc" non-em
== "abc"
>> repeat i length? non-em [if non-em/:i [prin to-char i]]
<some ctrl chars>!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg== none
>> non-em: make bitset! complement #{000000008000000000}
== make bitset! #{FFFFFFFF7FFFFFFFFF}
>> find "abc" non-em
== none>> find "abc" complement charset " " == "abc" >> about Red for Windows version 0.6.3 built 21-Dec-2017/23:39:43+03:00
SHA-1: c4523a0b3805d7392151634aa99184baeb823893 * FIX: issue #3159 (Uncorrect result when `find/skip` vector! with 0 and negative numbers)
>> parse "abc" [to fail] >> parse "abc" [some fail] >> parse "abc" [thru fail] >> parse "abc" [any fail] *** Runtime Error 1: access violation *** at: 00427815h
>> help put
USAGE:
PUT series key value
DESCRIPTION:
Replaces the value following a key, and returns the new value.
PUT is an action! value.
ARGUMENTS:
series [series! map! object!]
key [scalar! any-string! any-word! binary!]
value [any-type!]
REFINEMENTS:
/case => Perform a case-sensitive search.
RETURNS:
[series! map! object!]
>>
>>
>> put {1a2b3c4e5f} {2} "x"
*** Script Error: put does not allow string! for its series argument
*** Where: put
*** Stack:
>> series? {2}
== true
>>[any-block! map! object!]object! so it could be bug or regression (if it worked before but I don't remember)-u option:Red [] #system [ print [string/byte-to-hex 255 lf] ] print 100
-=== Red Compiler 0.6.3 ===- Compiling /Users/peter/VMShare/Code/Red/test.red ... ...compilation time : 908 ms Target: Darwin Compiling to native code... libRedRT-extras.r file generated, recompiling... Compiling /Users/peter/VMShare/Code/Red/test.red ... ...using libRedRT built on 12-Nov-2017/6:49:14+8:00 ...compilation time : 24 ms Target: Darwin Compiling to native code... *** Compilation Error: undefined symbol: red/string/byte-to-hex *** in file: %/Users/peter/VMShare/Code/Red/test.red *** at line: 332
-u option or is it a bug?Compiling C:\Users\endo\Documents\Red\red-endo\build\bin\test.red ... ...compilation time : 1275 ms Target: Darwin Compiling to native code... libRedRT-extras.r file generated, recompiling... Compiling C:\Users\endo\Documents\Red\red-endo\build\bin\test.red ... Compiling libRedRT... ...compilation time : 1986 ms Compiling to native code... ...compilation time : 58005 ms ...linking time : 666 ms ...output file size : 962560 bytes ...output file : C:\Users\endo\Documents\Red\red-endo\build\bin\libRedRT.dylib ...compilation time : 36 ms Target: Darwin Compiling to native code... ...compilation time : 1689 ms ...linking time : 111 ms ...output file size : 73728 bytes ...output file : C:\Users\endo\Documents\Red\red-endo\build\bin\test
graph and something happened so that console crashed and does not open up anymore. I downloaded the latest version, it compiled, but doesn't open. Neither does the stable 0.6.3. Even after restart. :scream:/ProgramData/Red/Ja vol!?Autechre - Cap.IV](https://www.youtube.com/watch?v=1qkMYxt4XYs) started playing in my head-u option. It looks as though it is bug under macOS or when the source is not in a sub-drectory of red.>> b: new-line/all [1 2 3] on
== [
1
2
3
]
>> parse b [some [change quote 2 42 | skip]]
== true
>> b
== [
1 42
3
]
>> b: new-line/all [1 2 3] on
== [
1
2
3
]
>> change at b 2 42
== [
3
]
>> b
== [
1 42
3
]/part and /dup refinements?>> head change at new-line/all b: [1 2 3] true 2 4
== [
1 4
3
]
>> head change/dup at new-line/all b: [1 2 3] true 2 4 5
== [
1 4 4 4 4 4
]>> load ["a"] *** Script Error: load does not allow block! for its source argument *** Where: load *** Stack: load
load a block is specifically excluded. I think this is worth a wish. Implementation would not seem to be too onerous...load on a block in Rebol? That is, if you already have a block, what does it do? Also, R3 behaves differently than R2. No error on this in R2, just no eval:>> load [1 + 1] ** Script error: -apply- does not allow integer! for its source argument ** Where: apply map-each case load ** Near: apply :load [:item header all type ftype]
>> digit: charset [#"0" - #"9"]
== make bitset! #{000000000000FFC0}
>> rule: [collect into test some [keep digit | skip]]
== [collect into test some [keep digit | skip]]
>> test: ""
== ""
>> input: "ab13de412f"
== "ab13de412f"
>> probe also test parse input rule
"13412"
== "13412"
>> input: extract/into input 1 []
== [#"a" #"b" #"1" #"3" #"d" #"e" #"4" #"1" #"2" #"f"]
>> probe also clear test parse input rule
""digit to match as usual and collect into to keep matched characters into test stringtext >> rule: [collect into test some [keep skip]] == [collect into test some [keep skip]] >> probe also test parse input rule "ab13de412f" == "ab13de412f"
clear either[ #"0" | #"1" | ... | #"9"] equivalent by myself?char!, of courseinto allows to parse vector!(although you can't match by datatype inside it)>> parse reduce [make vector! [1 2 3]][into [skip x: (probe x)]] make vector! [2 3] == false
vector! directlyinto [3 integer!] will failinteger!sfirst), and marshals values. At least that's what it looks like to me.vector! to represent only unsigned integers?>> make vector! [integer! 8 1 [127]] == make vector! [integer! 8 [127]] >> make vector! [integer! 8 1 [128]] == make vector! [integer! 8 [-128]]
push is not "pushing" line-width. Is this a bug or intentional?view [box 300x300 draw [
line-width 1 push [
line-width 10 pen red line 65x75 187x166
] line 109x37 244x140
]]pushing rules. I'll write a proposal before implement it.line-widthdoes not fall into "quality settings" category and that's why it is not saved. Which means custom logic must be implemented to achieve this.
line-join and line-cap there is different problem: pushing these doesn't restore default values after the push-block is closed, but does restore the values that were explicitly declared before the push-block:view/no-wait [
box 260x70 draw [
line-width 10 push [
line-join round line-cap round pen red
line 10x10 100x10 10x50 100x50
] line 140x10 230x10 140x50 230x50
]]
view [
box 260x70 draw [
line-join miter line-cap square line-width 10 push [
line-join round line-cap round pen red
line 10x10 100x10 10x50 100x50
] line 140x10 230x10 140x50 230x50
]]bugs room>> type? probe load {git@github.com:red/red.git}
[git@github.com :red/red.git]
== block!>> type? probe load {git@github.com:red/red.git}
git@github.com:red/red.git
== url!()[]), the second—while kindof correct (it is intended as a path to a resource) it doesn't conform to the [URI spec](https://tools.ietf.org/html/rfc3986#section-3). Am a wee bit surprised it wasn't recognised as an [EMAIL!](https://tools.ietf.org/html/rfc2822#section-3.4.1)>> write/info http://www.red-lang.org [POST [a: b]] *** Runtime Error 1: access violation *** at: 0806D54Dh
view [base red at 10x10 panel transparent]
enbase for a long text in base 16:>> first enbase/base "loooooooooooooooong text" 16 == #"6" >> first enbase/base "looooooooooooooooooooooooooooooong text" 16 == #"^/" ; where this newline comes from??!
random/seed seem to not work on wine:>> random/seed now/precise >> random 10 == 3 >> random 10 == 7 >> random 10 == 5 >> random 10 == 5 >> random 10 == 3 >> random 10 == 6 >> random/seed now/precise >> random/seed now/precise >> random 10 == 3 >> random 10 == 7 >> random 10 == 5 >> random 10 == 5 >> random 10 == 3 >> random 10 == 6 >> random/seed now/precise >> random 10 == 3 >> random 10 == 7 >> random 10 == 5 >> random 10 == 5 >> random/seed now >> random 10 == 3 >> random 10 == 7 >> random 10 == 5 >> random 10 == 5 >> random 10 == 3 >> random 10 == 6
>> random/seed now >> collect [loop 5 [keep random 10]] == [9 8 4 2 2] >> random/seed now >> collect [loop 5 [keep random 10]] == [9 8 4 2 2] >> random/seed now/time >> collect [loop 5 [keep random 10]] == [4 8 8 2 8] >> random/seed now/time >> collect [loop 5 [keep random 10]] == [10 1 5 8 6]
now/time works, thanksnow/precise can't give you the same seedrandom uses only part of the returned dateRandom for time! inherits from float!, which casts to integer: Random for date! does, indeed, use only the /date part it seems:randomize: func [ "Reseed the random number generator." /with seed "date, time, and integer values are used directly; others are converted." ][ random/seed either find [date! time! integer!] type?/word seed [seed] [ to integer! checksum form any [seed now/precise] 'sha1 ] ]
date! seeds through. You can avoid that by forming them first of course./time part as well.cause-error reduce args block?>> cause-error 'script 'no-arg [foo bar] *** Script Error: foo has no value *** Where: reduce *** Stack: cause-error >> cause-error 'script 'no-arg ['foo 'bar] *** Script Error: foo is missing its bar argument *** Where: do *** Stack: cause-error
set object none breaks on-change*>> o: object [a: 1 on-change*: func [w o n] []] >> set o none *** Script Error: invalid argument: none >> o/a: 2 *** Script Error: invalid argument: none >> body-of o == [a: 2 on-change*: none]
set function.cause-error. It seems to trip us all up at some point. So find examples of how it's used in the current source, explain it, maybe write a helper to wrap it, and ask @dockimbel to review.rejoin [ "def"] does the trick.form on a tag! should return. Tags are a bit tricky, because their "user friendly" form includes the brackets, yes? Otherwise you'd get this:>> rejoin [<abc> <def>] == "abcdef"
mold on tags when appending only to tags. This has come up in the past, and Carl added 'ajoin' to Rebol, though I never cared for it much. Rebol also has build-tag. I think the reason is wasn't changed is because the alternatives aren't clearly better, just different. Worth a REP, though, if someone wants to propose improved behavior.to-string instead of form on the items it appends, since to-string is "abc" ; this seems to be the only exception to to-string and form being equivalent.cause-error is on my list :guardsman: text
>> ? wait
...
value [number! time! block! none!]
REFINEMENTS:
/all => Returns all in a block.
>> wait [1 2 3]
*** Script Error: invalid argument: [1 2 3]
*** Where: wait
*** Stack:
>> wait none
*** Script Error: invalid argument: none
*** Where: wait
*** Stack:wait on block. Then, it can be used to wait on some port! or a timeout./all, I guess the sentence is wrong, see Rebol version:>> help wait
USAGE:
WAIT value /all
DESCRIPTION:
Waits for a duration, port, or both.
WAIT is a native value.
ARGUMENTS:
value -- (Type: number time port block none)
REFINEMENTS:
/all -- Returns all events in a blockevents is missing.@ conjunction misses leftmost noun for a start, and parens are empty$ is Shape/Shape ofapp.git: function['.commands [word! string! unset!] /repo .repo [url!] /local ][
switch/default type?/word get/any '.commands [
unset! [
print "TODO: HELP"
]
word! string! [
commands: form .commands
out: copy ""
call/wait/output {powershell -Command "git status"} out
print out
]
] [
throw-error 'script 'expect-arg varName
]
]
git: :app.gitout: copy ""
call/wait/output {powershell -Command "git status"} out
print outwait, which makes command wait for exit, and then expecting it to produce output to stdoutout after one second?>> pts: [1 2 3] forall pts [probe reduce [index? pts pts/(index? pts)]] [1 1] [2 3] [3 none]
forall moves the index, so on the second run pts is [2 3] and you are accessing element number 2 which is 3@echo off start "system/options/home returns none on windows" /D "c:\windows" "C:\rebol\red.exe" "c:\rebol\test.red" %1
Red [] probe rejoin ["system/options/home: " system/options/home] probe rejoin ["system/options/path:" system/options/path] ask "..."
"system/options/home: /c/windows/" "system/options/path:/c/rebol/" ...
"system/options/home: none" "system/options/path:/c/rebol/" ...
>> pts: [1 2 3] forall pts [probe reduce [pts index? pts pts/(index? pts)]] [[1 2 3] 1 1] [[2 3] 2 3] [[3] 3 none] == [[3] 3 none]
forall many times, but had a memory block in my head for some reason yesterday :)url: https://api.github.com/repos/red/red/contributors read/info url []
*** Runtime Error 1: access violation *** at: 080A0211h
>> url: https://api.github.com/repos/red/red/contributors
== https://api.github.com/repos/red/red/contributors
>> read url
== {[^{"login":"dockimbel","id":411393,"avatar_url":"https://avatars1.githubusercon
>> read/info url
== [200 #(
Cache-Control: "public, max-age=60, s-maxage=60"
Date: "Fri, 1...read/info with one argument if it requires two?do-thru https://raw.githubusercontent.com/rebolek/red-tools/master/json.red
*** Runtime Error 1: access violation *** at: 080A0211h
>> help read
USAGE:
READ source
DESCRIPTION:
Reads from a file, URL, or other port.
READ is an action! value.
ARGUMENTS:
source [file! url!]
REFINEMENTS:
/part => Partial read a given number of units (source relative).
length [number!]
/seek => Read from a specific position (source relative).
index [number!]
/binary => Preserves contents exactly.
/lines => Convert to block of strings.
/info =>
/as => Read with the specified encoding, default is 'UTF-8.
encoding [word!]write/infountil [
do-events/no-wait
out <> ""
]
print outparse "" [any ""] ; == true
parse "str" [any ""]
any should take 0 or more. I'm not sure how it cases infinite loop.length? str < 1000000while, any and some), since it will make parse stuck in an infinite loop.any can match the empty string against the input an infinite number of time without reaching the input end.>> parse "" [end] == true
>> parse "str" [any pos: ""] == false
check's value does not change on clicking. Tried in console built on March 23rd (W10).view [check [probe face/data]]
change to true:>> view [style r: radio [probe reduce [face/text face/data]] r "r1" r "r2"] ["r1" true] ["r1" true] ["r1" true] ["r1" false] ["r2" true] ["r2" true] ["r2" true]
environment/console/input.red misses terminate field in system/console context. I checked from REPL, and it's set to an empty block, so I changed patch to the following:unless system/console [
system/console: context [
history: make block! 200
size: 0x0
terminate: [] ; <--
]
]ask - everything works fine. Should I make a PR with this fix?2c0c05e0) on Linux, it crashes right after executing console. Works fine on Windows, I don't know about macOS.2b9e6, that's first version that crashes, 5f9c4 works fine.2c0c05e0>> write-clipboard "foo f^/f" ; == true read-clipboard ; == "foo f^M^/f"
^M is new line and ^/ is carriage return - on windows it's just one symbol/code.test: read-clipboard write-clipboard test
text >> read-clipboard == "test: read-clipboard^M^/write-clipboard test" >> print read-clipboard test: read-clipboard write-clipboard test
write-clipboard "test: read-clipboard^M^M^/write-clipboard test" read-clipboard ; == "test: read-clipboard^M^M^M^/write-clipboard test"
monkey: make object! [
hp: 100
eat: func [] [
print "tasty"
return "done"
]
]
monkey/('hp)
; == 100
h: monkey/('hp)
; == 100
h
; == 100
a: monkey/('eat)
; tasty
; == eat
a
; == eat
a: (monkey/('eat))
; tasty
; == "done"
; a
; == "done">> monkey: make object! [
[ hp: 100
[ eat: func [] [
[ print "tasty"
[ return "done"
[ ]
[ ]
== make object! [
hp: 100
eat: func [][
print "tasty"
return "done"
]
]
>> monkey/('hp)
== 100
>> h: monkey/('hp)
== 100
>> h
== 100
>> a: monkey/('eat)
tasty
== eat
>> type? :a
== word!
>> a: (monkey/('eat))
tasty
== "done"Red for Windows version 0.6.3 built 27-Mar-2018/10:27:44+03:00 Win10 x64.*** View Error: CreateWindowEx failed! error now, but I should examine detailed to see what's wrong there.showunsetting.*** Runtime Error 003a:err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x41cd9a
ih: load %any.jpg then in a view ix: image ih no crash first time, no crash using pngpng officially supported? I didn't see any open or closed ticketsbuild.r on Win10 x64, it writes "cleaning files" and hangs forever.rebol.exe -s) then it workscall issues in 2.7.8, but the hangs should be inconsistent in that case.call or the custom one we provide?Compiling to native code... *** Loading Error: file access error: %wcwidth.reds *** in file: %/home/sony/Code/red/environment/console/CLI/console.red *** at line: 546
*** Runtime Error 0009:err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x41cda9
isheh@sam ~ $ ~/dev/red/red-063 Compiling compression library... Compiling Red console... sh: 1: /home/isheh/.red/console-2018-3-29-47595: Permission denied isheh@sam ~ $ chmod +x /home/isheh/.red/console-2018-3-29-47595 isheh@sam ~ $ ~/dev/red/red-063 --== Red 0.6.3 ==-- Type HELP for starting information. >>
call issues in 2.7.8, but the hangs should be inconsistent in that case.call bug in 2.7.8, but it didn't happen 1 or 2 weeks ago.;-- Try to get version data from git repository save git-file do %git-version.r
git-version.r file there is call, so if we can add call/show "" just before doing that file, it works with 2.7.8 too./show is available under 2.7.6 as well, but not earlier versions. There's more to the call issue in R2 though, IIRC.system/core inside git-version.r (or better inbuild.r) script and if it is 2.7.8 then do call/show "" git status says deleted: build/git.r leads the local repo modified.tips.red file there is a line probe event/key probes a value to console. <- @qtxie about now (:call and the custom one on Win/10.call, Rebol seems to hang on the first call of call. Using custom call, Rebol hangs at different times during the test.call. about function call.about menu in gui-console.about crash, it's caused by the compiled code for to-UTC-date function (the function's code is fine). Issue is caused by the internal tracking of object's owner for immediate! values. It relies on a global state that is not properly reset somewhere between the interpreted and compiled code evaluations.ls (and list-dir obviously) prints only dots ... (in all window sizes) and prints very slowly. But print read %file.txt prints very fast.ls bug. Worth reporting an issue.system/platform for WinXP? I guess that's the cause of crashing on start under Wine.Red 0.6.3 for Windows built 30-Mar-2018/16:55:45 commit #be7ff3a9.do, I don't know for sure if it's a bugdofollow balls demo, so maybe just a bad func name in there.follow in the newer one.button is operative in console of April 1st on W10:view [style btn: button [probe face/text] btn "b1" btn "b2"]
>> view [style btn: check [probe face/text] btn "b1" btn "b2"] "b1" "b1" "b1"
radio (only fist instance of style reacts), and field.../ and // correctly?>> #b/#c *** Script Error: / does not allow issue! for its value1 argument *** Where: / *** Stack: >> #b//#c *** Script Error: / operator is missing an argument *** Where: / *** Stack:
invalid path! ?>> 'b/#c *** Syntax Error: invalid path! at "'b/#c" *** Where: do *** Stack: load >> #b/c == /c
# be invalid issue! (if it's invalid of course)?issue! is ok with / after it: /: make op! func [a b] [reduce [a b]] #a/#b or just refinement! after it #a/refinement1 maybe that causes that error>> reduce [#b/c] == [#b /c] >> reduce [#b[c]] == [#b [c]]
>> to path! [a #b /c] == a/#b//c
>> append/only l: [1] l
== [1 [...]]
>> c: context [x: l]
== make object! [
x: [1 [...]]
]
>> make c []
*** Runtime Error 19: stack error or overflow
*** at: 0041A38Dh>> make c [] ** Internal error: stack overflow
form make image! [10x10] *** Internal Error: not enough memory *** Where: form *** Stack:
to string! has the same problem.>> round/to 1.1 1.0 == 1.0 >> round/to 0.9 1.0 == 1.0 >> round/to 0.1 1.0 == 0.0 >> round/to -0.1 1.0 == 0.0 >> round/to -0.9 1.0 == -1.0 >> round/to -1.1 1.0 == -1.0 >> round/to -1.9 1.0 == -2.0 >> round/to -2.1 1.0 == -2.0 >> >> round/to 1.1 1 == 1 >> round/to 0.9 1 == 1 >> round/to 0.1 1 == 0 >> round/to -0.1 1 == 0 >> round/to -0.9 1 == 0 >> round/to -1.1 1 == 0 >> round/to -1.9 1 == -1 >> round/to -2.1 1 == -1
>> round/to 1.9 1 == 2 >> round/to -1.9 1 == -1 >> round/to -2.1 1 == -1 >> round/to 2.1 1 == 2
round actions for float! and integer!, or consequences of type coercion, or both.if OPTION?(scale) [ if TYPE_OF(scale) = TYPE_FLOAT [ f: as red-float! value f/value: as-float num f/header: TYPE_FLOAT return float/round value as red-float! scale _even? down? half-down? floor? ceil? half-ceil? ] sc: abs scale/value ]
round from R2.throw-on-error: func [
{Evaluates a block, which if it results in an error, throws that error.}
[throw]
blk [block!]
][
if error? set/any 'blk try blk [throw blk]
get/any 'blk
]
found?: func [
"Returns TRUE if value is not NONE."
value
][
not none? :value
]
abs: :absolute
round: func [
{Returns the nearest integer. Halves round up (away from zero) by default.}
[catch]
n [number! time!] "The value to round"
/even "Halves round toward even results"
/down {Round toward zero, ignoring discarded digits. (truncate)}
/half-down "Halves round toward zero"
/floor "Round in negative direction"
/ceiling "Round in positive direction"
/half-ceiling "Halves round in positive direction"
/to "Return the nearest multiple of the scale parameter"
scale [number! time!] "Must be a non-zero value"
/local m
][
throw-on-error [
scale: abs any [scale 1]
any [number? n scale: make n scale]
make scale either any [even half-ceiling] [
m: 0.5 * scale + n
any [
all [
m = m: m - mod m scale
even
positive? m - n
m - mod m scale + scale
]
m
]
] [
any [
floor
ceiling
(ceiling: (found? half-down) xor negative? n down)
n: add n scale * pick [-0.5 0.5] ceiling
]
either ceiling [n + mod negate n scale] [n - mod n scale]
]
]
]to-integer x + (0.5 * sign? x)if TYPE_OF(scale) = TYPE_INTEGER [ int: as red-integer! value int/value: as-integer dec + 0.5 int/header: TYPE_INTEGER return integer/round value as red-integer! scale _even? down? half-down? floor? ceil? half-ceil? ]
>> round/to -10.0 10 == -10 >> round/to -10.0 5 == -10 >> round/to -10.0 2 == -10
integer/round has a bug that compensates for this bug?--== Red 0.6.3 ==-- Type HELP for starting information. >> q *** Script Error: _terminate-console has no value *** Where: do *** Stack: q
>> pwd %/
pwd-related ticket though.>> trim/tail/with "aa\aa\" "\" == "aaaa"
>> trim/tail/with "aa\aa\" "\" ** Script error: incompatible or invalid refinements ** Where: trim ** Near: trim/tail/with "aa\aa\" "\"
"aa\aa"
>> trim " aa bb cc " == "aa bb cc" >> trim/with " aa bb cc " #" " == "aabbcc"
...
/all => Removes all whitespace.
/with => Same as /all, but removes characters in 'str'.
str [char! string! binary! integer!]`trim. So constraining /with to act as /all was the trade-off.Red for Windows version 0.6.3 built 26-Mar-2018/1:14:22+02:00 works fine.>> to-binary "🦄"
== #{F09FA68400}
>> to-string to-binary "🦄"
== "🦄^@">> x: to-word to-string #{F09FA684}
== 🦄>> to-string #{F09FA684}
== "🦄"
>> write-clipboard to-string #{F09FA684} read-clipboard
== "🦄^@"E:\Git\red\build\bin>red.exe Compiling Red GUI console... *** Compilation Error: include file not found: RTD.red *** in file: C:\ProgramData\Red\GUI\gui-console.red
*** View Error: CreateWindowEx failed! again.trim mezz that isn't greedy? Seems like it would need more features to be worth it, but maybe is a good example.compose to get the value inside rich-text? view compose/deep [rich-text data [i b (txt) /b /i]]Red 0.6.3 for Windows built 11-Apr-2018/14:56:31+02:00 commit #9b085fa view [base red] - crash-- > you should have >> -- on the screen > mark from right to left (reverse might work) from last - to > (so --) > click just below first - (from left).- is the easiest to explain.Red [] probe unset? :unknown
*** Compilation Error: undefined word unknown *** in file: D:\usr\redjunk\ticket13.red *** near: [:unknown]
*** Red Compiler Internal Error: Script Error : Expected one of: word! - not: path! *** Where: repend *** Near: [proto: get-prefix-func to word! pos/4]
Internal error is worth reportingRed [] f: func [x y] [x + y] c: context [f: get bind 'f 'system] op1: make op! :f op2: make op! :c/f
Config: [red-strict-check?: no] in your main script header.do by a custom mezz function that will hold a local cache for previously included file. Red [] c: make reactor! [x: 1] r: context [ x: is [c/x] ] dump-reactions
red script.red:*** Script Error: append does not allow none! for its series argument *** Where: append *** Stack: dump-reactions
red --cli script.red (dumps empty action):1:--- Source: object Field: x Action: Target: x 2:--- Source: object Field: x Action: Target: x
1 :--- Source: object [x] Field: x Action: [c/x] Target: x 2 :--- Source: object [x] Field: x Action: [c/x] Target: x
? :dump-reactions outputc is not a reactive source in your case.print something before dumping reactions, it works. Please file a ticket @hiiamboris. Good catch.Red [] print "" c: make reactor! [x: 1] r: context [ x: is [c/x] ] dump-reactions
prin. Please note that in the ticket.is calls react internally, and I don't remember looking at why it adds 2 relations (one in is and one at line 299 in react). react within a reactor! not working *by design*?>> r: make reactor! [x: 1 y: 0 react [y: x * 2]]
== make object! [
x: 1
y: 0
]
>> r/y
== 0
>> r/x: 2
== 2
>> r/y
== 0
>> dump-reactions
>> react [r/y: r/x * 3]
== [r/y: r/x * 3]
>> dump-reactions
1
:--- Source: object [x y]
Field: x
Action: [r/y: r/x * 3]
>> r/y
== 6>> r1: make reactor! [x: 1 y: 0 init: does [react [y: x * 2]] ] r1/init
== none
>> r2: make reactor! [x: 1 y: 0 init: does [react [y: r2/x * 2]] ] r2/init
== [y: r2/x * 2]
>> ? r1
on-change* function! [word old new /local srs]
x integer! 1
y integer! 0
init function! []
>> ? r2
on-change* function! [word old new /local srs]
x integer! 1
y integer! 2
init function! []
>> r1/x: 100
== 100
>> r1/y
== 0
>> dump-reactions
1
:--- Source: object [x y init]
Field: x
Action: [y: r2/x * 2]is works: r1: make reactor! [x: 1 y: 0 init: is [y: x * 2] ] but with react you need self/: r1: make reactor! [x: 1 y: 0 init: does [react [y: self/x * 2]] ] r1/initis has proven itself too buggy for now, so I'm going with self/>> r3: make reactor! [a: 1x1 b: none react [b: self/a * 2]]
== make object! [
a: 1x1
b: 2x2
]
>> r3/a: r3/a + 1x1
== 2x2
>> r3/b
== 4x4
>> r3/a/x: 100
== 100
>> r3/b
== 4x4react is not meant to be used from inside a reactor, that's why it only recognizes paths are possible sources of reactions.is is for. ;-)r3: make reactor! [a: 1x1 b: is [a * 2]]r3/a/x not reacting is a regression. There's a ticket about a related issue already IIRC... but I can't see it, so maybe better open a new one, so that we don't forget about it.is for "internal" relations inside a reactor, and react for "external" relations (requiring path accessors).react often gives me totally insane behavior, not to mention is, and in newer versions there's a lot of other things broken/later refinement (or react later in VID).event/key = 93head either any [only not any-list? series] [
insert/only tail series reduce :value
] [
reduce/into :value tail series
]head either any [only not block? series] [
insert/only tail series reduce :value
] [
reduce/into :value tail series
]any-list? looked suspicious on a first glance.repend and append reduce supposed to be total equivalents and we've found a regression, or are they not?append/insert /into is implied because you provide the series. What we need to do is show if or how the behavior is different, to document that. Using reduce/into is an optimization, so a new series doesn't have to be allocated by reduce.[0 [1] 1 [1] 5 4 3 2 [2]]
[0 [1] 1 [1] 5 4 3 [6] 2 [2]]
[0 [1] 1 [1] 5 4 [24] 3 [6] 2 [2]]
[0 [1] 1 [1] 5 [120] 4 [24] 3 [6] 2 [2]]
120
func [n /local b][switch/default n [0 [1] 1 [1] 5 [120] 4 [24] 3 [6] 2 [2]] [
do also b: body-of context? 'b
n: also n
probe repend select b 'n [n to-block n * (n: n - 1 do b)]
]][0 [1] 1 [1] 5 4 3 2 [2]]
[0 [1] 1 [1] 5 4 3 2 [2] [6]]
[0 [1] 1 [1] 5 4 3 2 [2] [6] [8]]
[0 [1] 1 [1] 5 4 3 2 [2] [6] [8] [10]]
2
func [n /local b][switch/default n [0 [1] 1 [1] 5 4 3 2 [2] [6] [8] [10]] [
do also b: body-of context? 'b
n: also n
probe repend select b 'n [n to-block n * (n: n - 1 do b)]
]][n part, remembers the index and goes recursively into evaluating the to-block n * (n: n - 1 do b)] partreduce/into that's *very* important to identify.probe repend b: [] ["<" (append b "x" "o") ">"] probe append b: [] reduce ["<" (append b "x" "o") ">"]
repend and append reduce are, but they themselves also behave differently["<" "o" ">" "x"] ["x" "<" "o" ">"]
< then o then >, preserving the index and thus the order of provided tokens["<" "x" "o" ">"] ["x" "<" "o" ">"]
reduce/into appends, not inserts at the current index?repend and append reduce supposed to be total equivalents and we've found a regression, or are they not?reduce, like /after, to ensure that all resulting values are appended. The current /into refinement only inserts from current position. Worth a ticket for sure.b wasn't set to c?>> a: context [b: context [set 'b 'c]]
== make object! [
b: make object! [ ] ; <-- note the empty space inside
]
>> empty? body-of a/b
== trueb that is set to c but that is in the global context, not that which is in the context labeled a.>> a: context [b: context [set 'b 'c]]
== make object! [
b: make object! [ ]
]
>> b
*** Script Error: b has no value
*** Where: catch
*** Stack:>> context [a: context [ ] ]
== make object! [
a: make object! [ ]
]
>> context [a: context [ b: context [ ] ] ]
== make object! [
a: make object! [
b: make object! [ ]
]
]new-line formatting of the block. b has no value, but that is the bwhose context IS the global context. The question is, what is the context of the inner b? I tried to find that out as follows:>> a: context [b: context [set 'b 'c probe context? 'b]]
make object! [
b: 'c
]
== make object! [
b: make object! [ ]
]b:a is printed wrongly! This seems worth an issue...b is set to c inside a, then you probe the context (at this point in execution b is indeed set to c, so the output is correct), and then b is re-set to a newly created object.>> a: spec-of func [x y][x + y] == [x y] >> a == [x y]
o1: make op! f1: func ['x 'y] [(get x) * (get y)] o2: make op! f2: func [ x y] [x * y] o3: make op! f3: func [ x 'y] [x * (get y)] o4: make op! f4: func ['x y] [(get x) * y] o5: make op! f5: func [ x 'y] [x * y] a: 2 b: 3 f3 a b f4 a b a o1 b a o2 b a o3 b a o4 b a o5 b
>> object skip [x: 1 y: 2] 2
== make object! [
x: unset
y: 2
]>> make object! [a: quote b: c: d: 2]
== make object! [
a: b:
b: unset
c: 2
d: 2
]set-word!s and then their value is taken from block at current position.>> y: 'skip parse " " [y] *** Script Error: PARSE - invalid rule or usage of rule: skip *** Where: parse *** Stack:
>> parse " " [skip] == true >> y: " " parse " " [y] == true >> y: 'skip parse " " reduce [y] == true >>
y: [skip]float!2147483647 is the maximum positive integer number you can represent with 32 bits>> enbase/base to binary! to integer! 2 ** 31 - 1 2 == "01111111111111111111111111111111"
float or wait for bignum?float!.~ > wine --version wine-2.4 ~ > wine ~/bin/red.exe err:winediag:SQLDrivers No ODBC drivers could be found. Check the settings for your libodbc provider. ~ > fixme:dwmapi:DwmIsCompositionEnabled 0x33fdb0 fixme:dwrite:get_name_record_codepage encoding 20 not handled, platform 1. fixme:dwrite:get_name_record_codepage encoding 20 not handled, platform 1. fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:dwrite:get_name_record_locale failed to get locale name for lcid=0x00000455 fixme:win:EnumDisplayDevicesW ((null),0,0x33f674,0x00000000), stub! fixme:dxgi:DXGID3D10CreateDevice Ignoring flags 0x20. fixme:dxgi:dxgi_check_feature_level_support Ignoring adapter type. fixme:winediag:dxgi_check_feature_level_support None of the requested D3D feature levels is supported on this GPU with the current shader backend. fixme:dwrite:dwritetextformat_SetIncrementalTabStop (0x20ddb0)->(0.000000): stub err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x41d4f6 ~ > ~ >
SQLDrivers No ODBC drivers could be found. Check the settings for your libodbc provider. doesn't sound like GUI problemGTK branch~ > ./Downloads/gtkonsole ./Downloads/gtkonsole: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
number! should be allowed here.append/dup, and there's magic at work: some numbers make it think hard, some return the original immediatelynumber! -> integer! for the above :point_up: [April 27, 2018 10:12 PM](https://gitter.im/red/bugs?at=5ae3762462316e050508e893)? this ain't worth a ticket ;)0 for the dup arg is fine, but there's enough logic in the action that it's not immediately clear what the problem is. It also crashes right away for blocks, which is different.>> copy/deep append/only x: [] x Segmentation fault
number! here. For /dup, only integer! value makes sense for me./part, different type of number! may be used in different way. For example, if use 50%, will insert half of the elements.>> a: [] >> b: [1 2 3 4] >> insert/part a b 50% >> a == [1 2]
view [box 500x300 draw [shape [move 50x150 curve 50x10 150x10 150x150 curv 250x290 250x150 move 50x150]]].curve function. :bug: Red [] foo: routine [x [value!] /local y [red-integer!]] [ y: as red-integer! x print y/value print #"^/" ] repeat i 10 [ prin [0.1 * i " "] foo 0.1 * i ]
red -c ...0.1 -1717986918 0.2 -1717986918 0.3 858993460 0.4 -1717986918 0.5 0 0.6 858993460 0.7 1717986919 0.8 -1717986918 0.9 -858993459 1.0 0
insert behavior/part issue. Yes, we should check the type there.integer! for the accepted type should be enough of a fix for /dup in my opinion>> object skip [x: 1 y: 2] 2
== make object! [
x: unset
y: 2
]newline flag set. Insert that element in another block -- the newline flag remains set. If it is a feature, it may mean extra programming to unset the newline if it is not wanted.>> b: [1 2 3]
== [1 2 3]
>> new-line b true
== [
1 2 3
]
>> d: make block! 10
== []
>> insert tail d b/1
== []
>> d
== [
1
]newline flags by default. If it's not desired, you can clean them up at any time using a new-line/all off call.newline markers are preserved when values are moved between any-lists is enough. Rebol2/3 have the same behavior.>> o: object [f: does [probe self probe :self]]
>> o/f
make object! [
f: func [][probe self probe :self]
]
unsetself work as a get-word!?red/help but to make sure: any with block causes infinite loop, but with normal string it will be fine:parse "foo" [any [""] "foo"] ; parse "foo" [any "" "foo"] ; infinite loop
op! doesn't work with quote: quote 1 + 1 will show: Script Error: - operator is missing an argument. Is this correct behaviour?system\build\config shows the name of the target OS but uses the host OS version number.text
>> help system/build/config
SYSTEM/BUILD/CONFIG is an object! with the following words and values:
config-name word! windows
OS word! Windows
OS-version float! 10.12op! doesn't work with quote: quote 1 + 1 will show: Script Error: - operator is missing an argument. Is this correct behaviour?? 1 + 1 -- same:get-words and 'lit-words in functions specs get priority over operators? weird is that + won't get the result of quote, seems like a lexer limitation to me? 1 + 1 is expected behaviour because ? 1 doesn't return anything (useful/integer!). quote 1 on the other hands returns 1 (q: quote 1 q).()?op! vs function!). I mean why quote 1 + 1 doesn't work at all (requires parenthesis)? If op! has higher precedence over function! then it should be evaluated something like this q: (1 + 1) quote (quote 2).quote 1 + 1 = (quote 1) + 1, so the Red behavior looks better to mequote won't go into the + as left-expressionparse "foo" [any "" "foo"] ; infinite loop should be OK, I think, because any doesn't advance the input in this case, and so should break. If nobody corrects my view, please open a ticket for that.>> parse x: [][insert ('foo)]
== true
>> x
== [unset]
>> parse x: [][insert (quote foo)]
== true
>> x
== [unset]Red [] ? value
VALUE is a string! value: "ticket19.red"
>> Red [] ? value
value? native! Returns TRUE if the word has a value.
values-of function! Returns the list of values of a value that supports reflection.move-color: func [face][face/data/1/x: face/data/1/x + 1]
view [
rt: rich-text 300x50 "Jumping color" with [data: [1x1 255.0.0]]
return
button "Jump" [move-color rt probe rt/data]
];comment is deleted (it disappear from the screen).new-line markers in the old (26-03) and the new gui console (04.05) are not set correctly, especially after blocks:[ a
[b]
c
[d]
z
]
; == [a
; [b] c
; [d] z
; ]
[[b]
]
; == [[b]]
[[b]
z
]
; == [[b] z]
[z
]
; == [z]
[z
z]
; == [z
; z
; ]parse-trace [3] [1 2 quote 3] ; == Error: PARSE - invalid rule or usage of rule: 3 but parse [3] [1 2 quote 3] ; == true parse-trace [3] [1 2 [quote 3] ]. It seems that parse/trace also doesn't work (parse/trace [3] [1 2 quote 3] func [][]).>> a: "12345678" == "12345678" >> copy b == "aa" >> a: "12345678" == "12345678" >> b: skip a 6 == "78" >> c: tail a == "" >> remove/part a 4 == "5678" >> b == "" >> copy b == "56" >> c == "" >> copy c == "5678"
b: "aa" defined before that in your session?rc way by loading red.r ?a changed, the associate b's position (var head) don't change. So I will fix this issue by adapting this position.b's position, just process the overflowa: "12345678" b: skip a 4 clear a index? b ; or any other access - should not change b append a "87654321" b = "4321" ; should be true
all, any etc returns none in this case all [ 1 = 2] and any [ 1 = 2]? I think it should return false (first reduce [1 = 2]; false).all: Evaluates, returning at the first that is not true. does it say that it should return none?false, specifically? none is its logical equivalent, so I don't see much difference, not to mention the need for a ticket. all and any: any and all have a block as argument; they will evaluate the expressions one by one; any will stop at the first one whose value is not false or none and yield that as result; if there is no such expressions it will yield none; all will stop at the first one which is false or none and yield none as a result; if there is no such one it will yield the result of evaluating the last one. Note that any [ ] and all [ ] both yield none. Also: all [false] == none, any[false] == none.none is falsey value in standalone situations, it does not act as such in more complex logical formulas, e.g.true or none ; true or any [] == *** Script Error: or does not allow none! for its value2 argument
any-block. Alternatively none should be converted into logic! type with make logic! or to logic!/ to-logic.logic! (so I'm not sure if it would cause a problem) but I guess there might be cases where it matters (as @toomasv said).copy on a fresh build, I suppose we need to inspect the other series functions as well, right?>> a: "12345678" == "12345678" >> b: skip a 6 == "78" >> clear skip a 4 == "" >> a == "1234" >> remove b == "" >> a == "123456" >> :) ???
foreach [] [1] [] deadlocks? R3 complains when I'm asking it do the samea should be "1234" . You can open a ticket.16-3: at [runtime/allocator.reds#L51-L53](https://github.com/red/red/blob/master/runtime/allocator.reds#L51-L53) should be 16-5: (change bit **3** to **5**)?>> t: now/time == 19:51:12 >> t/day *** Script Error: cannot access day in path [script invalid-path] *** Where: catch *** Stack: >> now/time/day == 10
now should handle the 2nd example?cannot acces day in path t/day -- there is is a wrong parameter somewhere. The 2nd example should be either a protest to having two incompatible refinements, or to ignore the second one, and not the first one. What happens here is that programmatically /day is treated before /time, because that is the order in which they are defined, contrary to the order in which they are given in the path. My preference is for an error rather than ignoring.invalid-path and immediately found your issue, so I guess it's the wayRed.has.this.too, so the only question is, have those issues not only been *detected* in Red by the R3 people, but also *reported* in the Red issues.red.has.this.too has not been cross-posted. Is just an observation, as I understand it./local [pointer! [integer!]]handle! is just a shortcut to integer pointer, second timer argument in two KillTimer calls should be patched to timer/value. I applied this fix and successfully compiled old console on Win7, after seeing the same error @ne1uno posted above.text
>> ? +
USAGE:
value1 + value2
DESCRIPTION:
Returns the sum of the two values.
+ is an op! value.
ARGUMENTS:
value1 [number! char! pair! tuple! vector! time! date!]
value2 [number! char! pair! tuple! vector! time! date!]
RETURNS:
[number! char! pair! tuple! vector! time! date!]
>> ? is
*** Script Error: is operator is missing an argument
*** Where: catch
*** Stack:is) takes precedence over func ?trim/all and clear but in both cases index: 0.trim/all part: 0. == has to do with it?== is case-sensitive on stringsstring1 = string2 yields?same-letter?: func [a [char!] b [char!]] [ (head change "" a) = (head change "" b) ] should efficient enough I guessstring/equal? I agree, lowercase should work>> a: "a" == "a" >> b: "b" == "b" >> a: a xor b == "^C" >> b: b xor a == "a" >> a: a xor b == "b" >> a == "b" >> b == "a"
swap1: func ['a 'b] [set a (get a) xor (get b) set b (get b) xor (get a) set a (get a) xor (get b)] swap2: func ['a 'b] [set a also get b set b get a] x: 1 y: 2 clock [swap1 x y] clock [swap2 x y] clock [(lowercase #"t") xor (lowercase #"T") = #"^@"] clock [to logic! (lowercase #"t") xor (lowercase #"T")]
0:00:00.589000001 [swap1 x y] 0:00:00.287000001 [swap2 x y] 0:00:00.156000001 [(lowercase #"t") xor (lowercase #"T") = #"^@"] 0:00:00.184000001 [to logic! (lowercase #"t") xor (lowercase #"T")]
>> do/args %red.r "-r environment/console/CLI/console.red" Script: "Red command-line front-end" (none) -=== Red Compiler 0.6.3 ===- Compiling /home/sony/Code/red/environment/console/CLI/console.red ... *** Red Compiler Internal Error: Script Error : repend expected series argument of type: series port *** Where: comp-func *** Near: [repend shadow-funcs [ decorate-func/strict name shadow: to-context-spec symbols ctx spec ] bind-function body ]
-=== Red Compiler 0.6.3 ===- Compiling /media/sf_VMShare/Red/red/environment/console/CLI/console.red ... ...compilation time : 1235 ms Target: Linux Compiling to native code... ...compilation time : 34717 ms ...linking time : 583 ms ...output file size : 995936 bytes ...output file : /media/sf_VMShare/Red/red/console
HEAD now too. I've restarted Rebol 3 times before posting this, to be sure...r: make object! [ a: [1 2 3] b: [4 5 6] on-deep-change*: func [owner word target action new index part][ print ['on-deep-change* tab word] ] on-change*: func [word old new][ print ['on-change* tab word] modify old 'owned none modify new 'owned reduce [self word] ] ] reverse/part r/a 2 r/a: [3 2 1] probe r reverse/part r/a 2
*** Runtime Error 1: access violation *** at: 0807DCF5h
modify, e.g. what fields in aggregate structure can be modifed?modify action for that. It's a WIP feature. I want to use it for providing write access to some datatypes internal properties. For example, ability to set the internal encoding of a string! (to shrink it when possible).>> max 1.2.3 1.2.3.4 *** Script Error: value out of range: 1.2.3.4 *** Where: max *** Stack: >> max 1.2 1.2.3.4 == 1.2.3.4
max and min when applied to two tuple! arguments require tuples of the same size, in other words the comparison is not based on lexicographic ordering, in contrast to > and < for tuples. I think this is a missed opportunity and worth a WISH.max and min may be applied to a tuple and a float or integer, with the float converted to integer first, and then it is compared to each of the elements of the tuple. Is this useful, I wonder?1.2 is a float, and not a tuple.1 and takes the max; all four tuple elements are >= 1max 2 1.2.3.4 ; == 2.2.3.41.1.1 = min 1.2.3 1 is kinda weird and unexpected? even the hypothesis that min of 2 values should return one of these values: not none? find [p q] min p q is broken by itif p >= q then (max p q) = p logic: >> 0x1 > 1x0 == true >> max 0x1 1x0 == 1x1
type? a/b should be logic?true is a word! that gets evaluated to logic! value. However when you are constructing map!, that word is not evaluated.#[true].>> sort/reverse [1.#inf 1.0 1.#nan 0.0 -1.#inf] == [1.#INF 1.0 1.#NaN 0.0 -1.#INF] >> sort [1.#inf 1.0 1.#nan 0.0 -1.#inf] == [1.0 1.#INF 1.#NaN -1.#INF 0.0]
>> mod 1.2.3 4.5.6
*** Script Error: cannot compare 1.2.3 with 0
*** Where: <
*** Stack: mod
>> modulo 1.2.3 4.5.6
*** Script Error: absolute does not allow tuple! for its value argument
*** Where: absolute
*** Stack: modulo mod
>> help mod
USAGE:
MOD a b
DESCRIPTION:
Compute a nonnegative remainder of A divided by B.
MOD is a function! value.
ARGUMENTS:
a [number! char! pair! tuple! vector! time!]
b [number! char! pair! tuple! vector! time!] "Must be nonzero."
RETURNS:
[number! char! pair! tuple! vector! time!]
>> help modulo
USAGE:
MODULO a b
DESCRIPTION:
Wrapper for MOD that handles errors like REMAINDER. Negligible values (com
ared to A and B) are rounded to zero.
MODULO is a function! value.
ARGUMENTS:
a [number! char! pair! tuple! vector! time!]
b [number! char! pair! tuple! vector! time!]>> a: #()
== #()
>> put a 'b 1
== 1
>> a
== #(
b: 1
)
>> clear a
== #()
>> put a "b" 1
== 1
>> a
== #(
"b" 1
)
>> clear a
== #()
>> put a 'b 1
== 1
>> a
== #()
>>clear issue, I can trigger same bug without put:>> a: #()
== #()
>> a/b: 1
== 1
>> clear a
== #()
>> a/("b"): 1
== 1
>> clear a
== #()
>> a/b: 1
== 1
>> a
== #()map! behavior, it's doc'd on https://doc.red-lang.org/en/map.html. switch type? x [integer! [...]] case of mistake), which was maybe a misremembering, but still is closely related, and I've seen people trip on switch behavior and ask the same question a few times on my memory :)map!, not even about mentioning evaluation rules somewhere, but about a need to make it clearly visible for the newcomers, so they can shortly develop a *habit* of looking at these things in a proper way :)event/away?. In later builds, when mouse is moved into a face three events are generated for event/away?: false, true, false. Moving out is correct. In stable build events are correct. If face is transparent events are generated as if all-over was declared in later builds. Stable build is correct in this regard also.i: 0 view [size 150x150 base 100x100 on-over [prin event/away? print ["" i: i + 1]]]
true and false events are generated continuouslyi: 0 view [size 150x150 box 100x100 on-over [prin event/away? print [i: i + 1]]]
box>> do func [a][1] 1 == 1 >> do func [][1] == func [][1]
do treats zero-argument functions differently from 1-argument functionsdo>> do [func [][1]] == func [][1] >> reduce [func [][1]] == [func [][1]] >> do reduce [func [][1]] == 1 >> reduce reduce [func [][1]] == [1]
do are: [block! path! string! url! file! error!] Everything else is evaluated passively.>> type? x: to-issue "hi there" == issue! >> x == #hi there >> #hi there *** Script Error: there has no value *** Where: catch *** Stack:
to's design is not casted in stone.>> type? #HODL,42 == 0.42 >> type? #HODL:42 *** Syntax Error: invalid value at ":42" *** Where: do *** Stack: load
;. Should it?; is a commentany-word! in R3 though.>> to-issue "HODL:42" == #HODL:42 >> to-issue "a;bc" == #a;bc
refinement!, issue! is part of all-word!which further includes any-word!. In Red, the latter is only make typeset! [word! set-word! lit-word! get-word!]ref! type proposal, which can be a string type. do-events alone, on GUI console it stuck in an infinite loop.*** Script Error: path none is not valid for none! type on non-GUI console.do-events will start an infinite loop. a is a string! "5678", c is the same string! buffer at the index 7 (that is set 2 chars behind the series tail). In change/part c 99 -1 expression the starting index (-1 relative to c) is still behind the tail by 1 char. Should Red first get back to the tail, then offset by -1 (resulting index being 4), or first offset by -1 then check that it's behind the tail and move to the tail (resulting index being 5)? Should the output be "567899" or "56799". Which way is more consistent and expected?56799s: "123" c: skip s 10 remove/part s 2 change c "98" s ; == "32398"
56799 or 567899?56799, if we treat it like a "memory" index with no oob, it would be
567899.
56799 answer comes from the idea that *series after the tail should be treated as if it's at the tail*, which I totally understand (or are there more arguments to support it?).567899 answer): change/part c 99 -1 as change/part (at c -1) 99 1 and expect the same result#"8" = pick c -3 I might expect change/part c 99 -3 start it's changes from #"8" char(index? c) > length? head c there's always some source of ambiguity, but rooting it out isn't an option if you ask me567899 over 56799 but just a little bit.5 = index? c, to get it past the tail you need to remove something first from a>> a: "345678" c: tail a remove/part a 2 == "5678" >> index? c == 7 >> append a "91011" == "567891011" >> c == "011"
>> a: [1 2 3 4] == [1 2 3 4] >> c: at a 7 == [] >> change/part a [] 4 == [] >> head a == [] >> head c == [] >> index? c == 5 >> insert c [5 6] == [] >> a == [5 6] >> c == [] >> insert c [7 8 9] == [5 6] ; unexpected?! Why does it insert in `head c`? >> c == [6] >> head c == [7 8 9 5 6] >> a == [7 8 9 5 6] >> index? a == 1 >> index? c == 5 >> c == [6]
index? c should fix offset of c and return 0 after change/part, but in that case all series functions should set & check a dirty? flag, which might not good performance wise.>> a == "5678" >> index? c == 5 >> remove a index? c == 4 >> insert a 123 index? c == 4 >> append a a clear skip a 3 index? c == 4 >> x: copy a append clear a x index? c == 1
g: func [s] [loop 4 [append s take head s]] f: does [ s: tail "1234" g s s ] >> f == "1234" ???
index? doesn't change c but only returns max :>> a == "5678" >> index? c == 5 >> insert a 4 index? c == 6 >> insert a 23 index? c == 7 >> insert a 1 index? c == 7
>> parse [x] [collect some [collect keep ['x]]] == [[x] []] >> parse [x] [collect some [collect keep ['x ()]]] == [[x]]
collect (with no paren following it) an empty collection box is created, like this:>> parse [x] [collect some [collect keep ['x | word!]]] == [[x] []] >> parse [x] [collect some [collect keep ['y | word!]]] == [[x]] >> parse [y] [collect some [collect keep ['x | word!]]] == [[y]] >> parse [y] [collect some [collect keep ['y | word!]]] == [[y] []] >> parse [y] [collect some [collect keep ['y () | word!]]] == [[y]] >> parse ["a"] [collect some [collect keep ["a" | word!]]] == [["a"] []] >> parse ["a"] [collect some [collect keep ["b" | string!]]] == [["a"]] >> parse [#"a"] [collect some [collect keep [#"a" | char!]]] == [[#"a"] []] >> parse [#"a"] [collect some [collect keep [#"b" | char!]]] == [[#"a"]] >> parse [#"a"] [collect some [collect keep [#"a" () | char!]]] == [[#"a"]] >> parse [1] [collect some [collect keep [quote 1 | integer!]]] == [[1] []] >> parse [1] [collect some [collect keep [quote 1 () | integer!]]] == [[1]] >> parse [1] [collect some [collect keep [quote 2 | integer!]]] == [[1]]
collect>> parse [1] [some [(print '.) integer!]] . >> parse [x] [some [(print '.) 'x]] . .
--assert a = to email! #"a"
a is word not the email a. I can make the test pass by changing it to:--assert equal? head remove/part next a@b 2 to email! "a"
email!.>> em: to email! #{}
==
>> type? em
== email!
>> length? em
== 0to design' wiki.>> split "abc def asd" " " == ["abc" "" "" "def" "" "" "" "" "" "" "" "" "" "" "" "" "" "asd"] >>
>> type? @ ;== email! >> split "1,2,3,,,6" "," == ["1" "2" "3" "" "" "6"]
>> parse [a@a.com] [some [(print '.) email!]] . == true >> parse [a@a.com] [some [(print '.) a@a.com]] . . == true
split trim/lines "abc def asd" " " == ["abc" "def" "asd"]
text >> parse [FOO]['foo] == false >> parse [FOO]['FOO] == true >> parse/case [FOO]['FOO] == true >> parse/case [FOO]['foo] == false
@ and should be a minimum of two characters. Red doesn’t adhere to these restrictions, currently. ref! type, which would be of the form @your-name-here. split in the future, based on the Rebol version I hope. I have a bit of work done on that, but needs design review.issue! is. We have it already.email: to-email "" foreach part [tom @ global - red . com][append email part] == tom@global-red.com
email: @red-global.com foreach guru [rebolek 9214 greggirwin][append [] head insert copy email guru] == [rebolek@red-global.com 9214@red-global.com greggirwin@red-global.com]
>> f: func['val][type? get/any :val] == func ['val][type? get/any :val] >> f xxx == unset! >> b: [a] f b/xxx == none!
unset! instead of none!?unset, not paths.path! accessor implements select logic:>> select [what] 'ever == none
read-clipboard doesn't work anymore, I tested on Win8.1 x64, non-GUI console.read-cliboard doesn't work after unview. view [button "ok"] immediately crash my GUI console, but it I think my Win8 has problems with gfx card driver.unview read-clipboard always returns none even though it's not emptywrite-clipboard returns false and does nothing>> read-clipboard == "test" >> view [button "ok" [unview]] >> read-clipboard == none >> about Red 0.6.3 for Windows built 11-Jun-2018/13:34:14+03:00 commit #de47b6c
none clipboard issue on Win10 here as well.>> read-clipboard == "test" >> view [button "ok" [unview]] >> read-clipboard == "test" >> about Red 0.6.3 for Windows built 12-Jun-2018/5:18:35+03:00 commit #c55a199
none if index used for pick is 0:>> pick b: at [1 2 3 4 5] 3 0 == none >> b/-1 == 2
>> pick b: at [1 2 3 4 5] 3 0 == 2 >> b/-1 == 1
at and pick in Red and R2. >> b: "123" == "123" >> pick tail b -1 == #"2"
skip. Another subtle topic, for which there are pros and cons each way, and worthy of some good docs.none. pick funcs have also been discussed in the past. e.g. zpick/zpoketo email! appears to do nothing with 29-May-2018 build>> to url! [one two three] == one://two/three >> to file! [one two three] == %onetwothree >> to email! [one two three] == onetwothree
to url!?@, so maybe it's a compatibility decisionprobe to-email [user some long domain name out there dom]to from string. R2 might be a better reference than R3 here.>> to email! [a] ** Script Error: Invalid argument: a ** Near: to email! [a] >> to email! [a b] == a@b >> to email! [a b c] == a@b.c >> to email! [a b c d] == a@b.c.d >> to email! [a b c d e] == a@b.c.d.e
to refuses point! even though point! is listed by ? datatype!. I assume it is TBDto email! makes sense to mePoint! is TBD, yes.>> parse %234 ["23" thru [end]] == true >> parse/part %234 ["23" thru ["4" end]] 3 == true >> parse/part %234 ["23" thru [end]] 100 == true >> parse/part %234 ["23" thru [end]] 3 == false
>> parse/part %234 ["23" thru [end]] 1 == true >> parse/part %234 ["23" thru [end]] 2 == true >> parse/part %234 ["23" thru [end]] 3 == false >> parse/part %234 ["23" thru [end]] 4 == true >> parse/part %234 ["23" thru end] 3 == true >> parse/part %234 ["23" to [end]] 2 == true >> parse/part %234 ["23" to [end]] 3 == false >> parse/part %234 ["23" to [end]] 4 == true >> parse/part %234 ["23" to end] 3 == true
try [ return 42] just closes the console (no error message). With /all it works as expected (Red error: cannot use return outside function). Is this a bug?print recently?>> print type? "hi" string >> probe type? "hi" string! == string!
!?print is using form and probe is using mold:>> form type? "hi" == "string" >> mold type? "hi" == "string!"
to-UTC-date function. For example: to-UTC-date now. But in the cli, it works fine. Latest build (commit 67531575), Win 10Red/System [
]
money: context [
; the exponent is too small, so it's attempted to scale it up by increasing the exponent of the DEC64 value
pack-increase: func [
coefficient [float!]
exponent [integer!]
return: [integer!]
/local
values [struct! [coefficient [float!] exponent [integer!]]]
]
[
values: as struct! [coefficient [float!] exponent [integer!]]
;values/coefficient: 1.0
0
]
]Compiling to native code...
*** Compilation Error: wrong return type in function: money/pack-increase
*** expected: [integer!], found: [none]
*** in file: %/E/Development/red_old/test.reds
*** in function: money/pack-increase
*** at line: 16
*** near: [
values: as struct! [coefficient [float!] exponent [integer!]]
0
]Red/System [
]
money: context [
; the exponent is too small, so it's attempted to scale it up by increasing the exponent of the DEC64 value
pack-increase: func [
coefficient [float!]
exponent [integer!]
return: [integer!]
/local
values [struct! [coefficient [float!] exponent [integer!]]]
]
[
;values: as struct! [coefficient [float!] exponent [integer!]]
values/coefficient: 1.0
0
]
]values: declare struct! [coefficient [float!] exponent [integer!]]
power with 2 integers sometimes returns integer and sometimes float?2 ** 5 => 32.0 always gives me a knee-jerk reaction.base ** exponent form.10 ** 7 - '1 and that many zeroes')view [base 100x100 99.99.0 focus on-key [unview]]
view [base 100x100 99.99.0.0 focus on-key [unview]]
*** View Error: CreateWindowEx failed! on my PC, but that is only me I guess.base squareCreateWindowEx in the CLI console, and an immediate crash in the GUI console, but no 2nd windowinsert-event-func?insert-event-func isn't so bad, especially as things get more complex. In any case, I have notes for wanting to do a key-binding/key-map dialect. Maybe we can bounty that soon.last: func [ "Returns the last value in a series" s [series! tuple!] ][ pick back tail s 1 ]
last: func [ "Returns the last value in a series or tuple" s [series! tuple!] ][ pick s length? s ]
length? didn't work for tuples in the past.last.>> 10% == 10% >> 1% == 1% >> 1.#NAN == 1.#NaN >> 1% == 1.#NaN >> 1% == 1.#NaN >> 1.#inf == 1.#INF >> 1% == 1.#INF
>> 10% == 10% >> 1% == 1% >> 1.#NAN == 1.#NaN >> 1% == 1.#NaN >> 1% == 1.#NaN >> about Red 0.6.3 for Windows built 18-Jun-2018/18:11:17+05:00 commit #6753157
Red [] context [ start: end: 0x0 inside?: false diff-s: diff-e: none view/tight [ i: image 0.0.0.245 64x64 all-over draw [] on-down [ either within? event/offset start end - start [ inside?: yes diff-s: event/offset - start diff-e: end - event/offset ][ inside?: no face/draw: compose [box (start: end: event/offset) (end)]] ] on-over [ if event/down? [ either inside? [ change back back tail face/draw reduce [ start: event/offset - diff-s end: event/offset + diff-e ] ] [ change back tail face/draw end: event/offset ] ] ] with [ menu: ["Cut" cut "Copy" copy "Color" color] ] ] ]
with [ menu: ["Cut" cut "Copy" copy "Color" color] actors: object [ on-menu: func [face event][ switch event/picked [ cut [ probe "cut" ] ] ] ] ]
actors facet be a block?actors: lineactors: make self/actors [ ... ]self I believe.with>> 1 / 0 *** Math Error: attempt to divide by zero *** Where: / *** Stack: >> 1.0 / 0 == 1.#INF
int op int one expects to stay inside the integer space>> to-binary -1.#NaN
== #{7FF8000000000000} ;<--- would be better to have it #{FFF8000000000000}
>> to-binary 1.#NaN
== #{7FF8000000000000}>> tangent/radians (pi / 2) *** Math Error: math or number overflow *** Where: tangent
1.#INFFFF8000000000000 is a signaling NaNtangent/radians point, you should file a ticket for that, and for tangent 90>> positive? 1.#NaN == false >> negative? 1.#NaN == true >> zero? 1.#NaN == true
< > comparisons need an extra check. Fortunately, there is a NaN? native that should make it easy. All comparisons should return false, except inequality, which should always return true. If we agree on that, lets ticket it.< > operators already, so maybe it should be added thereatan has an erroneous docstring:USAGE:
ATAN angle
DESCRIPTION:
Returns the trigonometric arctangent.
ATAN is a function! value.
ARGUMENTS:
angle [float!] "Angle in radians."angle should be number and has nothing to do with radiansarctangent:USAGE:
ARCTANGENT angle
DESCRIPTION:
Returns the trigonometric arctangent (in degrees by default).
ARCTANGENT is a native! value.
ARGUMENTS:
angle [number!]
REFINEMENTS:
/radians => Angle is specified in radians.
RETURNS:
[float!]Red [] probe -10% probe type? -10% probe -10% * 0.1
-c or -c -e or -r -e:#-10%- issue! *** Script Error: * does not allow issue! for its value1 argument *** Where: * *** Stack:
1.#NaN instead of error?>> arcsine/radians -3.0 *** Math Error: math or number overflow *** Where: arcsine
1.#INF and 1.#NaN values accessible.sin are just shortcuts for sine/radians. I think that it would be more useful to provide these without all the conversion jumbo/mambo and rounding and map them just to libC versions to make them faster.1.#INF and 1.#NaN values accessible.function! trig funcs, as opposed to natives, use float!. We should visit them all at once, and make sure they're consistent.float!0.0 in cases where it would show some not rounded value -> https://github.com/red/red/blob/master/runtime/natives.reds#L1625>> number? 1.#NaN == true
false as NaN means _Not a Number_. number? could be a native and do also tests for NaN and we would not need nan? function.float!.if not nan?. Ok...there are more important topics.>> float? 1.#NaN == true >> integer? 1.#NaN == false >> NaN? 1.#NaN == true
a: 0.0 while [a < 2.0 ][
if number? n: asin a [print [a "=" n]]
a: a + 0.2
]not error? try now or not nan? if asin would return 1.#NaN instead of throwing error.>> f: func[a return: [integer!] c /local b][] == func [a return: [integer!] c /local b][] >> ? f Func spec couldn't be parsed, may be malformed. func [a return: [integer!] c /local b][]
clear clear the complement flag?>> b: complement make bitset! []
== make bitset! [not #{00}]
>> clear b
== make bitset! [not #{00}]>> b: complement charset ["x"]
== make bitset! [not #{00000000000000000000000000000080}]
>> clear complement b
== make bitset! #{00000000000000000000000000000000}pick, poke, they are useful and simplifies using bitsets.clearing a bitset.bitset! generally?break doesn't work well in foreach-face:ui: layout [ text "foo" ] print "Starting" foreach-face ui [ print face/type ] print "Ended"
ui: layout [ text "foo" ] print "Starting" foreach-face ui [ print face/type break ] print "Ended"
clear should also clear the complement flag. That is what the average user will expect from the notion implied by the use of the word "clear". The complement flag is just a device for not having to set a lot of bits explicitly, especially given the upper limit of Unicode, since bitsets are often used for character sets.clear supports bitset! then it should also clear the complemented flag.foreach-face evaluate the body block with do, hence fails. If you remove do below you can see the difference:>> f: func [b] [foreach x [1 2 3] do b] == func [b][foreach x [1 2 3] do b] >> f [print x break] 1 *** Throw Error: no loop to break
do is there redundant.. use just: f: func [b] [foreach x [1 2 3] b]do it is equivalent to:>> f: func [b] [do b] == func [b][do b] >> f [print x break] 1 *** Throw Error: no loop to break
>> do [print 1 break] 1 *** Throw Error: no loop to break
email! should adhere to this format:@, followed by zero or more characters.@@, one or more charactersbreak>> ui: layout [ text "foo" ]
== make object! [
type: 'window
offset: none
size: 100x44
text: none
...
>> try/all [foreach-face ui [ print face/type break ]]
text
*** Script Error: catch does not allow native! for its block argument
*** Where: catch
*** Stack:
>> try/all [loop 1 [foreach-face ui [ print face/type break ]]]
text
(halted)
*** Script Error: try-do does not allow none! for its <anon> argument
*** Where: try-do
*** Stack:Red [needs: 'view] ui: layout [ text "foo" ] probe try/all [foreach-face ui [ print face/type break/return 'x 'y ]] probe try/all [loop 1 [foreach-face ui [ print face/type break/return 'x 'y ]]]
text [] text [] finished
x not []stack/dump and it barfed.Red [Needs: View] system/view/debug?: on ui: layout [ text "foo" ] stack/dump try/all [foreach-face ui [ print face/type break/return 'x 'y ]]
stack/dump afterthe try/all, it returns text, then blows up, so it must be unrelateddo https://gist.githubusercontent.com/maximvl/6787d6fb3382bf72399eab87b2857d86/raw/eb07d68dff6a718739d56817869dcf769d909dff/game.red *** Runtime Error 1: access violation *** at: A48EEF24h
do https://gist.githubusercontent.com/toomasv/9c7f400a36fecec9e9b2faf567035ea5/raw/9621390243c683fe683a25f5f8b6c22186ecee87/ellipse1.red
do https://gist.githubusercontent.com/toomasv/b8883f41543c4b54142b4a62a5386797/raw/d0e8f00ab6b6cd3a1bb32f6ad789197955579744/spirograph.red
number? being consistent with the other type checking funcs. In that sense, NaN is a number, as it's represented as a special float value.Help should handle that, so it's a bug.clear should clear the not meta flag. https://www.red-lang.org/2013/11/041-introducing-parse.html points to http://www.rebol.com/r3/docs/datatypes/bitset.html, which clearly says parse. If you use bitsets as a more general sparse map or index.atan2 is usually used to find angle from 0x0 to a cursor position, when the result is 0x0 for the input 0x0, it may break your animation or whatever you do with it. The proper calculation should detect such an input . If the result would be 1.#NaN, you could check output for such a case. With the modification to number? you could write:if number? angle: atan2 y x [...]
atan2 and arctangent2, I would prefer them to follow the convention and one accept degrees, while second radians.number? 1.#NaN should be true because number? is a test for membership in a number! typeset which includes float! and 1.#NaN is definitely a float! and it would be quite misleading to have it otherwisetrue = number? not-a-number is an unfortunate oxymoron we'll have to live with, but it's a naming issue, right?atan to zero, I would myself like to know why it's even done like that. What's the reason? I would expect sin 1e-100 to be the same 1e-100, not zero (same for tan/atan obviously). Maybe I'm going to multiply it by 1e99 in the next step? Why should I suffer from the loss of precision? Why should I fight the language while it makes obstacles for me?number? 1.#nan returning trueis useful? With a cost that there is also nan?, which could be eliminated?mold or form functions.. if it is needed.number? 1.#nan returning trueis useful? With a cost that there is also nan?, which could be eliminated?f: func [x [number! string!]] [either number? x [...][...]]either any [number? x nan? x]? looks like a bloat to me, and not just bloat but also *yet another* special case to always keep in mind => source of bugs => source of headaches => less fun to code innumber? with NaN being like it is? Consistency. Ease of understanding. Typeset checking has very clear semantics today. If we go down the path of special value validity, where will that lead? The result of make email! "" is not going to be a valid email address, but it's still a value of that type. As @hiiamboris said, it's the IEEE name for it that's the problem here. If we call it "Not A *Usable* Number", does that help? :^)system/options/decimal-digitsif result < epsilon [result = 0] just like thattangent is unaffected, only sine and cosine>> probe make error! [user message ["tests"]]
make error! [
code: 600
type: 'user
id: 'message
arg1: none
arg2: none
arg3: none
near: none
where: none
stack: none
]
*** User Error: none
*** Where: ???
>>cause-error works, and just wraps make error!. Hmmm.>> error? set 'err try [cause-error 'user 'message ["tests"]]
== true
>> probe err
make error! [
code: 600
type: 'user
id: 'message
arg1: "tests"
arg2: none
arg3: none
near: none
where: 'do
stack: 41519516
]
*** User Error: "tests"
*** Where: do
*** Stack: probeeither string? instead of number? if you really expect NaN values there too (which is not muchload-thru:? (load-thru https://picsum.photos/100/100?random) works 1st time, saves it but won't load it again, complaining (solved by do load-thru ...)? (load-thru https://picsum.photos/100/100/?random) (note the slash) won't save the image at allexists-thru? and clear the file. For a random result, it doesn't make sense to use the cache. See also: https://github.com/red/red/pull/3124>> path-thru https://picsum.photos/100/100/?random == %/C/Users/Gregg/AppData/Roaming/Red/cache/picsum.photos/100/100/
>> ? (load-thru https://picsum.photos/100/100?random) *** Script Error: word-is-value-str does not allow block! for its word argument *** Where: word-is-value-str *** Stack: ? help-string
help that's choking on the result.paren! it seems. Care to file a ticket?image! but then loads - as a block!, so as I said previously I have to do it (which is probably not by design)*-thru funcs as works in progress. We don't yet have /all for saving, for example. That's the issue at play here. I just checked, and R2 uses read-thru, which does read+write/binary rather than load/save directly. >> 42x42 // 84x84 *** Script Error: cannot compare 42x42 with 0 *** Where: < *** Stack: mod
mod 84x84 42x42, or mod <any-pair> <any-pair>pair!, so a bug IMO.mod problem already.face/data. (You might want to use react later in first version)face/datareduce/into which is getting filled as you can see from probe output - it prints [3] when I enter 1 + 2 into the fielddump-reactions tells that it's registered also.face/text is not updated when face/data changesview/no-wait [f: field text react later [face/text: form probe reduce/into f/data face/data: clear []]]
view/no-wait [f: field text react later [probe reduce/into f/data clear face/data: []]]
:on-face-deep-change* and it looks like it changes data in response to a deep change of text but not the other way around, so the only data -> text mechanism lies in :on-change*face/data: [] assigns it to itself and triggers on-change* which displays stuff by modifying face/text -> then face/data is modified yet modifications remain unreflected until the next face/data: [] eventview [f: field text react [probe reduce/into f/data face/data: clear []] react [face/text: form face/data]] fixes it>> about Red 0.6.3 for Windows built 7-Jul-2018/21:53:14+02:00 commit #0db15f7 on Win 7 >> view [panel red [text "Hello" green]]
face/data. First time it is cleared, second time result of f/data is reduced into it. Only first change is reflected in face/text. May be completely wrong though.>> prin append/dup [] '* 1 *** Script Error: * operator is missing an argument *** Where: prin *** Stack: >> prin (append/dup [] '* 1) *** Script Error: * operator is missing an argument *** Where: prin *** Stack: >> prin [append/dup [] '* 1] *
>> prin append [] '* *** Script Error: * operator is missing an argument *** Where: prin *** Stack: >> append [] '* == [*] >> prin '* *
prin '*?print how it interprets its arguments. It's native, so you need to look at R/S sources to be exactly sure.wait issue planned to be fixed for GUI Console?>> p: make path! 10 == >> insert p 'root == >> append p 'refinement == root/refinement
insert inserts the value to the current position and returns the position just after the insert. This gives you to chain insert operations>> p: make path! 10 >> head insert p 'root == root >> head insert insert p 'a 'b == a/b/root
head insert tail seriesmake path!. It’s just == >> p: make path! 10 == #[path! []] >> insert p 'root == #[path! [root] 2]
== make path! [] in console, just like as hash values:>> h: make hash! 0 == make hash! [] >> p: make path! 0 == make path! [] >> form h ; == "" >> form p ; == ""
>> append/dup/only [] make path! 0 5 == [#[path! []] #[path! []] #[path! []] #[path! []] #[path! []]]
make path! [] is not enough in such a case:>> empty? p: insert insert make path! 0 'root 'foo == true >> p == #[path! [root foo] 3] >> index? p == 3 >> head p == root/foo
>> d: read/binary %"D:\filmz\560MB-test.mp4"
== #{
00000018667479706D7034320000000069736F6D6D703432001C27D76D6F6F76
0000006C6D76686400000000D4...
>> d: read/binary %"D:\filmz\560MB-test.mp4"
*** Internal Error: not enough memory
*** Where: read
*** Stack:
>> d: read/binary %"D:\filmz\560MB-test.mp4"
*** Access Error: cannot open: %D:\filmz\560MB-test.mp4
*** Where: read
*** Stack:*** Script Error: invalid argument: 56264x84424 *** Where: make *** Stack: view do-events do-actor do-safe fit prettify draw
>> make image! 56264x84424 ** Script error: maximum limit reached: image! ** Where: make ** Near: make image! 56264x84424
red-image!: alias struct! [ header [integer!] ;-- cell header head [integer!] ;-- series's head index (zero-based) node [node!] ;-- internal buffer or platform-specific handle size [integer!] ;-- pair of size ]
>> bind quote (a + b) context [a: 1 b: 2] *** Script Error: bind does not allow paren! for its word argument *** Where: bind *** Stack:
as block! no problem, but why bind can't do that itself?do bind [a + b] context [a: 1 b: 2] would work.bind, why can't it take any-block! (or at least paren! and hash!)quote as you do above. Same for paths.quote is there just to make a short example. I was making a DSL that will among things contain blocks (that will denote loops) and parens (that akin to parse will denote expressions). So I don't get quote there, parens come naturally from foreach token expression [switch type?/name token [...]] Context for it is created on the fly where most of the words used will have meaning. It's just a first iteration, and I think I'll experiment a bit and instead of paren! [do bind as block! token] will just bind the whole expression, that will recursively bind all my parens. So, no trouble with that.do bind token assuming that bind being able to bind blocks - should be able to bind parens too. I didn't even check it, until I got an error. It's just logical, no? That's why my question arose here, if it's desired.bind-ing it nor reduce-ing or do-ing. It sort of lives in a different world with no interface to Red features. I cannot know if it's by design or because it's a recent addition and is not *yet* integrated enough.bind should be able to bind hash valuesdo/reduce a hash just like any block or is there arguments against thatBind only supports blocks, by design right now. As I said, it's a good question, and needs examples for discussion. Hash! is, indeed, a special case right now. I agree that a unified interface is a good thing, but we may need to live with some exceptions.%hash.reds, I saw that the append action is not inherited, but hash! supports append. Early here. Must be missing something.trim/all causes spooky behavior here:digits: charset ["0123456789"]
mastercard: [["51" | "52" | "53" | "54" | "55"] to end]
visa: ["2" to end]
accepted-cards: [mastercard | visa]
valid-length: [16 digits]
validate-entry: func [n][parse trim/all n valid-length]
view [
f: field 200x20 on-change [either validate-entry f/text [f/color: green][f/color: white]]
]trim/all is removed:digits: charset ["0123456789"]
mastercard: [["51" | "52" | "53" | "54" | "55"] to end]
visa: ["2" to end]
accepted-cards: [mastercard | visa]
valid-length: [16 digits]
validate-entry: func [n][parse n valid-length]
view [
f: field 200x20 on-change [either validate-entry f/text [f/color: green][f/color: white]]
]field are inserted backward. Then an overflow happens eventually.f: field 200x20 on-change [txt: trim/all copy f/text either validate-entry txt [f/color: green][f/color: white]]
f: field 200x20 on-change [either validate-entry trim/all copy f/text [f/color: green][f/color: white]]
trim triggers a change even if it didn't make any change on the text.remove as well. Until that's fixed, we should put a warning in a wiki somewhere about the current behavior.string! values. In the Red sources, VAL_FORM_LIMIT doesn't seem to take into account extra spaces between the columns, so the end of the description text flows down to the next line.? "series"view/no-wait [text 50x15 yellow "text"]>> b: [none] forall b [append b none] *** Runtime Error 16: invalid virtual address *** at: F7EE9BDFh
>> b: [none] forall b [append b none] *** Internal Error: not enough memory *** Where: append *** Stack:
>> system/build
== make object! [
date: 30-May-2018/8:42:26+02:00
git: none
config: make object! [
config-name: 'Linux
OS: 'Linuxsony@deli:~/Code/red$ red
--== Red 0.6.3 ==--
Type HELP for starting information.
>> b: make binary! 2'000'000'000
== #{}
>> b: make binary! 2'000'000'000
*** Runtime Error 1: access violation
*** at: 0805B9D6h>> make binary! 1'000'000'000
== #{}
>> make binary! 1'000'000'000
*** Internal Error: not enough memoryhelp, worth a ticket, to see if we can improve it. The current code, IIRC, is empirical, and getting more info on behaviors with different scaling will help. That one is on me. :^)scalar!default!.help "default" does.immediate!do https://gist.githubusercontent.com/toomasv/01817e797fdb38d277d4c01dad89b326/raw/89182eacf536b2a0ea35e78d96e2d02cb3b803e2/arc.red
arc.red?>> system/view/auto-sync?: false == false >> system/view/auto-sync? == true
ask function in gui-console.red file there is a line system/view/auto-sync?: yes so if GUI console use ask for prompt it might be the reason.ask, which resets it.>> system/view/auto-sync?: false system/view/auto-sync? == false >> system/view/auto-sync? == true
function!, but not an op!. Is that expected?>> block: reduce [:+]
== [make op! [[
"Returns the sum of the two values"
value1 [number! char! pair! tuple! vector! time! date!]
value2 [number! char! pair! tup...
>> block/1
== make op! [[
"Returns the sum of the two values"
value1 [number! char! pair! tuple! vector! time! date!]
value2 [number! char! pair! tupl...
>> block: reduce [:set]
== [make native! [[
"Sets the value(s) one or more words refer to"
word [any-word! block! object! path!] "Word, object, map path or block of wor...
>> block/1
*** Script Error: block/1 is missing its word argument
*** Where: catch
*** Stack:
>> first block
== make native! [[
"Sets the value(s) one or more words refer to"
word [any-word! block! object! path!] "Word, object, map path or block of word...'word decay to word in this case?>> get also 'x parse x: [][change none 'word] == ['word]
copying none in Parse results in an empty block?>> parse [][copy match none (probe match)] [] == true
none! value instead, as it makes checking optional values easier, e.g.:parse [][copy match opt "a" (unless match [...])]
["a" | (no "a" here)] instead.none.reduce and compose may both be applied to a non-block argument, and for arguments not of type any-function! they just yield the result of evaluation, BUT reduce :add gives the native, compose :add gives an error, since it tries to **apply** the native.>> integer!: string! == string! >> type? 100 == percent! >> integer!: none == none >> type? 100 *** Script Error: make-number does not allow none! for its type argument *** Where: do *** Stack: load
protect would take care of that, but is not implemented yet.unprotect can be disabled, then.protect will help us lock some things down, but the above is just an example that shows how Red allows us to redefine pretty much anything. That is, it's not a special case in any way.simple-gc-free, build freshly, but when I compile red CLI or GUI console I get below error, cleaned up the %programdata%\Red folder but same result:C:\Users\endo\Documents\Red\red\build\bin>red.exe Compiling compression library... Compiling Red GUI console... *** Loading Error: file access error: %collector.reds *** in file: %/C/Users/endo/Documents/Red/red/build/bin/inflate.reds *** at line: 127
simple-gc branch.* Merge remote-tracking branch 'red/master' into simple-gc-fixed done by @qtxie at 2018-08-01 15:01mold, form etc.). Neither Rebol nor Red handle this correctly (see example above, also doesn't work in Rebol). The easiest solution would be to disallow redefinition of words that are used for data types.%collector.reds file was missing in the build/include.r file. Should be fixed in the repo then. if or do, do they? If you redefine certain things in Red, you can break the system. Completely. We will get protect at some point, and maybe even a default setting for the global context and standard words that will do what you want. But we can't do what you ask, the way you ask, because it is at the core of how Red works. do or if. Yes, changing them breaks things, but so does changing a lot of other things.>> o: object [number!: 0]
== make object! [
number!: 0
]
>> type? number!
== typeset!
>> type? o/number!
== integer!! or it will conflict. protect, it may be all you need.protect would only render words immutable in their respective contexts, so they can still be defined or redefined elsewhere. As far as I know, this is how protect is implemented in Rebol 3: there, protect does not forbid polysemic shadowing; it does not downgrade words to keywords across contexts.do or if?: at least I can imagine why it sometimes is advantageous to be able to redefine built in functions, but for changing built in fundamental data types, I can't think of any use cases (maybe I'm just unimaginative). Adding new types to existing typesets (similarly to how other languages allow you to implement existing traits on new types), yes.set-path! values, because they open up a security hole.>> unset 'set-path! >> a: [b [c 1]] == [b [c 1]] >> a/b/c: 2 *** Script Error: set-path! has no value *** Where: do *** Stack: load >> load "a b: c/d/e e/f/g: 3" *** Script Error: set-path! has no value *** Where: do *** Stack: load
my-dialect-value: [ ahead not set-path! any-type! ] ; takes any value except for set-path! my-dialect-rule-x: [ ... my-dialect-value ... ] my-dialect-rule-y: [ ... my-dialect-value ... ]
>> x: [a] append/dup x x 4 == [a a a a a] >> x: "a" append/dup x x 4 == "aaaaaaaaaaaaaaaa"
red/tests/source/units/series-test.red, in ===start-group=== "append"block/rs-append copy-cell and string/append-char, but I have to run. Don't have time to poke through it more.append-char, as it's a string. What we need to understand is insert for each type. That's where the meat is.make-transparent where I had to fill alpha with 90000 values for 300x300 image. append/dup str str to-integer log-2 90000 it takes only 16 repetitions + 1 additional step instead of 89999 repetitions. loop to-integer log-2 90000 [append blk blk] can be used, but this is not as quick as append/dup for strings.-r -e flags specified during compilation?>> make error! [math] *** Internal Error: invalid error object field value: none *** Where: print *** Stack:
throw note syntax script math access user internal
>> help system/catalog/errors/throw
SYSTEM/CATALOG/ERRORS/THROW is an object! with the following words and values:
code integer! 0
type string! "Throw Error"
break string! "no loop to break"
return string! "return or exit not in function"
throw block! length: 2 ["no catch for throw:" :arg1]
continue string! "no loop to continue"
while-cond string! {BREAK/CONTINUE cannot be used in WHILE condition block}syntax:>> help system/catalog/errors/syntax
SYSTEM/CATALOG/ERRORS/SYNTAX is an object! with the following words and values:
code integer! 200
type string! "Syntax Error"
invalid block! length: 4 ["invalid" :arg1 "at" :arg2]
missing block! length: 4 ["missing" :arg1 "at" :arg2]
no-header block! length: 2 ["script is missing a Red header:" :arg1]
no-rs-header block! length: 2 ["script is missing a Red/System header:" :arg1]
bad-header block! length: 2 ["script header is not valid:" :arg1]
malconstruct block! length: 2 ["invalid construction spec:" :arg1]
bad-char block! length: 2 ["invalid character in:" :arg1]
>> make error! 200
*** Syntax Error: invalid none at none
*** Where: ???
>> make error! 201
*** Syntax Error: missing none at none
*** Where: ???>> 2:00:00 + 1:45:30 == 3:45:30 >> 2:00:00 - 1:45:30 == 0:14:30 >> 2:00:00 / 1:45:30 == 1.137440758293839 >> 2:00:00 // 1:45:30 == 0:14:30 >> 2:00:00 * 1:45:30 *** Script Error: incompatible argument for multiply of time! *** Where: * *** Stack:
>> t1: 2:00:00 == 2:00:00 >> t2: 1:45:30 == 1:45:30 >> reduce [t1/hour * t2/hour t1/minute * t2/minute t1/second * t2/second] == [2 0 0.0] >> to time! reduce [t1/hour * t2/hour t1/minute * t2/minute t1/second * t2/second] == 2:00:00
>> do http://redlang.red connecting to: redlang.red ** Syntax Error: Script is missing a REBOL header
>> do https://www.redlang.red *** Access Error: cannot connect: https://www.redlang.red reason: timeout
>> read https://www.redlang.red ERROR: SSL peer certificate or SSH remote key was not OK *** Access Error: cannot connect: https://www.redlang.red reason: timeout *** Where: read *** Stack:
www only, your certificate is probably set wrong.test.redview/flags [text "test" center] [modal popup]
red --cli test.red and red test.red works, do %test.red on GUI console also works, but do %test.red on CLI console crashes *** Runtime Error 1: access violationcenter then it doesn't crash.Red [Needs: View] view/flags [text "test" center] [modal popup] on Win8.1 (x64) with both CLI and GUI console (fresh built from latest source codes), it works, didn't crash even once.>> charset [#"^(251C)" - #"^(252C)"]
== make bitset! #{0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000>> a: ""
== ""
>> append/dup a "abc" 1000
== {abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabca...
>>probe ... will show the full output, as you know of course :mask:>> charset [#"^(251C)" - #"^(252C)"]
== make bitset! #{00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
>>mold is corrupted now :(probe url or print url just to see content of the url variable... and that is just an example. I prefer to have output at least a few lines before truncating.... issue, so truncation is clear. >> x: make image! 100x100
== make image! [100x100 #{
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
F
>> y: make image! 200x200
== make image! [200x200 #{
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
F
>> x = y
== false
>> x == y
== false
>> x =? y
== false
>> x <> y
== true
>> x < y
...FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}]
*** Where: <
*** Stack:x/size < y/size is fine>> x < y
*** Script Error: cannot compare make image! [100x100 #{FFFFFF
...=, ==, <>, =?, thoughseries!img: make image! [100x100 120.20.199.200]load form enbase/base img/alpha 2load form enbase/base img/alpha 64 works.load form enbase/base img/alpha 58 *** Syntax Error: invalid integer! at "9M3wUgPyR2Zan9RQA8kdh3bVYorFdp4UrsNvfb4m"
load form enbase/base img/alpha 16 works.type? it returns. File a ticket.1.#INF *normally*. See if you can narrow down exactly where it hangs.>> img: make image! [100x100 128.24.90.0]
== make image! [100x100 #{
80185A80185A80185A80185A80185A80185A80185A80185A80185A80185A
80185A80185A80185A80185A80185A80185A80185A80185A80185A80185A
8
>> type? load form enbase/base img/alpha 64
== word!
>> type? load form enbase/base img/alpha 58
== float!
>> type? load form enbase/base img/alpha 16
== integer!
>> type? load form enbase/base img/alpha 2
== integer!
>>>> img: make image! [100x100 128.24.90.1]
== make image! [100x100 #{
80185A80185A80185A80185A80185A80185A80185A80185A80185A80185A
80185A80185A80185A80185A80185A80185A80185A80185A80185A80185A
8
>> type? load form enbase/base img/alpha 64
== word!
>> type? load form enbase/base img/alpha 58
*** Syntax Error: invalid integer! at "3RNjUkKqqjDMEfyxSGb7aesbxdCxs7gsRKfqd8ZQ"
*** Where: do
*** Stack: load
>> type? load form enbase/base img/alpha 16
== float!find supposed to find things according to typeset also?find ['a a :a a:] any-word! == none >> find [1 2.0 3%] number! == none
Find is already a complex func, and we can do it with parse (with a bit more work), so it's a question of value. It's certainly possible.find [1 2.0 3%] float! is possible !?! I have learned something :smiley: find , if the argument is of type any-block! except hash! is of type datatype! the result is the at the index of the first occurrence of a component of that type.hash! is obvious, but the coverage of paren! and any-path! is unexpectedly nice. Still, I would imagine that the extension to finding by typeset would be almost trivial.find not only (even) more powerful but also more consistent. But I don't know the implementation, may be it isn't so trivial. %runtime/datatypes/block.reds around line 880 , and it looks quite feasible. I will make a REP wish ticket later.pipe: func ['a 'b][ insert/only at c: to-block b 2 a do c] |>: make op! :pipe
>> [1 2 3] |> reverse |> print 3 2 1 >> [1 2 3] |> reverse |> [append 0] |> print 3 2 1 0 >> 1 |> [add 2] |> print 3
then: make op! func ['a 'b][do head insert/only next to block! b a]
help datatype! Red 0.6.3 for Windows built 15-Sep-2018/23:12:03-06:00 commit #09de884tankpad% red
--== Red 0.6.3 ==--
Type HELP for starting information.
>> system/build
== make object! [
date: 19-Sep-2018/20:24:49+02:00
git: none
config: make object! [
config-name: 'Linux
OS: 'Linux
OS-version: 0
>> read http://www.rebolek.com
*** Runtime Error 32: segmentation fault
*** at: F7BCD947h>> read http://www.google.com *** Runtime Error 32: segmentation fault *** Cannot determine source file/line info.
? datatype! weird tooLinux tankpad 4.19.0-1-MANJARO #1 SMP PREEMPT Mon Sep 17 17:34:11 UTC 2018 x86_64 GNU/Linuxhelp is weird, but still usablesony@tankpad ~/code/red master ldd console linux-gate.so.1 (0xf7fc4000) libc.so.6 => /usr/lib32/libc.so.6 (0xf7daf000) libm.so.6 => /usr/lib32/libm.so.6 (0xf7ce2000) libcurl.so.4 => /usr/lib32/libcurl.so.4 (0xf7c58000) /lib/ld-linux.so.2 => /usr/lib/ld-linux.so.2 (0xf7fc6000) libidn2.so.0 => /usr/lib32/libidn2.so.0 (0xf7c3a000) libpsl.so.5 => /usr/lib32/libpsl.so.5 (0xf7c29000) libssl.so.1.1 => /usr/lib32/libssl.so.1.1 (0xf7bba000) libcrypto.so.1.1 => /usr/lib32/libcrypto.so.1.1 (0xf795c000) libgssapi_krb5.so.2 => /usr/lib32/libgssapi_krb5.so.2 (0xf7907000) libkrb5.so.3 => /usr/lib32/libkrb5.so.3 (0xf781e000) libk5crypto.so.3 => /usr/lib32/libk5crypto.so.3 (0xf77e8000) libcom_err.so.2 => /usr/lib32/libcom_err.so.2 (0xf77e3000) libz.so.1 => /usr/lib32/libz.so.1 (0xf77c8000) libpthread.so.0 => /usr/lib32/libpthread.so.0 (0xf77a7000) libunistring.so.2 => /usr/lib32/libunistring.so.2 (0xf7626000) libdl.so.2 => /usr/lib32/libdl.so.2 (0xf7620000) libkrb5support.so.0 => /usr/lib32/libkrb5support.so.0 (0xf7612000) libkeyutils.so.1 => /usr/lib32/libkeyutils.so.1 (0xf760c000) libresolv.so.2 => /usr/lib32/libresolv.so.2 (0xf75f3000)
help changes don't seem too suspect.libcurl3, someone should update it.curl_easy_perform()libcurl3 for Debian, but it should be libcurl4 I believe. I've had Red running on Arch recently (on different machine though), so I wonder where does my problem on Manjaro comes from.libcurl3:i386 is correct for Debian.react?/target recognizes target fields if they were linked with is, but not with react.>> foo: make reactor! [a: 1 b: 2]
== make object! [
a: 1
b: 2
]
>> bar: object [x: 0]
== make object! [
x: 0
]
>> react [bar/x: foo/a + foo/b]
== [bar/x: foo/a + foo/b]
>> react?/target bar 'x
== none
>> bar: object [x: is [foo/a + foo/b]]
== make object! [
x: 3
]
>> react?/target bar 'x
== [foo/a + foo/b]>> a: [
[ b
[ c
[ d]
== [
b
c
d
== [
b
c
d
]
>> 1 2 3
== 3
>> 4 5 6
== 6
>> 6 * 7
== 42
>>>> [
[ a
[ b
[ c
[ ]
== [
a
b
c ; <-- WTF? Note the missing closing bracket.
== [
a
b
c
]
>> object []
== make object! []
>> object [x: 1 y: 2]
== make object! [
x: 1
y: 2
== m ;<-- WTF? Note the missing closing bracket above.source-a: make reactor! [a: 1] source-b: make reactor! [b: 10] obj: object [c: 0] block: [obj/c: source-a/a * source-b/b] react block obj/c ; == 10 source-a/a: 2 obj/c ; == 20 ; react/unlink block [source-a source-b] ; works fine react/unlink block source-a ; freezes the console
>> view [ [ style my-text: text [ title "title" [ across [ ] *** Script Error: VID - invalid syntax at: [title "title" across] *** Where: do *** Stack: view layout cause-error
>> view [ [ title "title" [ across [ style my-text: text [ ] >>
on-menu actor of faces on base's pane are not invoked?view [ base 100x100 silver on-down [probe "gray"] on-menu [probe event/picked] with [ menu: ["One" grayone "Two" graytwo] pane: layout/only [ base 40x40 red on-menu [probe event/picked 'done] on-down [probe "red" 'done] with [ menu: ["One" redone "Two" redtwo] ] ] ] ]
panel or group-box is used instead of top base, on-menu of bottom base works.on-menu actor works on macOS, so it's a Windows issue. about/debug typed in GUI console with latest build results in a silent crash on W10. Can anyone confirm?recycle, followed by ? recycle something like 1 - 5 times or so (it randomly occurs with the help call).Red [File: %bug.red] #include %bug.red a b [[]] c: 0 compose/deep/only []
*** Runtime Error 1: access violation *** at: 0042FDA7h
Red [File: %bug.red] #include %bug.red a b [[]] c 0 compose/deep/only []
*** Script Error: set does not allow È ╗ ╗ @
8`
╗ Þ╔ ║ for its word argument
*** Where: set
*** Stack:text Red [File: %bug.red] #include %bug.red [][][]
*** Runtime Error 1: access violation *** at: 0042FDA7h
recycle/off to see if relates to the GC or not.offset-to-caret.Red:>> x: any [all [1 2 print "yes"] 1] yes *** Script Error: x: needs a value *** Where: x *** Stack:
Rebol2:>> x: any [all [1 2 print "yes"] 3] yes ** Script Error: x needs a value ** Near: x: any [all [1 2 print "yes"] 3]
Rebol3:>> x: any [all [1 2 print "yes"] 3] yes == 3
Ren-c:>> x: any [all [1 2 print "yes"] 1] yes ** Script Error: VOID! values are not conditionally true or false ** Where: all any _ ** Near: [... 2 print "yes" ~~] ** Line: 1
unset! values. In Red and R2 they are "truthy".near part of the message is that, unlike R2, it can be compiled. It should be possible to add that info in interpreted mode though. ;; set up display with target red box
unview/all
view/no-wait compose [
title (rejoin [system/version " " system/build/date])
button "Chase" [Chase]
canvas: panel 500x500 222.222.222 [at 200x200 target: box loose 200x200 red]
dashboard: text 100x50
]
;; Create flying blue box
flier: first get in layout [box 100x100 loose blue] 'pane
flier/offset: -100x-100
append canvas/pane flier
;; function to move blue box closer to red box
Chase: func [][
forever [
if flier/offset = target/offset [break]
wait 0.001
flight-direction: 0x0
if flier/offset/1 < target/offset/1 [flight-direction/1: +1]
if flier/offset/2 < target/offset/2 [flight-direction/2: +1]
if flier/offset/1 > target/offset/1 [flight-direction/1: -1]
if flier/offset/2 > target/offset/2 [flight-direction/2: -1]
flier/offset: flier/offset + flight-direction
dashboard/text: rejoin ["" flier/offset "..." target/offset]
;;;;;;; show canvas
]
'done
]
do-eventssystem/view/auto-sync?: off before your code (and show uncommented).rate without autosync?: off. I think result was decent:view compose [ title (rejoin [system/version " " system/build/date]) button "Chase" [canvas/rate: 64] canvas: panel 500x500 222.222.222 [ at 200x200 target: box loose 200x200 red at -100x-100 flier: box 100x100 loose blue ] on-time [ flight-direction: 0x0 if flier/offset/1 < target/offset/1 [flight-direction/1: +1] if flier/offset/2 < target/offset/2 [flight-direction/2: +1] if flier/offset/1 > target/offset/1 [flight-direction/1: -1] if flier/offset/2 > target/offset/2 [flight-direction/2: -1] flier/offset: flier/offset + flight-direction dashboard/text: rejoin [flier/offset "..." target/offset] if flier/offset = target/offset [face/rate: none] ] dashboard: text 100x50 ]
Rebol:>> all [] == true
Red:>> all [] == none
all [] == true was intentional.Evaluates, returning at the first that is not true. - One can argue that in empty block, no value is not true, so it shouldn't return none.>> all [] == true >> any [] == none
none in both cases as Red does.true or none is other question.all [] doesn't have much meaning to me, but when I try to imagine the kind of situation where that case would occur, I think the Rebol version makes more sense. This could come up while dynamically collecting conditions under which some action is taken. Using all implies that if any of the conditions are not met, then the action would not be taken. Eliminating all the conditions would imply that the action be taken unconditionally.julia, R and python answer respectively true and false when executing all([]) and any([]) .any and all on empty block should return none, because there are no expressions inside the block to base our condition. If that's desired, user can check if block is empty? in advance.false. Therefore, the result should be true.none also. You can argue for both and what's more practical should be implemented.if all[][...] can be rewritten as all [...] anyway, so from this POV, we don't lose anything when all [] returns none. will fix these two issues is for win10/bugs room.date: 11-Oct-2018/10:49:41+02:00 builddo path in the case below returns false?>> a: [b c] == [b c] >> do 'a/b == false >> reduce 'a/b == c
print 5 + 5?obj: make object! [fun: does [print "--> obj/fun run"]] do get in obj 'fun ;; invokes 'fun in R2 only var: get in obj 'fun var ;; invokes 'fun in Red and R2
a: reduce [111 does [print 222]] do pick a 2 do a/2
do.do find a function! do select a 111
do.find returns series at position where the first value of function! datatype was found, select treats block as a key/value store and returns a value that follow the key (if any).obj: make object! [fun: does [print 111]] do get in obj 'fun ;; existing code do reduce [get in obj 'fun] ;; portable version of code
obj/fun.obj: make object! [fun: does [print "--> obj/fun run"]] do get in obj 'fun ;; invokes 'fun in R2 only var: get in obj 'fun var ;; invokes 'fun in Red and R2
do get in obj 'fun>> f: does [print 1] == func [][print 1] >> do :f == func [][print 1]
get in system 'badword in system 'badword system/badword
in returns none if word is not present in an object, accessing non-existend word with path will throw an error, which you can catch or suppress with try and attempt, respectively.>> sort/compare "cbcaabcacc" func [x y][x < y] == "aaabbccccc" >> sort/compare "cbcaabcacc" func [x y][x > y] == "cccccbbaaa"
sort/compare "cbcaabcacc" func [x y][x > y] == "aaabbccccc" sort/compare "cbcaabcacc" func [x y][x < y] == "aaabbccccc"
>> sort/compare "cbcaabcacc" func [x y][x > y] == "cccccbbaaa" >> sort/compare "cbcaabcacc" func [x y][x < y] == "aaabbccccc" >> sort/compare "cbcaabcacc" func [x y][x > y] == "cccccbbaaa" >> about Red 0.6.3 for Windows built 6-Oct-2018/7:28:28+05:00 commit #dafc828
make and Red pushed the consistency by forbidding it from do too. So, the cases where do could consume an arbitrary number of argument values following it are forbidden. The goal was to make R3/Red more easily statically analyzable.draw changes it block! argument If I don't copy, it looks like a bug;d: [box 0x0 10x10 box 20x20 10x10] c: copy d view [base 100x100 green draw d] probe d probe c = d == [box 0x0 10x10 box 10x10 20x20] (d changed) == false
view [base 100x100 green draw d] with the changed block, it still draws the original block.? (draw 500x500 [box 100x100 200x200 box 200x200 100x100])
>> view [base 100x100 green draw x: [box 20x20 10x10 box 15x5 0x10]] >> x == [box 10x10 20x20 box 0x5 15x10]
view [panel with [draw: compose [box 0x0 (size - 1)]]]
box is drawn it seems to take min coord1 coord2 max coord1 coord2 for coordinates.copy before giving our block to draw.>> type? 1:2:-3 >> ; no output >> d: type? 1:2:-3 >> d == time! >> 1:2:3 == 1:02:03 >> 1:2:-3 >> ;no output
probe d:^3time! literals, there can only be a minus sign in front, not in the other parts. What is wrong here IMO is that there is no good error handling/message. Worth a ticket?1:2: is not a legal time literal, not even for 1:02:00 and even it it were acceptable, then -3 should not become unset.1:2 *is* a legal time literal.-3 is not a word, :-3 should not be a get-word. Apparently the lexer grammar has not been so exhaustively tested.:-3 issue in a ticket.red.exe --cli console.red.exe --cli ?Rebol2:>> select/part (skip [1 2 1 2 1 2] 2) 1 2 == 2 >> select/part (skip [1 2 1 2 1 2] 2) 2 2 == 1
Red:>> select/part (skip [1 2 1 2 1 2] 2) 1 2 == 2 >> select/part (skip [1 2 1 2 1 2] 2) 2 2 == none
/part limits the search for the key, but should not affect the reachability of the value. So the following case should be considered a bug:>> select/part (skip [1 2 1 2 1 2] 2) 2 2 == none
/part limits the same for select and find, it's then a matter of documenting this subtle behavior. select/part:/part => Limit the length of the search.
/part as a feature where I don't have to cut the series to do actions on it. Selecting out of the given range seems to be odd to me. I wonder if someone have a real use case.select ... is just a shortcut for all [pos: find ... pos/2], so select/part ... needs to behave like all [pos: find/part ... pos/2], or that would create a new consistency issue.all [pos: find/part ... (part - 1) pos/2] else it is really selecting out of part bound.find/part :) But somehow I feel, that more useful is to be able to do select in given _range_ without need to copy/part the series. >> select/part (probe skip [1 2 3 4 5 6] 2) 4 2 [3 4 5 6] == none >> select/part [3 4 5 6] 4 2 == 5
all [pos: find/part ... (part - 1) pos/2] else it is really selecting out of part bound./part doesn't apply on selecting, but on finding. If you change that, select becomes inconsistent with find.select = second find. That is the meaning of select and how it is implemented both in Rebol and Red.select and not select to be just a shortcut for second find find/part :) But somehow I feel, that more useful is to be able to do select in given _range_ without need to copy/part the series. select consistency with find just for one rare use-case.skip case.none result, that's a bug that need to be logged in a ticket.white while in Rebol it was black?red? ;-)replace behaves different than newly created one>> replace [a] 'a does ["x"] == [func []["x"]] >> rep: do mold :replace >> rep [a] 'a does ["x"] == ["x"]
replace body cannot handle safely a function for its value argument, as it would need to refer to it using :value to keep it inactive (otherwise the function would be called). I just tried such fix here and the results are then identical.:value suppresses any evaluation.>> replace/deep/all [a a a] 'a does [random 100] == [53 81 67]
>> foo: func [x y z][replace x y z] == func [x y z][replace x y z] >> foo [a b c] 'b (to word! "x") == [a x c] >> foo [a b c] 'b 1 + 2 == [a 3 c] >> foo: func [x y :z][replace x y z] == func [x y :z][replace x y z] >> foo [a b c] 'b (to word! "x") == [a to word! "x" c] >> foo [a b c] 'b 1 + 2 *** Script Error: + operator is missing an argument *** Where: catch *** Stack:
function! value:>> type? second probe replace [a b c] 'b reduce [does ['x]] [a func []['x] c] == function!
>> replace [a b c] 'a 'x *** Script Error: a has no value *** Where: find *** Stack: replace
/case refinement fixed recently.read http.., latest nightly runs fine on Manjaro.clock-demo: {
base rate 1 now
}
view [
title "test"
source: area 410x300 clock-demo
panel 200x300 react [
attempt/safer [face/pane: layout/tight/only load source/text]
]
]base rate 1 now part will allow it to come up, and then it can be un-commented and won't crash any longer (the whole demo will work by that point as well). So it appears to be related to the initial load.all accept unset! as truthy value? My guess is that it shouldn't, but:>> all [get/any first [sfsafsa] "no"] == "no"
all [print 1 "no"] Red [] ? system/script/args ? system/options/args ? system/options/path
D:\torrents\musick\2014.07.16 - Kalafina THE BEST ''Red''>d:\gear\red2 ticket26.red "Kalafina - THE BEST ''Red''.mkv"
'' inbetween are actually two apostrophesSYSTEM/SCRIPT/ARGS is a string! value: {"Kalafina - THE BEST {}Red{}.mkv"}
SYSTEM/OPTIONS/ARGS is a block! value. length: 1 ["Kalafina - THE BEST {}Red{}.mkv"]
SYSTEM/OPTIONS/PATH is a file! value: %/D/torrents/musick/2014.07.16%20-%20Kalafina%20THE%20BEST%20''Red''/'' becomes {}. W7 x64 latest. Anyone can confirm on other platforms?SYSTEM/SCRIPT/ARGS is a string! value: {"Kalafina - THE BEST {}Red{}.mkv"}
SYSTEM/OPTIONS/ARGS is a block! value. length: 1 ["Kalafina - THE BEST {}Red{}.mkv"]
SYSTEM/OPTIONS/PATH is a file! value: %/C/Users/endo/Documents/2014.07.16%20-%20Kalafina%20THE%20BEST%20'Red'/>> b: [1 2 3] == [1 2 3] >> b/(#"^B") == none >> pick b (#"^B") == 2
none result makes sense, but the fact that pick allows characters instead of integers as index is an unexpected extension.select for that case. R2 and R3 returns error or none?>> to get-word! "-3" *** Syntax Error: invalid character in: "-3" *** Where: to *** Stack:
:-3 alone?[1:1:-1] gets and unset?>> to get-word! "peter@yahoo.com" *** Syntax Error: invalid character in: "peter@yahoo.com" *** Where: to *** Stack:
>> to get-word! {#"a"}
*** Syntax Error: invalid character in: {#"a"}
*** Where: to
*** Stack:>> to get-word! "1:1:1" *** Syntax Error: invalid character in: "1:1:1" *** Where: to *** Stack:
>> to get-word! "1" *** Syntax Error: invalid character in: "1" *** Where: to *** Stack:
number! logic! pair! . Red's pick argument is of a wider typeset, which supposedly has good reasons. But this particular case could still be caught. Shall I make an issue?b: [1 2 3] s: "123" pick b #"^B" ; == 2 pick s #"^B" ; == #"2" pick s 1.9 ; == none
char!](https://github.com/red/red/blob/master/runtime/datatypes/structures.reds#L203) value has internaly same structure like [integer!](https://github.com/red/red/blob/master/runtime/datatypes/structures.reds#L155) so no need for conversion.char! index is useful enough.char! doesn't look useful to me, just confusing.>> ? pick
USAGE:
PICK series index
;...
ARGUMENTS:
series [series! bitset! pair! tuple! date! time!]
index [scalar! any-string! any-word! block! logic! time!]
>> ? scalar!
SCALAR! is a typeset! value: make typeset! [char! integer! float! pair! percent! tuple! time! date!]
>> ? any-string!
ANY-STRING! is a typeset! value: make typeset! [string! file! url! tag! email!]
>> ? any-word!
ANY-WORD! is a typeset! value: make typeset! [word! set-word! lit-word! get-word!]make path! [6 11 18], then no. Yes they can't be loaded, but they are not forgotten also.>> i: make image! [1x1 0.0.0.0]
== make image! [1x1 #{000000}]
>> i/(1x1)
== 0.0.0.0
>> i/(1x1): 1
== 1
>> i/(1x1)
== 9.0.0.0
>> i/(1x1): 10000
== 10000
>> i/(1x1)
== 9.0.0.0>> i: make image! [1x1 0.0.0.0]
== make image! [1x1 #{000000}]
>> poke i 1x1 1
== 1
>> i
== make image! [1x1 #{0B0000}]to integer! on a unicode char returns incorrect result?>> to binary! #"Ü"
== #{C39C}
>> to integer! #"Ü"
== 220
>> to integer! to binary! #"Ü"
== 50076to binary! ... encodes into utf8, while to integer! ... into utf32>> a: b: #"♥"
>> rejoin [to-binary a to-binary b]
== #{E299A5E299A5}
>> to-binary rejoin [a b]
== #{E299A5E299A5}to-binary to-integer to get the other result.loop 5 [ prin {-} ] print []Red 0.6.3 for Windows built 22-Oct-2018/18:39:48+01:00 commit #d3c8c4fRed for Windows version 0.6.3 built 26-Mar-2018/1:14:22+02:00{-} string and then adds it to itself?Red []
loop 10 [ prin s: {-} ] print []
? s--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S is a string! value: {--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------}
>>command: {"C:\Windows\System32\curl.exe" -Ls -o /dev/null -w %{url_effective} https://aka.ms/win32-x64-user-stable}
url>: copy ""
err: copy ""
call/shell/output/error command url> errcall always returns an integer value.*** Script Error: empty? does not allow string! for its block argument *** Where: rejoin
system/state/trace: 22 it's way too easy to get stuck with un-runnable errorsrejoin does not allow string! for its block argument. empty? 1) allows string!, 2) has no block argument.system/view/platform/redraw ?/draw: /draw ? This has always worked for me.view.draw. I may be totally wrong though. May be intial show would also help?poke on individual elements. So it could be a bug in the reactivity mechanism...alert "msg" does not close on clicking "ok"?[quit] on the button!unview, rather than quit, but that's an easy fix for someone. Make a ticket if you want.rejoin to see what it's getting when that error happens? Odd indeed.reform there if we want to support blocks, as not all blocks will work directly.empty?. empty? that is causing this error, it's rejoin. There was error in my code, I was passing string! to rejoin, that error got caught, but the function is reported incorrectly as empty?.Red lexer is too eager to reckognize Red program. try.txt:Hello Red probe "try" Red [] probe "Hoi!"
>> do %try.txt "try" "Hoi!" == "Hoi!"
try1.txt"Hello Red probe try" Red [] probe "Hoi!"
>> do %try1.txt
*** Syntax Error: invalid value at {"Red [] probe "Hoi!"}%try2.txt"Hello Reb probe try" Red [] probe "Hoi!"
>> do %try2.txt "Hoi!"
Command+First Letter On Button worksnative!s support nested definitions of function! (any-function!s ?) in typesets, e.g. parse specifies callbacks signature:>> probe spec-of :parse
[
"Process a series using dialected grammar rules"
input [binary! any-block! any-string!]
rules [block!]
/case "Uses case-sensitive comparison"
/part "Limit to a length or position"
length [number! series!]
/trace
callback [function! [
event [word!]
match? [logic!]
rule [block!]
input [series!]
stack [block!]
return: [logic!]
]]
return: [logic! block!]
]>> foo: func [a [function! [a [word!]]]][] *** Script Error: invalid type specifier: [a [word!]] *** Where: func *** Stack: foo
help in latest Red, it always returnsFunc spec couldn't be parsed, may be malformed.
help function? @greggirwin 's latest commits, making some global words local, may cause this regression, need to check them.; help-string tests pass with quick-test, but full automated tests fail ; when trying to include %help.red. May require -r or -u compilation. ; #include with a relative path for it fails, but `help-string` also ; doesn't exist if an absolute path is used for the #include.
help before committing. My fault.help, the inner stack value used by parse-func-spec is fine if we don't capture parse-func-spec in help-ctx. If we do, though, stack (from the inner func-spec-ctx) is then bound to help-ctx it seems, but there's no stack word there. It evals to 12, which is one of the config options. Here's a small test you can run, though the capture version just doesn't show anything when compiled, so I'm not sure what's going on.Red []
print "Capture test"
outer: object [
o-slot-1: 1
o-slot-2: 2
o-slot-3: 3
o-slot-4: 4
o-slot-5: 5
o-slot-6: 6
exported-func: none
inner: object [
stack: copy []
set 'exported-func func [][
print "In Func"
; Calling this func now makes 'stack appear bound to
; the outer context, and accessing it returns a value
; from that context, but not in this little test. :^(
print mold stack
print mold context? 'stack
true
]
]
]
outer2: object [
inner: object [
stack: copy []
set 'exported-func func [][
print "In globally exported Func"
print mold stack
print mold context? 'stack
true
]
]
]
outer/exported-func
exported-funcRed []
print "Capture test"
outer: object [
o-slot-1: 1
o-slot-2: 2
o-slot-3: 3
o-slot-4: 4
o-slot-5: 5
o-slot-6: 6
exported-func: does [
print "Original"
]
inner: object [
stack: copy []
set 'exported-func func [][
print "In Func"
; Calling this func now makes 'stack appear bound to
; the outer context, and accessing it returns a value
; from that context, but not in this little test. :^(
print mold stack
print mold context? 'stack
true
]
]
]
outer2: object [
inner: object [
stack: copy []
set 'exported-func func [][
print "In globally exported Func"
print mold stack
print mold context? 'stack
true
]
]
]
outer/exported-func
exported-func
probe get 'outer/exported-func
outer/exported-funcCapture test
Original
In globally exported Func
[]
make object! [
stack: []
]
func [][
print "In Func"
print mold stack
print mold context? 'stack
true
]
Originalouter/exported-func doesn't change by set 'exported-func but it looks like it changed when I probe it.reflect ... 'spec displays return: in the returned spec, which is invalid when defining a function, because the colon is not allowed. It is somewhat helpful that it's differentiated from the other arguments, but on the other hand, it's nice to have source produce code which is valid without any modifications.return: and doc strings, but seems unrelated to what you're saying. I just used source on a func with a return:, and doing it worked fine.spec: reflect :on-parse-event 'spec body: reflect :on-parse-event 'body func spec body
>> func [x return: [integer!]][x + 1] == func [x return: [integer!]][x + 1] >> func [x return: [integer!] "this is problem"][x + 1] *** Script Error: invalid function definition: return: *** Where: func *** Stack:
parse-func-spec that will turn the object into spec dialect?help vid and help div return the same info: divide action! Returns the quotient of two values.system/words, and there is no such word as VID defined.parse-func-spec instead of my own function and save some bytes.Parse-func-spec lives in the help code right now, as that's where it was needed, but it could move to more general meta programming or reflection libs if we add those.layout [t: h1] t/text: "aaa bbb ccc. ddd, eee" back back back back tail words-of system/words == [aaa bbb ccc. ddd]
load in this case.text face we fill the system/words.data is not set for the face, because the entire text can't be loaded. But if it could, data would then refer to the block of words.>> t/text: "aaa bbb ccc ddd eee" == "aaa bbb ccc ddd eee" >> t/data/1 == aaa
%:json/encode %path
; {"%path"}% from a path! valueencode-into molds every non-JSON value. This way you can encode Red values to make sure that json/decode json/encode whatever would always work. Maybe it's one of those little things that should be user-configurable.json/save and json/load? I get the benefit of molding, but not sure is a good default at least in above case, % has meaning only inside Red, in a JSON value that could be consumed by any other tool, that would have no meaning. Is it more logic to need to form %file to pass a file path to a javascript code thru JSON?mold to form on one line. Or preferably adding one either so user can switch between both modes. There are some other switches in JSON module already (for none value and for automatic loading of numbers/unix time stamps , IIRC), so it's one minute change. I just need some good name for that switch. mold? or form? seems to vague to me and preserve-red-values? is too long OTOH :) to file! JSON-string-field and for JSON coming from Red I would have to load JSON-string-field.load/as and save/as, I hope in 0.6.5. It's close but depends on the map! behavior for none to change. Much chat has been made over that. In any case, we have to balance interop with round-tripping, and not automatically do things that are hard to undo. Writing a simple preprocessor, to form any-string! values shouldn't be hard.select/part discussion](https://gitter.im/red/bugs?at=5bd0d5cb82893a2f3b345e80) I believe, that find/part is also wrong. Example:>> find/part s: "abcd" "ab" e: next s == "abcd" ;<-- wrong >> index? e == 2 ;<-- Red is looking for "ab" in 2 bytes, but should be looking only in 1
>> find/part s: "abcd" "ab" next s == none
>> find/part s: "abcd" "ab" next s == "abcd" ;<-- wrong >> find/part "abcd" "bc" 2 == "bcd" ;<-- wrong, because there is no "bc" in "ab"
>> find/part s: "abcd" "ab" next s == none >> about Red 0.6.4 for Windows built 24-Nov-2018/3:38:06+02:00 commit #3b0a577
probe read %// it shows me the contents of the C: drive. Should it?\, and that is how explorer or the run dialog would behave. I guess it chops off the first slash, because usually you have a drive letter after that. Looks like it won't work with more than two slashes though. I think it seems like it's up to the OS behavior in this case.>> to-local-file %// == "\"
print clean-path %/ probe read clean-path %/
// a net share? seems like it should be bad path>> print clean-path %/// /C/Users/
null, nothing about latest map! changes, so all my comments about JSON are just comments from a person that relies on public information only. q or quit. Is this supposed to be this way?quit is just a simple function which you may redefine for your needs:>> source quit
quit: func ["Stops evaluation and exits the program"
/return status [integer!] "Return an exit status"
][
quit-return any [status 0]
]>> i: make image! 1x1
== make image! [1x1 #{FFFFFF}]
>> i/rgb
== #{FFFFFF}
>> i/alpha
== #{00}
>> i/argb
== #{FFFFFFFF}view [
b: box 255.0.0.0
slider 20x80 [
b/color/4: to-integer 255 * face/data
t/offset/y: to-integer 73 - (60.0 / 255 * b/color/4)
t/text: to-string b/color/4]
at 120x73 t: text "0" 30x25
]text
view [
panel
with [menu: ["a"]] ; note the missing menu element ID
on-menu [probe event/picked]
]a from contextual menu, I get*** Runtime Error 1: access violation *** at: 0042F984h
a entry?about-msg for me (W7)view/options [
on-menu [probe event/picked]
][
menu: ["a"]
]select-all for both.about-msg from GUI console, but CLI crashes. Both are unexpected.word!, check the snippet, and then remove it, it will still print the old ID despite it being removed.about-msg on W10. (And word! is still printed after removing)even/picked carries some arbitrarily selected value from memory. In my case, on the first try it printed b. No idea where it came from.Red 0.6.4 for Windows built 24-Nov-2018/4:38:06+03:00 commit #3b0a577>> offset-to-caret system/view/screens/1 1x1 *** Runtime Error 1: access violation *** at: 004BF041h >> caret-to-offset system/view/screens/1 1 *** Runtime Error 1: access violation *** at: 004BF041h >> offset-to-char system/view/screens/1 1x1 *** Runtime Error 1: access violation *** at: 004BF041h
none so that should narrow it down. view [ar: area "Something" below
button "caret-to-offset" [probe caret-to-offset ar 3]
button "offset-to-caret" [probe offset-to-caret ar 40x10]
button "offset-to-char" [probe offset-to-char ar 40x10]
button "selected" [ar/selected: as-pair offset-to-caret ar 40x10 offset-to-char ar 40x10 set-focus ar]]none?ask function is automatically _trimed_:>> ask "name: " name: foo == "foo"
>> ask "name: " name: foo == " foo "
Red[] s: "" loop 2147483647 [ append s #"a" ]
Compiling to native code... ...compilation time : 1241 ms ...linking time : 51 ms ...output file size : 77824 bytes ...output file :./test ./test *** Internal Error: not enough memory *** Where: append *** Stack:
read of an 1GB file crashed it.checksum die with 'adler32 if the input *ends in* any of ^A ^B ^C ^D ^E ^G. Just spot checks, so there may be others. Can someone confirm and write up a ticket?>> checksum "^A" 'adler32 == 131074 >> checksum "qwerty^A" 'adler32 == 541197258 >> checksum "qwerty^B" 'adler32 == 847643866
checksum "X^A" 'adler32 crashing also -- W10.Rebol3's forall function resets series position on break and throw but not on error:>> data: [1 2 3 4] forall data [if data/1 = 3 [break]] data == [1 2 3 4] >> data: [1 2 3 4] catch [forall data [if data/1 = 3 [throw true]]] data == [1 2 3 4] >> data: [1 2 3 4] try [forall data [if data/1 = 3 [do make error! "?"]]] data == [3 4]
Rebol2 and Red are consistent:>> data: [1 2 3 4] forall data [if data/1 = 3 [break]] data == [3 4] >> data: [1 2 3 4] catch [forall data [if data/1 = 3 [throw 1]]] data == [3 4] >> data: [1 2 3 4] try [forall data [if data/1 = 3 [do make error! "?"]]] data == [3 4]
Rebol3:>> data: [1 2 3 4] forall data [if data/1 = 3 [break/return data]] == [3 4]
Rebol3 was not intended. >> data: [1 2 3 4] forall data [] data == [1 2 3 4]
>> chars: "abcdef" == "abcdef" >> forall chars [print first chars] a b c d e f >> probe chars "abcdef" == "abcdef"
red\tests\source\units\button.gif from the Red sourcesRed []
;recycle/off
probe rb4-bb: copy [1 2 3 4 5 6 7 8 9 10]
loop 12 [append rb4-bb rb4-bb]
probe length? rb4-b: copy rb4-bb
probe o: make object! [a: 1 b: 7 c: 13]
probe try [o/("c")][1 2 3 4 5 6 7 8 9 10]
40960
make object! [
a: 1
b: 7
c: 13
]
*** Runtime Error 1: access violation
*** at: B7EE3C1Ch[1 2 3 4 5 6 7 8 9 10]
40960
make object! [
a: 1
b: 7
c: 13
]
make error! [
code: 328
type: 'script
id: 'invalid-path
arg1: o/("c")
arg2: "c"
arg3: none
near: none
where: 'body
stack: -161881984
]recycle/off be commented out though?Red [] ;recycle/off repeat i 10 [ append/dup b: copy [1 2 3] 1 i * 10000 print mold/flat stats/info length? copy b print mold/flat stats/info recycle print mold/flat stats/info o: make object! [] probe type? try [o/()] print "^/" ]
run-all-comp* tests.Red [Needs 'View]
sidePanel: [
nodeTypes: Text-list 100x250 data [
"Generate"
]
on-change [
t: to string! nodeTypes/data/(nodeTypes/selected)
switch t [
"Generate" [ p/pane: layout generate]
]
]
return
p: Panel 300x600 155.155.155 [
]
]
generate: [
box 75x75 red
]
view sidePanelscoop update red-latest -fRed [Needs: View] view [button [face/pane: 'boom]]
layoutcommand and
panenot handling it well.
Red [Needs 'View]
sidePanel: [
p: Panel []
Text-list data [
"Generate"
]
on-change [
p/pane: layout generate
]
]
]
generate: []
view sidePanelsidePanel: [
nodeTypes: Text-list data [
"Generate"
]
on-change [
t: to string! nodeTypes/data/(nodeTypes/selected)
switch t [
"Generate" [ p/pane: layout generate]
]
]
return
p: Panel [
]
]
generate: [
box 75x75 red
]
view sidePanelsidePanel: [
nodeTypes: Text-list data ["a"] on-change [
t: to string! nodeTypes/data/(nodeTypes/selected)
switch t [
"a" [ p/pane: layout [box 75x75 red]]
]
]
p: Panel []
]
view sidePanelto string! none conversion error is not the culprit and removed it entirely together with switch.sidePanel: [
nodeTypes: Text-list data ["a"] on-change [
p/pane: layout [box 75x75 red]
]
]
p: Panel []
]
view sidePaneltext-list functionally was identical to a button, so I changed it to a button:sidePanel: [
button [p/pane: layout [box 75x75 red]]
p: Panel []
]
view sidePanellayout can eat an empty block:sidePanel: [
button [p/pane: layout []]
p: Panel []
]
view sidePanelpanel face is not related to the issue - that is, it can be any face, even button itself:sidePanel: [
button [face/pane: layout []]
]
view sidePanelview [button [face/pane: layout []]]
layout was the only moving piece under observation, so I tried to substitute it for an arbitrary value:view [button [face/pane: 'boom]]
series! values, e.g. paren! or even vector!.date syntax, I noticed, that there is in Rebol:>> 1/1/9999/23:59:59- == 1-Jan-9999/23:59:59 >> 1/1/9999/23:59:59-2 == 1-Jan-9999/23:59:59 >> 1/1/9999/23:59:59-20 == 1-Jan-9999/23:59:59 >> 1/1/9999/23:59:59-200 == 1-Jan-9999/23:59:59-2:00 >> 1/1/9999/23:59:59-2000 ** Syntax Error: Invalid date -- 1/1/9999/23:59:59-2000 ** Near: (line 1) 1/1/9999/23:59:59-2000
Red it is:>> 1/1/9999/23:59:59- *** Syntax Error: invalid time! at "" *** Where: do *** Stack: load >> 1/1/9999/23:59:59-2 == 1-Jan-9999/23:59:59-02:00 >> 1/1/9999/23:59:59-200 *** Syntax Error: invalid time! at "200" *** Where: do *** Stack: load >> 1/1/9999/23:59:59-20 == 1-Jan-9999/23:59:59-04:00 >> 1/1/9999/23:59:59-2000 == 1-Jan-9999/23:59:59-04:00
24 // 20 == 4. I'm not sure I like it.R3:>> 1-1-2000/2:0+60 == 1-Jan-2000/2:00+1:00
Red give very unexpected result in this case:>> 1-1-2000/2:0+60 == 1-Jan-2000/2:00:00-12:00
HHMM+200, it is like using +0200, which should be +02:00. So I now think, that Red is somehow strange. Any other opinion? @dockimbel is above _by design_?00:60 as a valid time zone. But it does not recognize many current valid formats which are loadable from Red.00:60 as valid timezone, but some mad dictator may. Timezones are not mathematical or time-keeping stuff, but strictly political one. So they should be open to all possibilities.-2000 example means hhmm, which equates to the same as -20, which is just hh.>> 1-1-2000/2:0+60 == 1-Jan-2000/2:00+1:00
hour. If that suddenly becomes minutes because of normalizing, that seems worse to me.hh as a zone value.>> d: now == 17-Dec-2018/20:51:52+01:00 >> d/hour: 28 == 28 >> d == 18-Dec-2018/4:51:52+01:00 >> d/month: 257 == 257 >> d == 18-May-2039/4:51:52+01:00
zone is doing the same as other fields.month to 257. There's no 257th month in a year, is there?date! is prepared for some other crazy island that decides they should be first to celebrate New Year.to-tag to string! round trip?>> <a href="^"> == <a href=""> >> <a href="^^> == <a href="^>
** Syntax Error: Missing " at <a href="^^>
** Near: halt>> append <a> { href="}
== <a href="> > >> 1-1-2000/0:0:0+47 = 1-1-2000/0:0:0+15 > == true >
lisp
> >> to string! <a href="^">
> == {a href=""}
>>> {"^"}
== {""}
>> <"^">
** Syntax Error: Missing " at <"^">>> {"^"}
== {""}
>> <"^">
== <"^">
>> <a"^">
== <a"^">>> {"^"}
== {""}
>> <"^">
*** Syntax Error: invalid value at {"^^">}
*** Where: do
*** Stack: load
>> <a"^">
== <a"">< in order for the literal form to qualify as a tag!.>> <a href="^> == <a href=">
> >> <a href="^> > == <a href="> >
>> a: now == 18-Dec-2018/19:34:39+08:00 >> a/zone: a/zone + 0:12 == 8:12:00 >> a == 18-Dec-2018/19:34:39+08:00 >> a/zone: a/zone + 0:17 == 8:17:00 >> a == 18-Dec-2018/19:34:39+08:15
>> 1-1-2000/2:0+60 == 1-Jan-2000/2:00:00-12:00
> >> 1-1-2000/2:0+60 > == 1-Jan-2000/2:00:00-12:00 >
\" as " and \\ as \ (not pathname-friendly, but standard in MSVC)rebol --do), we can simply use {..} on Windows instead of "..". You will be okay if we choose that behavior?> test-args.exe { 1 2 } ;-- compiled Red script
system/script/args = "{ 1 2 }"
system/options/args = [" 1 2 "]{} was used internally as an escape mechanism for passing arguments to the console executable, to workaround some annoyances on Windows.c:", "c:\" "d:\" becomes c:" d:\ etc) and IIRC on Unix arguments come to us already being split. So it will be simpler and more efficient to do it by hand.>> write %xxx CRLF read %xxx == "^/^/"
>> to-string probe to-binary probe to-string crlf
"^M^/"
#{0D0A}
== "^M^/">> write %xxx CRLF read %xxx == "^/^/" >> write/binary %xxx CRLF read %xxx == "^/"
lisp
>> write %xxx CRLF read/binary %xxx
== #{0D0D0A}Red/System [] foo!: alias function! [n [integer!] return: [integer!]] inc: func [n [integer!] return: [integer!]] [n + 1] call: func [f [foo!] return: [integer!]][ f 2 ] print call :inc
*** Compilation Error: undefined symbol: f *** in file: %/D/devel/red/red-src/red/2.reds *** in function: call *** at line: 4 *** near: [f 2]
Red/System [] s!: alias struct! [a [integer!] b [integer!] c [integer!]] f: func [/local x [s! value]] [ print-wide [x/a x/b x/c] ] f
0 1638252 1
lisp Red/System [] f: func [/local x [integer!]] [print x] f
*** Compilation Error: local variable x used before being initialized! *** in file: %/c/dev/Red/system/tests/test2.reds *** in function: f *** at line: 2 *** near: [x]
memcpy() would still escape the compiler's detection.*** Syntax Error: invalid binary! at "64#{2A}"
*** Where: do
*** Stack: load>> 64#{2A+}
*** Syntax Error: invalid binary! at "64#{2A+}"
*** Where: do
*** Stack: load>> 64#{2A+/}
== #{D80FBF}
>> 64#{2A+/+}
== #{D80FBF}
>> 64#{2A+/+/}
== #{D80FBF}
>> 64#{2A+/+//}
== #{D80FBF}
>> 64#{2A+/+///}
== #{D80FBFFBFFFF}2A+/+ is reported as invalid. >> 64#{2A+/+///}
== #{D80FBFFBFFFF}
>> 64#{2A+/+//}
** Syntax Error: Invalid binary -- 64#{2A+/+//}
>> 64#{2A+/+/}
** Syntax Error: Invalid binary -- 64#{2A+/+/}
>> 64#{2A+/+}
** Syntax Error: Invalid binary -- 64#{2A+/+}
>> 64#{2A+/}
== #{D80FBF}
>> 64#{2A+}
** Syntax Error: Invalid binary -- 64#{2A+}
>> 64#{2A}
** Syntax Error: Invalid binary -- 64#{2A}>> f: func [x []][x] == func [x []][x] >> f 1 *** Script Error: f does not allow integer! for its x argument *** Where: f *** Stack: f >> f "asd" *** Script Error: f does not allow string! for its x argument *** Where: f *** Stack: f
*** Red Compiler Internal Error: Script Error : copy expected value argument of type: series port bitset *** Where: rejoin *** Near: [mold copy/part pos 40]
>> text: to binary! crlf
== #{0D0A}
>> parse text [crlf]
== false
>> parse text [to crlf]
*** Script Error: PARSE - invalid rule or usage of rule: "^M^/"
*** Where: parse
*** Stack:parse text compose [(to binary! crlf)] ; ==true because text is not a string but a binary value, hence your rule should be as well.>> parse #{65} [#"e"]
== true
>> parse #{65} ["e"]
>> parse #{65} compose [(to binary! "e")]
== truecrlf is a string, not a char or binary.crlf = #{0D0A} while the second one is similar to find #{0D0A} crlf.any-string!:>> parse "hello" ['abc] ** Script error: PARSE - invalid rule or usage of rule: 'abc ** Where: parse ** Near: parse "hello" ['abc]
#utf8 and write a short macro that will preprocess those nested strings.>> parse to-binary "Škoda" ["Škoda"] == false >> parse to-binary "Skoda" ["Skoda"] == true
parse.>> parse to-binary "<a>Škoda</a>" [thru "<a>" copy x to #"<" to end] to-string probe x
#{C5A06B6F6461}
== "Škoda"find #{0D0A} crlf as Red does.>> find #{0D0A} crlf
** Script error: values must be of the same type
** Where: find
** Near: find #{0D0A} crlfread is binary and so one can for example parse page's title without need to convert all the content into string and still use human-friendly tag names.read/binary in Red for getting the raw binary instead of the human-friendly default string. Yeah, for HTML tags parsing it could be useful too.>> parse to-binary "<a>Škoda</a>" [thru <a> copy x to </a> to end] == true
>> parse "<a>Škoda</a>" [thru <a> copy x to </a> to end] == true
find. Though, it's still a borderline semantic rule which will need to be properly documented.>> to string! 64#{YW55IGNhcm5hbCBwbGVhcw}
== "any carnal plea"
>> to string! 64#{YW55IGNhcm5hbCBwbGVhc3U}
== "any carnal plea"
>> to string! 64#{YW55IGNhcm5hbCBwbGVhc3Vy}
== "any carnal pleasur">> to string! 64#{YW55IGNhcm5hbCBwbGVhcw==}
== "any carnal pleas"
>> to string! 64#{YW55IGNhcm5hbCBwbGVhc3U=}
== "any carnal pleasu">> b: enbase/base "any carnal pleasure" 64 == "YW55IGNhcm5hbCBwbGVhc3VyZQ==" >> to-string debase/base b 64 == "any carnal pleasure"
>> enbase/base "any carnal pleas" 64 == "YW55IGNhcm5hbCBwbGVhcw==" >> enbase/base "any carnal pleasu" 64 == "YW55IGNhcm5hbCBwbGVhc3U=" >> enbase/base "any carnal pleasur" 64 == "YW55IGNhcm5hbCBwbGVhc3Vy"
--== Red 0.6.4 ==--
Type HELP for starting information.
>> parse to-binary "<a>Škoda</a>" [thru "<a>" copy x to #"<" to end] to-string probe x
#{C5A06B6F6461}
== "Škoda"declare zero-fill the struct?Red/System [] s!: alias struct! [x [integer!]] f: func [/local x [s!]] [ x: declare s! print x/x x/x: x/x + 1 ] f f f
012declared is a static zero-filled allocation. So you have to be cautious if you are using it from a local variable.= 0 2 members, but if there's more it becomes annoying. And memset seems like an overkill for the task. No?/local x [s! value] stores that struct data in the code segment before the function, right? Where /local x [s!] (accessed by reference) stores the data?declare? isn't /local x [s!] a declaration in it's own right?test1, test2, when I type %te and press tab key CLI and GUI console auto-completes to %test.TEST3, then when I press tab auto complete makes %te to % >> view [backdrop white origin 0x0] >> view [origin 0x0 backdrop white] *** Script Error: VID - invalid syntax at: [backdrop white] *** Where: do *** Stack: view layout layout cause-error
size and title too) and actors. But you can set up layout block without these and include these with view/options.write %abc.txt system/words crash console, should be a bugsystem/words to test.>> o: make system/words [] *** Script Error: cannot set on-change* field to unset! datatype >> o: make system/words [on-change*: none] *** Script Error: cannot set on-change* field to none! datatype
>> write %nul system/words root size: 3451, root max: 4878, cycles: 0 root size: 3451, root max: 4878, cycles: 1 *** Runtime Error 101: no value matched in SWITCH *** in file: /d/devel/red/red-src/red/runtime/datatypes/string.reds *** at line: 377 *** *** stack: red/string/get-char 00000065h 4393006 *** stack: red/string/get-char 02C2A50Ch 16 *** stack: red/file/to-local-path 02980404h 02980434h false *** stack: red/file/to-OS-path 02980404h *** stack: red/simple-io/write 02980404h 02980414h 029803F4h 029803F4h false false false *** stack: red/file/write 02980404h 02980414h false false false false 029803F4h 029803F4h 029803F4h 029803F4h *** stack: red/actions/write 02980404h 02980414h false false false false 029803F4h 029803F4h 029803F4h 029803F4h *** stack: red/actions/write* -1 -1 -1 -1 -1 -1 -1 -1 *** stack: red/interpreter/eval-arguments 02B80244h 02E23EB8h 02E23EB8h 00000000h 00000000h *** stack: red/interpreter/eval-code 02B80244h 02E23E98h 02E23EB8h false 00000000h 00000000h 02B80244h *** stack: red/interpreter/eval-expression 02E23E98h 02E23EB8h false false false *** stack: red/interpreter/eval 029803D4h true *** stack: red/natives/catch* true 1 *** stack: ctx473~try-do 003A1E00h *** stack: ctx473~do-command 003A1E00h *** stack: ctx473~eval-command 003A1E00h *** stack: ctx473~run 003A1E00h *** stack: ctx473~launch 003A1E00h
>> i: make image! 2x2 >> i/1x1 *** Syntax Error: invalid integer! at "i/1x1" *** Where: do *** Stack: load >> i/(1x1) == 255.255.255.0
view [rich-text data [i "u" /i] ; error view [rich-text data [s "i" /s] ; error view [rich-text data [b "s" /b] ; error view [rich-text data [u "u" /u] ; OK
view [rich-text data [ "begin " u "s" /u " end" ]] ; error
red-26dec18-7369fa2e.exe on WIndows 10 Home[ in your examples. You're right though, quite a bug there. Can you raise an issue on the issue tracker?preview button to the new issue template?ahead [word! | tag! | tuple! | path!] and it worked. (Could be made into typeset! style!: make typeset [word! tag! tuple! path!]) Additionally I allowed char! along with string! on [line 52](https://github.com/red/red/blob/master/modules/view/RTD.red#L52), which seems to cause no harm, but allows also spec like [#"u" b #"s" /b i [#"b"]].red ["aaa"] blue ["bbb"] green ["ccc"], otherwise they have scope to the end of input text. If they "stand alone" as in [red "aaa" blue "bbb" green "ccc"], it is ok, because they are stored in data block in this order. But if they are united with some other style, they may get transferred to some earlier position and can be "overwritten" by later colors. But closing syntax doesn't work due to bug(s) in pop-color func on [line 60](https://github.com/red/red/blob/master/modules/view/RTD.red#L60). Here is correction:pop-color: has [entry pos][ ;close-colors ;entry: back back tail color-stk entry: skip tail color-stk -3 append append out as-pair entry/1 tail-idx? - entry/1 entry/3 clear skip tail color-stk -3 ]
pop-all func](https://github.com/red/red/blob/master/modules/view/RTD.red#L101):pop-all: function [mark [block!]][ first?: yes while [mark <> tail stack][ pop last stack either first? [first?: no][remove skip tail out -2] ] if v [pop-color] ; <- this was lacking ]
append append out ...:reduce/into [as-pair entry/1 tail-idx? - entry/1 entry/3] tail out
>> parse ["i"][<i>] == true
text >> parse ["i"][<i>] == true >> parse [user@domain]["user@domain"] == true >> parse [%file]["file"] == true >> parse [http://site.com]["http://site.com"] == true
any-string! values can be parsed with any other any-string! value.equal? vs. strict-equal? comparison. Culprit might be [here](https://github.com/red/red/blob/master/runtime/parse.reds#L345).comp-op.parse/case on [line 137](https://github.com/red/red/blob/master/modules/view/RTD.red#L137) would have fixed the first case also.case or additional check on type? /strict extra refinement, which is currently merged in /case for implementation reasons. We probably need to revisit those choices, if they cause more issues than help.find?:>> index? find/tail [a b c d e f] [c d e] == 4 >> index? find/tail "abcdef" "cde" == 6
>> index? find/tail [a b c d e f] [c d e] == 6
Red 0.6.4 for Windows built 25-Dec-2018/12:56:39+01:00 commit #67a6bffon Win7 and freshly compiled libRED.dll and then mandelbrot.red does not draw./help room instead, unless you are really confident (and if you are, then try to narrow it down a bit further) that there's a bug somewhere in your snippet. any-string! matching, so there is a pending design decision to be made in that regard.s and u in style path with color, e.g. u/red ["xxx"]or s/b/green/i ["xxx"]. In these cases, i.e. when s or u start the path, the color is not rendered, although it is included in data, e.g. 1x3 underline 255.0.0 and 1x3 italic bold strike 0.255.0 for cases above. These are exactly the cases where strike or underlineappear immediately before the color tuple in data. The problem can be overcome with e.g. u red ["xxx"] /u or changing the order of styles in longer path, e.g. i/s/b/green ["xxx"]. In both cases the order of styles in data will be different -- in first case color appears before strike or underline, in second case italic or bold appear immediately before color tuple. I can't say where is the source of the problem though.underline or strike to be positioned immediately before color-tuple, let's transfer color-setting before other styles in [pop-all](https://github.com/red/red/blob/master/modules/view/RTD.red#L101). pop-all: function [mark [block!]][ first?: yes if col [pop-color] ; <-- TO HERE while [mark <> tail stack][ pop last stack either first? [first?: no][remove skip tail out -2] ] ;if v [pop-color] FROM HERE --^ ]
v is changed to col above. That's because v is set to none on each style in path (line 46 below) and so color was not added if it appeared in earlier places in path. To fix it I introduced new marker col, which is set to none just once while entering path ([line 45](https://github.com/red/red/blob/master/modules/view/RTD.red#L45)), and to yes if color is seen in the styles path ([line 48](https://github.com/red/red/blob/master/modules/view/RTD.red#L48)).| ahead path! into [ (col: none mark: tail stack) some [ ; <-- LINE 45 (v: none) ; <-- LINE 46 s: ['b | 'i | 'u | 's | word! if (tuple? attempt [v: get s/1])] (either v [col: yes push-color v][push s/1]) ; <-- LINE 48 ] ] nested (pop-all mark)
optimize func which is meant to join styles with same indexes, actually worked on first one only and ignored further cases because of miscalculated jump on [line 117](https://github.com/red/red/blob/master/modules/view/RTD.red#L117). My proposal is to replace next there with skip:; e: next move/part s pos offset? s back e ; CURRENT e: skip move/part s pos l: offset? s back e l ; PROPOSED
new-line was not set. I propose to insert one on [line 64](https://github.com/red/red/blob/master/modules/view/RTD.red#L64):pop-color: has [entry pos][ entry: skip tail color-stk -3 repend out [as-pair entry/1 tail-idx? - entry/1 entry/3] new-line skip tail out -2 on ; <-- HERE clear entry ]
strike or underline will appear immediately before color-tuple in data, color is not rendered, e.g. after introducing above fixes, the bug will still affect cases like this:view [rich-text data [s [red "bbb"]]] ;But not this view [rich-text data [s [red ["bbb"]]]]
strike in optimization phase, but on second case color is closed immediately, and strike is united to it.>> arctangent 0.1 == 5.710593137499643 >> arctangent 10% == -89.99999996664947 >> arctangent 10.0 == 84.28940686250037 >> arcsine 0.1 == 5.739170477266787 >> arcsine 10% *** Math Error: math or number overflow *** Where: arcsine *** Stack:
Needs: View enabled and -d flag makes it crash sooner (25kB output only, of the whole 12MB):*** Runtime Error 1: access violation *** in file: /D/devel/red/red-src/red/runtime/parse.reds *** at line: 499 *** *** stack: red/parser/loop-bitset 02D416BCh 02D5BC64h 0 -1 0018F750h 0 *** stack: red/parser/loop-token 02D416BCh 02D5BC64h 0 -1 0018F750h 0 0 *** stack: red/parser/process 02D416BCh 02A804E4h 0 0 02A804C4h *** stack: red/natives/parse* false -1 0 -1 *** stack: red/interpreter/eval-arguments 02B805C4h 02D5C81Ch 02D5C81Ch 00000000h 00000000h *** stack: red/interpreter/eval-code 02B805C4h 02D5C7FCh 02D5C81Ch false 00000000h 00000000h 02B805C4h *** stack: red/interpreter/eval-expression 02D5C7FCh 02D5C81Ch false false false *** stack: red/interpreter/eval 02A80494h false *** stack: red/natives/forall* false *** stack: red/interpreter/eval-arguments 02B80364h 02D5C4CCh 02D5C4CCh 00000000h 00000000h *** stack: red/interpreter/eval-code 02B80364h 02D5C4ACh 02D5C4CCh false 00000000h 00000000h 02B80364h *** stack: red/interpreter/eval-expression 02D5C4ACh 02D5C4CCh false false false *** stack: red/interpreter/eval 02D5C3C8h true *** stack: red/interpreter/eval-function 02A803F4h 02D5C3C8h *** stack: red/_function/call 02A803F4h 00393884h *** stack: red/interpreter/eval-code 02A803F4h 02D5C258h 02D5C258h false 00000000h 00000000h 02B86E54h *** stack: red/interpreter/eval-expression 02D5C248h 02D5C258h false false false *** stack: red/interpreter/eval 02A803C4h false *** stack: red/natives/foreach* false *** stack: red/interpreter/eval-arguments 02B80354h 02D5C114h 02D5C114h 00000000h 00000000h *** stack: red/interpreter/eval-code 02B80354h 02D5C0E4h 02D5C114h false 00000000h 00000000h 02B80354h *** stack: red/interpreter/eval-expression 02D5C0E4h 02D5C114h false false false *** stack: red/interpreter/eval 02D5BFE0h true *** stack: red/interpreter/eval-function 02A80354h 02D5BFE0h *** stack: red/_function/call 02A80354h 00393884h *** stack: red/interpreter/eval-code 02A80354h 02D408E0h 02D40910h false 00000000h 00000000h 02B86E24h *** stack: red/interpreter/eval-expression 02D408E0h 02D40910h false false false *** stack: red/interpreter/eval 02A80334h true *** stack: red/natives/catch* true 1 *** stack: ctx473~try-do 003B1DF0h *** stack: ctx473~launch 003B1DF0h
recycle/off?view [rich-text data [
"black " red "red " green ["green " blue ["blue "]] "red"
]]close-colors: has [pos][ pos: tail color-stk while [pos: find/reverse pos '_][ pos/1: tail-idx? insert out as-pair pos/-1 tail-idx? - pos/-1 insert next out pos/2 new-line skip out 2 on pos: remove/part skip pos -1 3 ] ]
optimize: function [][ ;-- combine same ranges together parse out [ any [ cur: pos: pair! (range: pos/1) [to pair! e: pos: | to end e:] any [ to range s: skip [to pair! | to end] e: ( s: remove s e: skip move/part s pos l: offset? s back e l ;!!! tom 30.12.2018 ) :e ]( pos: :cur mov: no while [pos: find/reverse pos pair!][ case [ any [ pos/1/1 > cur/1/1 all [pos/1/1 = cur/1/1 pos/1/2 > pos/1/2] ][ mov: yes pos1: :pos if head? pos1 [ move/part cur pos1 offset? cur e break ] ] any [mov head? pos] [ move/part cur pos1 offset? cur e break ] 'else [break] ] ] ) ] ] ]