Archived messages from: gitter.im/red/help from year: 2018

Phryxe
08:28Is it possible to interact with Powershell today? If not, I guess it will be possible after advanced I/O is done!?
greggirwin
08:35What do you mean by "interact" @Phryxe. There's libRed, if you could use that from PS.
are1000
08:39Maybe they mean calling PowerShell from Red?
greggirwin
08:41Well, we have call.
Phryxe
08:42Is there an example how to make a GUI for a ps1-script?
pekr
08:42Someone also did some work on interfacing to .Net .... Qtxie did something in that regards too, but it might be highly experimental too - https://github.com/qtxie/red/commits/dotnet
9214
08:43@pekr https://github.com/iceflow19/red-mono
pekr
08:43Not sure though, it would help with the PowerShell ....
Phryxe
08:44If it is complicated, never mind ...
greggirwin
08:46@Phryxe, I don't use PS, and haven't seen one. Maybe @PeterWAWood will have some ideas when he gets back here.
Phryxe
08:47OK, anyway thanks for the input.
are1000
11:27Just to be crystal clear - there is no way to open an TCP connection with Red?
rebolek
11:28@are1000 not yet. You would need to write some binding in Red/System.
are1000
11:28Could I then use those bindings in a GUI Red application?
11:29Because I am willing to learn how and write such bindings.
rebolek
11:30Yes, with a custom build of Red console, or when compiled, you can use it.
are1000
11:30custom build of Red console?
11:31I want to write a RethinkDB driver
rebolek
11:32You would need custom build of console with your binding added, it's not (yet) possible to load libraries from interpreter dynamically.
are1000
11:33Thanks!
maximvl
15:48@are1000 RethinkDB is dead isn't it?)
greggirwin
19:07@maximvl, I use a lot of dead technologies myself, so am never surprised when someone else does. :^)
are1000
19:13@maximvl https://rethinkdb.com/blog/rethinkdb-joins-linux-foundation/
19:14Latest commit 2 days ago, so I wouldn't say it's dead + it's an excellent piece of software!
gltewalt
19:23So RethinkDB inverts the updating mechanism? Constant push from DBs vs Constant Poll from app
BeardPower
23:22@gltewalt Yep.
23:23How can I compile red.exe myself?
gltewalt
23:36I do do/args %red.r "-r %environment/console/console.red" from Rebol repl
23:37That is if you are in your local repo directory from Rebol console
23:41
To see the intermediary Red/System code generated by the compiler, use:

    >> do/args %red.r "-v 2 %tests/hello.red"

You can also compile the Red console from source:

    >> do/args %red.r "-r %environment/console/console.red"

To compile the Windows GUI console from source:

    >> do/args %red.r "-r -t Windows %environment/console/gui-console.red"

Note: the -c argument is not necessary when launching the Red toolchain from sources, as the default action is to compile the input script (the toolchain in binary form default action is to run the input script through the interpreter). The -r argument is needed when compiling the Red console to make additional runtime functions available.
BeardPower
23:51But this is the REPL. I just want the "Red command-line front-end".
23:52I guess the red.exe is just red.r? But how can this be compiled to red.exe?

RnBrgn
03:10use the -- cli option
Phryxe
13:41I have some trouble seeing if Red's built-in functions return anything or not. Can I get a list of the files in a directory? dir, ll and list-dir seem just to print the file names.
rebolek
13:44@Phryxe read
Phryxe
13:46@rebolek Of course, thanx!
16:17I'm sure there is a better way to delete (non-txt) files without rejoin and the file path!?
m: %/d/Temp/test/
i: read m
foreach x i [if not (suffix? x) = %.txt [delete rejoin [m x]]]
9214
16:37@Phryxe
change-dir request-dir foreach file read what-dir [unless %.txt = suffix? file [delete file]]
Phryxe
16:50@9214 That is one way of doing it, moving to the directory to avoid using path. Thnx!
gltewalt
16:50What's the rejoin for?
Phryxe
16:51@gltewalt Don't I need the path to delete the file?
gltewalt
16:52I thought read m would take care of that
9214
16:53@gltewalt read returns file names, not their absolute/relative paths
16:55@Phryxe the downside is that your cwd will be the one to which you moved
gltewalt
16:56foreach f read request-dir [unless equal? suffix? f %.txt [print f]]
17:05If you already read in the dir, you don't need the full path to delete. You're already in it
9214
17:06@gltewalt you can't "read in the dir"
>> read %./test/
== [%qux.txt]
>> pwd
%/Z/home/isheh/dev/red/
gltewalt
17:07"read in"
9214
17:07@gltewalt whatever, show me how you read in
gltewalt
17:08Try it
9214
17:09@gltewalt as soon as you'll show me how to "read in the dir"
gltewalt
17:09You don't need the dir path to delete files if you are already in the dir
17:09
>> pwd
%/C/ProgramData/Red/
>> ls
    background.jpg         black.jpg              console-2017-1...      console-cfg.red    
    crush-2017-12-...      day5.red               deth2.PNG              gui-console-20...  
    med-tree.png           new.red                q.csv                  quotes.csv         
    reb.html               red.jpg                t                      temp1.jpeg         
    temp2.jpeg             temp3.jpeg             temp4.jpeg             test1.red          
    test2.red              testy                  tree.jpg               trees.jpg          
>> read %./
== [%background.jpg %black.jpg %console-2017-12-19-7750.exe %console-cfg.red %crush-2017-12...
9214
17:10@gltewalt but to "already be in the dir" you need to cd to that dir, right?
gltewalt
17:11Nope
17:11
>> read %/c/
== [%$Recycle.Bin/ %Config.Msi/ %cygwin64/ %dev/ %DevMgr.bat %Documents%20and%20Settings/ %DRIVE
9214
17:11then I don't follow what you're saying
gltewalt
17:13As you can see, I'm not in %/c/
>> pwd
%/C/ProgramData/Red/
>> read %/c/
== [%$Recycle.Bin/ %Config.Msi/ %cygwin64/ %dev/ %DevMgr.bat %Documents%20and%20Settings/ %DRIVE

but read will grab it anyway. Without change-dir
9214
17:13
text
>> pwd
%/Z/home/isheh/dev/red/
>> read %./test/
== [%qux.txt]
>> foreach file read %./test/ [delete file]
== false
>> read %./test/
== [%qux.txt]
17:13@gltewalt have you actually checked it?
Phryxe
17:13As far as I can tell read returns a block of file names without the path.
gltewalt
17:14
>> foreach f read %/c/ [unless equal? suffix? f %.txt [print f]]
$Recycle.Bin/
Config.Msi/
cygwin64/
dev/
DevMgr.bat
Documents and Settings/
DRIVERS/
GEARDIFx_install.log
hiberfil.sys
Intel/
msdia80.dll
msys64/
pagefile.sys
PerfLogs/
Program Files/
Program Files (x86)/
ProgramData/
Recovery/
RPKTools/
Ruby22-x64/
SWTOOLS/
System Volume Information/
Temp/
Users/
Windows/
>>
9214
17:14@gltewalt so what? You're printing bunch of files in a directory
gltewalt
17:15You wan't me to delete all my files?
Phryxe
9214
17:15**deleting** file and **removing** filename from block are different things, don't you think?
gltewalt
17:15Yes.
9214
17:16@gltewalt then show me how you delete files in a directory that differs from your cwd using only read and delete
gltewalt
17:17Gah, nevermind. You're right
9214
17:18because if you have ./foo.txt and ./test/foo.txt, without moving to ./test/ directory or rejoining ./test/ and foo.txt, you'll delete ./foo.txt
gltewalt
17:19Yep yep
17:19(Don't mind me, I'm just goofy)
9214
17:20but you're smart enough to catch tricky bugs, so cheer up :sparkles:
gltewalt
17:20:sparkles:
18:16Wildcards would be handy for files
greggirwin
18:35There are various ways to do the file thing, as always. Once you have the names, if you read from a dir you're not in, you can prepend the dir name you read to each file. If you *are* in a dir and read it, you get back relative file names. You can then use clean-path to make them absolute. That can be a nice, or dangerous trick. e.g. do a read on a dir, then print the clean-path of each file. Change dirs, and do it again.
18:36@gltewalt, I have an old file list lib for R2. The basics of globbing should be enough, and the hard part is designing your globbing dialect. I'm sure we'll see that built in, as it's very useful.
gltewalt
19:00Red Language “You’ll shoot your eye out, kid”
BeardPower
20:30@RnBrgn
>use the -- cli option

This will just run the command-line REPL, but red.exe is the command-line front-end.
20:36red.exe -h shows the help/commands, but when Red is compiled from the sources, it's only the REPL.
20:37Sow how do I compile from sources, so I have the same red.exe as from the download section.
rebolek
20:38@BeardPower why do you need same red.exe?
BeardPower
20:38@rebolek
So I can compile and use the -e option wihout the REPL.
rebolek
20:39red.exe is encapped Rebol with Red's REPL.
BeardPower
20:39red 0.6.3 does not have the option.
rebolek
20:39Red is compiled with Rebol, there's no Red compiler yet.
BeardPower
20:39So there is no tutorial on how to create the red.exe as in the download myself?
rebolek
20:40You would need Rebol SDK license key.
BeardPower
20:40Ahhh! That explains, that I found no information in building it :) Thanks!
rebolek
20:40But a) I don't think it's worth it, b) getting that key is impossible imo.
BeardPower
20:41I thought there was some script in the repo for doing it.
rebolek
20:41No, but red.exe does not provide any advantage over repl imo.
BeardPower
20:42a.) yeah, besides the feature to compile outside the REPL.
b.) because it's EOL?
rebolek
20:42ad b) basically yes
BeardPower
20:43Preparing for the big show then :+1:
rebolek
20:44ad a) you can't compile in Red repl anyway, you need to use Rebol for that and it's so easy to do that I don't see need for red.exe at all.
20:44for newbies, ok
BeardPower
20:45Convinced :grinning:
20:47I'm trying to pull other programmers into the Red boat, so I need to make sure I myself understand specific parts ;-)
rebolek
20:47cool :)
BeardPower
20:48I showed them your charting example and they were quite amazed about the performance and LoC.
rebolek
20:49of course the LoC is low, it's unfinished ;)
BeardPower
20:50Sure, but their PoC was about the same unfinished state as your example, but they used C#.
20:51So it was a fair comparison.
rebolek
20:51OK then :)
20:55I should make Gitter stats viewer in Red, it would force me to improve my graph style :chart_with_upwards_trend:
BeardPower
20:56Their cross-hair was quite laggy, while moving on the chart, yours was very smooth.
>line follows mouse without any delay

I need to check some information about the "custom widget" ideas, so I can start on trying to implement some pie/donut chart widgets.

20:57>I should make Gitter stats viewer in Red, it would force me to improve my graph style :chart_with_upwards_trend:

Or some Red coins ;-)
rebolek
21:03hehe :)
21:05btw, stats were updated with newer data (but clicking-on-user bug is not fixed yet)
greggirwin
21:33@BeardPower, https://github.com/red/red#running-red-from-the-sources-for-contributors may be good to show to some people, if they don't want a pre-built binary. Requires free Rebol, but no SDK or key.
BeardPower
21:47@greggirwin :+1:

gltewalt
02:35Looks like save saves { } characters to file if it's a constructed string
02:35Is it supposed to?
02:36
Red []

svg: make string! 10000
emit: func [code][repend svg copy code]

emit [
  <html>
  <body>
  <h1>"My first SVG"</h1>
  <svg width="100" height="100">
    <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
  </svg>
  </body>
  </html>
]

save %test.html svg     ; saves {} characters to file
;write %test.html svg   ; works correctly
clear svg
rgchris
02:46@gltewalt Yep—that's correct. SAVE will write the data to file in Red format. WRITE will write just the content of the string.
gltewalt
maximvl
20:35@greggirwin why is globbing dialect hard to design?
gltewalt
20:40Looks like to email! or to-email currently does nothing
rebolek
20:41@gltewalt why do you think so?
>> type? to email! "as@df.gh"
== email!
gltewalt
20:42Oh I was under the impression that it turned a value into an email format
20:50if you do x: to-email "rebolek" the program knows it's an email type, but programmers will see a word if they inspect it with probe or ??
20:50Am I having another bad brain day?
rebolek
20:52it's like false is logic! that looks like a word!
20:52it's more limitation of the console displaying method than of Red

rgchris
00:38@gltewalt Mind that EMAIL! (like FILE!, URL!, etc.) is just a type of string.
addresses: reduce [to email! "foo"]
probe type? probe first addresses
append first addresses "@bar"
probe addresses
greggirwin
12:51@maximvl, the basics aren't hard, of course. It's when you want to generalize it, as some systems or libs do, that it gets trickier. e.g., supporting ** as a recursion syntax, returning relative vs absolute names.
12:52And looking at the dialect in more than just the context of a shell listing.
maximvl
13:13mm not sure why would you want to generalize that far
13:14let's see if I can add something like this into my shell dialect :D
JiaChen-Zeng
17:09I want to write a function once with a code block that will only execute the code once, like:

>> do-something: does [
[    once [
[      print "Do initialization at the first time."
[    ]
[    print "Do stuff."
[    ]
>> do-something
Do initialization at the first time.
Do stuff.
>> do-something
Do stuff.
>> source do-something
do-something: func [][
    print "Do stuff."
]


Can this be achieved?
gltewalt
17:13Do you want a on-load type of thing?
You could use a Boolean flag, and either
9214
17:19@AT-Aoi
once: func [block][
    do block
    parse body-of context? first block [
        to remove ['once block!] to end
    ]
]

do-something: has [ref][
    once [
        ref
        print "Do initialization at the first time."
    ]
    print "Do stuff."
]

do-something
do-something
?? do-something
17:20a little downside is that function that contains once should localize some dummy word (ref in this case) which will serve as a reference back to context of a calling function
17:20you then can fetch function's body and modify it
JiaChen-Zeng
17:21@gltewalt Yes. I know either will work, but I think it would be cool to do like that.
9214
17:21the other way is to use wrapper akin to collect and keep
JiaChen-Zeng
17:24@9214 Thank you. It works.
9214
17:24@AT-Aoi also macros
JiaChen-Zeng
17:25Then I removed the ref here and it breaks. Is this required?
9214
17:25@AT-Aoi yes, as I said, you need some dummy word for once to work
17:25in this case it's ref
JiaChen-Zeng
17:27I see.
gltewalt
17:36Super simple version:
execute: true

do-something: does [
  either execute [print "Doing initialization"][print "Do stuff"]
  execute: false
]
17:37No seperate func though
18:04Or protected flag namespace with doing block
*init*: context [
  run: true
]

do-something: does [
  once: [print "Doing initialization"]
  either *init*/run [do once *init*/run: false][print "Do stuff"]
]
18:04Of course, @9214 way is much cooler
greggirwin
18:04If you don't care about modding the block itself...
once: func [block][also  do block  clear block]

do-something: has [ref][
    once [print "Do initialization at the first time."]
    print "Do stuff."
]

do-something
do-something
?? do-something
18:05@9214's version *is* way cooler.
9214
18:05it could also be more nicer looking, say only once, there once is a dummy word and only: func ['ref block][...]
gltewalt
22:40Anyone know what the issue is with GUI console that prevents wait from working right?
22:41Even rolling my own interval thing results in the same behavior.
set-interval: func [fn interval][
  tick: now/time + interval
  forever [if equal? tick now/time [tick: now/time + interval fn]]
]

rebolek
22:45@gltewalt it is known limitation of current GUI console, that will be fixed with brand new text-area! based console.
gltewalt
22:46I was wondering if anyone knew why the limitation, or what the limitation is as it's currently written
22:47(I can't read and decipher red/system very well yet. Reading wait.)
23:13Oh well, hopefully not much longer until new console

abdllhygt
20:08can i list files of folder?
20:08how?
gltewalt
20:25Did you try ls
abdllhygt
20:26no but i find those: dir and dir-list
20:39i haven't a problem now, thanks
rgchris
20:51You can also obtain a block of folder contents using read %folder/
abdllhygt
21:33@rgchris thanks, good code
gltewalt
21:50How do we do like a Ctrl+V from regular Red code?
greggirwin
21:51You mean sending, or checking in an event handler?
gltewalt
21:51Sending
greggirwin
21:52To another process, or just to a face?
gltewalt
21:53Well, for example, fire off a Ctrl+L to clear the GUI Console instead of pressing the keys
greggirwin
21:55Hmmmm, don't see an obvious way ATM. Old tricks don't work.
gltewalt
21:56Not possible from Red?
21:56Is #"^L" supposed to be Ctrl+L? Or is that Command
21:57SendKeys, I guess is the closest thing I can think of
greggirwin
21:58I have an old dialect to do that, for R2, but it won't work across platforms. Used to be able to print special chars to do it.
gltewalt
21:58Is that a COM thing?
greggirwin
21:58Nope, straight APIs.

9214
17:21can anyone remind me how to use emojis as words?
17:21or is this a feature of upcoming 0.6.3 console engine?
17:25ah, nevermind, I can just copypaste emojis directly, but current console (on Wine at least) doesn't display them properly
17:25
text
😁: 'cool!
17:25so as Gitter
gltewalt
17:57This should be sunglasses smiley but returns question mark in GUI console: #"^(1F60E)"
toomasv
18:34Using [unicode.red](https://github.com/toomasv/unicode):
do %unicode.red unicode/chart #01F60E

![unicode](http://vooglaid.ee/red/sunglass.png)
Need to have some extra fonts, though.

gltewalt
22:50is issue! a type of sting?
greggirwin
22:55It was under R2, but it's a word under Red.
22:56I thought it had much more value as a string type.
22:56Remember, you can use help on typesets too.
gltewalt
22:57I was asking because their is inconsistency in the to functions
22:58Remember when I was talking to @rebolek about to-email?
22:58
>> to-binary "ok"
== #{6F6B}
>> to-bitset "ok"
== make bitset! #{0000000000000000000000000011}
>> to-block "ok"
== [ok]
>> to-char "ok"
== #"o"
>> to-date "ok"
*** Script Error: cannot MAKE/TO date! from: "ok"
*** Where: to
*** Stack: to-date  

>> to-email "ok"
== ok
>> to-logic "ok"
== true
23:00There is no lexical representation when you convert to email1 or logic!
greggirwin
23:00Char is bothersome there, and seems an error might be better. What's the issue with issue!?
gltewalt
23:02It's an issue with email!. I originally expected to-email "ok" to return "@ok"
23:02You can only tell it's email! by querying the type
greggirwin
23:03Logic is a fixed set of known words. You could file a ticket wishing for it to return ok@, but it may be declined.
gltewalt
23:04I saw that to-issue did tranform it to #ok
greggirwin
23:04You are correct, but it's a bit of a gray area. It's a good question to raise, though, as we need to write down the why and wherefore.
23:06Email is a trickier type, because the sigil is actually a delimiter in the form. e.g. with file! or issue!, you can form them and the sigil goes away. Not so with email.
gltewalt
23:06I made sense when @rebolek described how logic! can look like an ordinary work, like, on, but there isn't a lexical hint for logic values. Emails should have @ somewhere in there
greggirwin
23:07But then you are modifying the data, not just coercing it to a different type. Not saying we can't, just that it's different.
23:09To does not guarantee round tripping between all value types.
gltewalt
23:09But we have syntax to signify lit-word, set-word, get-word, etc. Do we wan't types that are only recognizable by the program vs the programmer?
I don't know the answer.
greggirwin
23:10That's where mold/all comes in.
23:12What is the literal form form an object? ;^)
23:14Or a vector, or a hash, or an error, or a typeset?
23:15It may also be that email! lexing adds more rules, in which case to could throw an error if the input doesn't meet those specs.
gltewalt
23:17Looks like to-url is simillar
greggirwin
23:18Right, you don't want it adding :// to the head.
gltewalt
23:18Back to the to-char... You think an error would be better?
23:20What about recursively making chars, like - #"o"#"k"
greggirwin
23:22Well, it does do that for an empty string, simply because there's nothing to convert. The alt there would be to return a null char. In a single char string, you're good. In a multi-char string, it's not clear you only get the first, though that could be useful too, as you are possibly at an index in a string. Good to doc on Red by Example, or somewhere.
23:23Why would you return more than one result if you specifically asked for a char?
gltewalt
23:23Well i guess you wouldn't, but could have to-char and to-chars
greggirwin
23:24Now *that* is a good idea.
gltewalt
23:25ujkkmk
23:25sorry, kid got the laptop
greggirwin
23:25Gibberish? Hah!
gltewalt
23:26a secret acronym
greggirwin
23:26U Just Kant Kontrol My Kid
23:27Anyway to-chars would be a nice example func, but would need a strong use case for std mezz consideration.
gltewalt
23:29probably should ask the team if single character is more useful than error, at least.
I think it probably is?
greggirwin
23:30I agree. Let them sleep. @mikeparr, worth noting on RBE you think?

gltewalt
01:26error? (to-date "a") is this not supposed to return true or false?
greggirwin
01:29Need to wrap it in try.
gltewalt
01:35There we go...
funcs: [to-binary to-bitset to-block to-char to-date to-email to-file to-float to-get-path to-get-word to-hash to-hex to-image 
to-integer to-issue to-lit-path to-lit-word to-local-file to-logic to-map to-none to-pair to-paren to-path to-percent 
to-red-file to-refinement to-set-path to-set-word to-string to-tag to-time to-tuple to-typeset to-unset to-url to-word]

foreach f funcs [
  either error? try [r: do reduce [f "ok"]] [
    print [crlf f "=> blows up"]
  ][
    print [crlf f] probe r 
  ]
]
greggirwin
01:39You can save a little work by getting the functions directly.
funcs: [:to-binary :to-bitset :to-block :to-char :to-date :to-email]

foreach f reduce funcs [
  either error? try [r: f "ok"] [
    print [crlf "It blew up"]
  ][
    print [crlf :f] probe r 
  ]
]
gltewalt
01:39Hmmm :+1:
greggirwin
01:40Ah, not quite though, as you want the name too.
gltewalt
01:41That's a thing I don't know - is it possible to get the name from the func?
01:41The set-word attached to itself
greggirwin
01:42Have to do call stack tracing to see what was eval'd to get there. And in your case, you'd get f, right?
gltewalt
01:43Yeah
greggirwin
01:43Values know nothing about words that refer to them.
gltewalt
01:43I think I saw Bolek do it once though
greggirwin
01:44It was surely a trick. Bolek is a trickster. :suspect:
gltewalt
01:46Probably :smile:
01:48print [crlf to-word quote :f
01:49No, that just gives f
01:52Works with one line
>> print to-word quote :to-date
to-date
Phryxe
15:32More newbie stuff. If I have block or hash with records (key+value) where key is used several times, how do I keep both records (key+value)? I only want unique records. I thought that with /skip union would count key+value as one record.
x: [1 "aa"]
y: [1 "bb"]
union/skip x y 2
== [1 "aa"]
9214
15:34@Phryxe you want [1 "aa" 1 "bb"]?
15:39seems that union/skip sees that two keys are identical and removes the second record
15:39not sure if this is a bug or intended behavior
are1000
15:43Shouldn't it be intended behaviour tho? Union operates on sets and sets can only have unique keys
9214
15:43yes, that makes sense
Phryxe
15:43@9214 Yes
9214
15:43@Phryxe then use append x y
15:44or append copy x y if you don't want x to be modified
Phryxe
15:44Then I want the "records" to be unique.
9214
15:46I don't quite get what you mean by unique records :(
15:46in [1 "aa" 1 "bb"] they are already not unique
15:47ah, I see
Phryxe
15:47I see now that when I append I need to check if the key+value exist
15:47I have a long list of keys+values
are1000
15:48@Phryxe you can tell us what result you want exactly given those previous inputs
9214
15:50@Phryxe that's what altern might do, but it doesn't work as expected as of now
Phryxe
15:50The result is fine as you showed, but if I have many keys+values I thought I could use unique/skip x y 2 (fails as union).
9214
15:51it still feels like a bug
Phryxe
15:54@9214 @are1000 OK, I don't know. Thanks for now.
rebolek
16:42@Phryxe why not using map!?
9214
17:49@Phryxe see discussion in https://gitter.im/red/bugs
dander
19:49@greggirwin @gltewalt
> You can save a little work by getting the functions directly.

Overly broad?
funcs: collect [
    foreach word words-of system/words [
        if find/match to-string word "to-" [keep word]
    ]
]
gltewalt
20:28I don’t think so, but then you have to do something with the collected
20:29Or ‘still have to’
dander
21:02that's true. I guess the whole thing can be done all in the loop...
foreach fun words-of system/words [
    if find/match to-string fun "to-" [
        err?: error? try [r: do reduce [fun "ok"]]
        print [:fun either err? ["=> blows up"][r]]
    ]
]

gltewalt
21:23Looks good to me

toomasv
04:08> try [r: do reduce [fun "ok"]

:joy:
greggirwin
04:46The stuff of life. :^)
toomasv
05:19I suggest reducing it moderately
gltewalt
06:00Could have [word msg] for both has blockys, I reckon
Phryxe
06:07@rebolek I don't have unique keys and I wanted to use exclude, union and unique. I'll try to encapsulate my keys+values with subblocks instead as suggested by @greggirwin.
gltewalt
06:39Why does this error?
>> do reduce [to-word 'ok]
*** Script Error: ok has no value
*** Where: do
*** Stack:
rebolek
06:59@Phryxe I see, ok.
toomasv
07:01@gltewalt
1. to-word 'ok -> ok
2. reduce [to-word 'ok] -> [ok]
3. do [ok] -> *** Script Error: ok has no value
gltewalt
07:04Of course. :sweat_smile:
07:22My previous pasting was broken
err-msg: func [word msg] [print [crlf word crlf msg]]
result-msg: func [word msg] [print [crlf word] probe msg]

test-conversions: func [:val][
    foreach w words-of system/words [
        if find/match to-string w "to-" [
            err?: error? try [r: do reduce [w val]]
            either err? [err-msg w "(blows up)"][result-msg w r]
        ]
    ]
]
07:31Probably still broken, but time to sleep. I keep stumbling around
toomasv
12:32@gltewalt I played with your code a bit and [here](http://vooglaid.ee/red/type-conversion.png) is the result:
![conversion-table](http://vooglaid.ee/red/type-conversion.png)
I left out to-OS-path (which is unset), to-image and to-unset.
Following values were used for conversions:
types: compose [
	hex #00000001
	local-file "file.red"
	file %file.red
	paren (to-paren [paren])
	red-file %red-file.red
	logic (true)
	set-word (to-set-word 'set-word)
	block [block]
	bitset (charset "abc")
	binary #{01}
	char #"a"
	email e@mail
	float 1.0
	get-path (to-get-path [get path])
	get-word (to-get-word 'get-word)
	hash (to-hash [hash])
	integer 1
	issue #issue
	lit-path 'lit/path
	lit-word 'lit-word
	map #(map: 1)
	none (none)
	pair 1x1
	path (to-path [some path])
	percent 1%
	refinement (to-refinement 'refinement)
	set-path (to-set-path [set path])
	string "string"
	tag <tag>
	time 12:00
	typeset (to-typeset [typeset!])
	tuple 0.0.0.1
	url (to-url 'url)
	word (to-word 'word)
	date 2018-01-01
]

And I checked vals with this:
>> foreach [type val] types [print [type type? :val]]
hex issue
local-file string
file file
paren paren
red-file file
logic logic
set-word set-word
block block
bitset bitset
binary binary
char char
email email
float float
get-path get-path
get-word get-word
hash hash
integer integer
issue issue
lit-path lit-path
lit-word lit-word
map map
none none
pair pair
path path
percent percent
refinement refinement
set-path set-path
string string
tag tag
time time
typeset typeset
tuple tuple
url url
word word
date date
9214
12:32"played a bit", duh :D
toomasv
12:34There might be some errors, didn't check thoroughly yet.
BeardPower
12:34@toomasv Slow down!! You letting me look old ;-)
9214
12:34that would be helpful for the team anyway, good job :clap:
toomasv
9214
12:38we, old farts, just lagging behind :older_man:
toomasv
12:38Here is the [code](https://gist.github.com/toomasv/af7fb8c5f3534b7865a1c2708dab1721) for checking, but I must warn you - drawing this out takes soooome time
pekr
12:40cool. Such visual helpers might be part of the language itself :-)
BeardPower
12:42Absolutely. Having features like this in a Red IDE would be awesome!
12:43Lighttable on Steroids :)
pekr
12:44I already liked R2 Word Browser. Have you seen it? You can launch R2, type Desktop, go to the Rebol / Tools section ... useful help tool, though visually a bit aged ...
rebolek
12:45"it has retro look" sounds better
9214
BeardPower
12:48@toomasv
>Here is the [code](https://gist.github.com/toomasv/af7fb8c5f3534b7865a1c2708dab1721) for checking, but I must warn you - drawing this out takes soooome time

Thanks for the warning! It also freezes the Windows UI until it's finished. Dragging around is laggy. First I thought your code killed my Desktop ;-)
toomasv
12:49Yes, don't know how to optimize it
BeardPower
12:51We need to dig deeper into something like these "spreadheet" stuff, as it does not really render a lot of things. I'm confident that the community will come up with a super fast implementation in the end :)
pekr
12:53Well, I also do remember, from the past R2 days, that large areas to refresh were quite slow. The question is, what is the cause of the slowness. Might be many things, who knows. Well, @rebolek did some grid system, so he might know some pointers ...
BeardPower
12:53There exist special data structures for text editors and other stuff, which proved to be efficient.
12:54Need to collect all the info, once I have more free time.
rebolek
12:57 @pekr I did text-table, I wouldn't call it a grid, it's optimized for text data.
toomasv
13:33[Here](http://vooglaid.ee/red/type-conversion2.png) is table with converted values, AND highlighter to help navigation ([code](https://gist.github.com/toomasv/af7fb8c5f3534b7865a1c2708dab1721)):
![conversions](http://vooglaid.ee/red/type-conversion2.png)
That is, if you have enough time to wait for drawing..
pekr
13:36Is the drawing really so slow, or is that the computation of particular results?
toomasv
13:41Without view it is done at once.
pekr
13:42Wow, it almost killed my PC :-) There was something like half a minute outage, when even ctrl + alt + del did nothing, you could not switch between the apps, the only thing which worked was moving my mouse around. Once it appeared, Red console was at something like 39MB of memory here, which is not that much. When I tried to close the window, it somehow "undraw" itself from top to bottom and it lasted over 5 secs. Strange ....
13:42@qtxie ? -----^
toomasv
13:43Yes, I have seen this before with large drawings - it deletes itself in steps, and you have to kill the same man twice
BeardPower
13:46@pekr
>Red console was at something like 39MB of memory here, which is not that much.

For a spreadsheet like this, it's huge. It should only take about 5MB.
abdllhygt
BeardPower
13:47Hi and welcome!
9214
13:47hey @abdllhygt, any questions?
abdllhygt
13:47@9214 haha i have a question :D
13:48@BeardPower thanks!
13:48i need a code as drop-list/selected/text :)
qtxie
13:50@pekr Because the native control are heavy and the app create too many base faces, that's why people use DirectUI when they need to show a lot elements inside a window.
rebolek
13:51I knew why I wrote text-table in Draw ;)
qtxie
13:51Yes, using Draw will be much faster. :smile:
pekr
13:53Ah, i thought it is using draw - did not look into sources. Well then. So the base face is quite expensive, resource wise, right? Nothing like R3's small gob?
9214
13:54hm, I can't get drop-list to work on Wine :confused:
13:54it doesn't display strings
abdllhygt
13:55I can use drop-list on Wine
13:55It displays strings
9214
13:56okay, the former doesn't work, the latter does
>> view [drop-list ["a" "b" "c"]]
>> view [drop-list with [data: ["a" "b" "c"]]]

@qtxie :point_up: regression?
abdllhygt
13:56This code is wrong maybe
13:57Try view [drop-list data ["a" "b" "c"]]
9214
13:57oh, so I need to use data keyword
abdllhygt
13:57yeah :D
qtxie
13:58@9214 Yes, use data keyword.
9214
13:59@abdllhygt
>> view [l: drop-list data ["a" "b" "c"][probe pick l/data l/selected]]
qtxie
13:59@pekr We'll support something like gob in R3.
pekr
14:00Ah, that's news to me. What is the purpose? To get the smallest GUI element as possible?
abdllhygt
14:00@9214 my code is similar your code, but i want short code :)
9214
14:01@abdllhygt
>> view [l: drop-list data ["a" "b" "c"][probe l/data/(l/selected)]]

? :)
abdllhygt
14:02Oh thank you(!) :D
9214
14:02you're welcome
abdllhygt
14:02thank you for all your helps :)
qtxie
14:03It will support some events only (e.g mouse events) and much cheap. So you can use it in game apps.
rebolek
14:04That's a good idea.
pekr
14:04Sounds great!
14:05Hopefully it is going to be part of 0.6.4 or 0.6.5, once Red project earns its millions during the ICO phase :-)
9214
14:07> trillions

fixed a typo ;)
rebolek
14:07I hope it won't be part of 0.6.4 because I want 0.6.4 out during my lifetime ;)
9214
14:08we'll fund @rebolek's cryosleep then :D
pekr
14:12Well, I am in a cryosleep already, waiting for an Amiga NG to appear. Well, and next really good Alien movie too ...
rebolek
14:15@pekr that will be loooong sleep
9214
14:17I would say eternal
abdllhygt
14:53how to controls file exists in red?
rebolek
14:53@abdllhygt exists? file
9214
14:54@9214 dang, too fast!
abdllhygt
14:54:( thank you :D
rebolek
14:54@9214 I am slower only when I'm not here
9214
14:55https://www.youtube.com/watch?v=DvSXr7jgV8o
are1000
15:03
>> To be or not to be;
== "That is the question."
abdllhygt
16:16Hi again!
9214
16:16:wave:
abdllhygt
16:16How to i make that, drop-list default selected is 1
9214
16:17@abdllhygt
>> view [drop-list data ["a" "b" "c"] select 1]
abdllhygt
16:50@9214 thanks again!
greggirwin
18:17On spreadsheets, using faces isn't a scalable option. We tried that in the old VB days as well. I've built grid and tree output using draw in R2, and it's scrollable and fine. What you do, then, and how real spreadsheets do it, is track the current cell and have a single field you move around for editing. However, for small spreadsheets, which a lot are, you can use the simple approach. Not as efficient, but may let you easily build small things that are very useful, with almost no effort. Anyone remember the work Steve Shireman and I did on that? Should be easy to port.
gltewalt
20:10@toomasv Neat stuff. How about trying something with @rebolek text-table?
20:20I will try myself at some point but I all of a sudden have 3 big tasks in my lap
toomasv
21:05Can't find @rebolek's text-table. Any pointers?
dander
21:34@toomasv that is quite useful! It would also be convenient to have the first column contain the original value for that type, so you don't need to trace along the diagonal for it
gltewalt
21:49https://gitlab.com/rebolek/red-styles/

toomasv
03:50@gltewalt Thanks! @dander I’ll try, if I can make it running quicker, otherwise not useful.
endo64
06:33On Red;
>> f: has [s] [s: foreach x [1 2 3] [append "" random 9]]
== func [/local s][s: foreach x [1 2 3] [append "" random 9]]
>> f
== "727"
>> f
== "727221"
>> f
== "727221218"

On R2/R3:
>> f
== "883"
>> f
== "483"
>> f
== "333"

My question is, how local string "" doesn't grow on R2/R3 in that case? It grows, as expected in f: has [s] [s: loop 3 [append "" random 9]]
06:34Red's behavior looks more correct/consistent to me. But I surprised that it is not same in Rebol.
06:55Ok, got it.. it because strings are also local to foreachs context in Rebol, but not in Red:
>> loop 3 [foreach x [1 2 3] [append "" x]]
== "123"  ; Rebol
== "123123123" ; Red
greggirwin
07:14Correct.
dsgeyser
10:39Is there an easy way in Red to capture another application window (not Red window), as an image?
9214
11:41@dsgeyser AFAIK no, you should use some screencapturing software for that
11:41though, maybe you can make a call to it
rebolek
11:42There are certainly some OS functions for screen capture, so interface can be done in Red/System, but it's not *easy way*.
9214
11:42maybe @Oldes has something in his pocket of low-level bindings?
Oldes
11:45Don't have anything like that.
9214
11:45hm :^\ hm :^/ hmmm :^|
abdllhygt
dsgeyser
11:55@9214 Had a good laugh as usual....
9214
11:55hi again @abdllhygt
dsgeyser
11:56class clown
abdllhygt
11:56My program is crashing in this code:
11:56 either secCinsBakiye > (kurAl * adetAl) [
9214
11:56@abdllhygt what's the error message?
abdllhygt
11:57Error message is no, the program is froze
9214
11:58@abdllhygt can you post this code in a gist?
abdllhygt
12:01
secCinsBakiye: to float! (read rejoin[%db/kasa/ yaziKurCinsAl/text])
kurAl: to float! editKurAl/text
adetAl: to float! editAdetAl/text
either secCinsBakiye > (kurAl * adetAl) [
save rejoin[%db/kasa/ yaziKurCinsAl] (form (secCinsBakiye - (kurAl * adetAl)))
coinAlKasaYol: rejoin[%db/kasa/ listeCoinAl/data/(listeCoinAl/selected)]
	either exists? coinAlKasaYol [
		save coinAlKasaYol (form(adetAl + (to float! (read coinAlKasaYol))))
	][
		save coinAlKasaYol (form adetAl)
	]
	yaziVezneSonuc/text: rejoin["İşlem başarılı! "
	editAdetAl/text secCoinAl " Alındı!"]
	yaziVezneSonuc/color: 14.155.27  
	][
	aziVezneSonuc/text: rejoin["İşlem başarısız! Yeterli "
	 yaziKurCinsAl/text " Yok!"]
	yaziVezneSonuc/color: red
]

9214
12:05@abdllhygt it's hard to tell on a first sight, are you compiling or interpreting your script?
abdllhygt
12:05interpreting
12:08i start to use Wine3.0RC
9214
12:11usually your program freezes because of an infinite loop in a code, but I don't see any above
12:13and how you figured out that it freezes at this specific part?
abdllhygt
12:17scenario is:
button [
either 0 = 0 [print "freezes"][print "works"]
]
are1000
12:18@abdllhygt you are on Linux, right?
9214
12:19hm, this one works fine for me on Wine
>> view [button [either 0 = 0 [print "freezes"][print "works"]]]
freezes
freezes
freezes
freezes
abdllhygt
12:20what's your wine version?
9214
12:21@abdllhygt
isheh@sam ~ $ wine --version
wine-1.6.2
abdllhygt
12:21I try to install stable version
9214
12:22@abdllhygt also, try to update Red with latest build (links are at the very bottom of http://www.red-lang.org/p/download.html, "Direct links to latest builds")
abdllhygt
12:23Automated builds, master branch?
12:23i use 0.6.3
9214
12:24@abdllhygt http://static.red-lang.org/dl/auto/win/red-latest.exe
abdllhygt
12:24thanks
9214
12:24ah, yeah, automated builds will do, they are identical
abdllhygt
12:29HEEY :) doesn't freezes
9214
12:30@abdllhygt so it was a bug in Red?
abdllhygt
12:30but gives a error message :)
9214
12:30or trouble with Wine?
abdllhygt
12:30maybe i find a bug :D
12:31
*** Script Error: cannot MAKE/TO float! from: "0.5^/"
*** Where: to
*** Stack: view do-events do-actor do-safe error? view do-events do-actor do-safe
9214
12:32@abdllhygt you're trying to convert string with newline in it (^/ thing)
rebolek
12:32@abdllhygt use load instead
9214
12:33
text
>> rejoin ["0.5" newline]
== "0.5^/"
>> to float! rejoin ["0.5" newline]
*** Script Error: cannot MAKE/TO float! from: "0.5^/"
*** Where: to
*** Stack:  

>> to float! "0.5"
== 0.5
>> load rejoin ["0.5" newline]
== 0.5
abdllhygt
12:38i convert:
load rejoin[%db/kasa/ yaziKurCinsAl/text]
9214
12:38@abdllhygt what's the result of loading?
abdllhygt
12:39freezes :(
12:39doesn't give a error message
9214
12:39@abdllhygt can you check this line in CLI?
12:40i.e. not in Wine
12:40maybe there're some reading permissions on that directory
abdllhygt
12:40red.exe?
9214
12:40@abdllhygt red.exe --cli
12:40though it work as :shit: on Wine, try Linux version instead
abdllhygt
12:42i try with sudo now, loading...
12:47freezes
9214
12:48@abdllhygt you're loading inside View block, correct?
abdllhygt
12:49in view in on-click
9214
12:49it would be really nice if you'd come up with minimal example of this problem, perhaps there's indeed a bug lurking somewhere :bug:
toomasv
13:18@dander Here it is, [workable](https://gist.github.com/toomasv/af7fb8c5f3534b7865a1c2708dab1721). Only row-col highlighters are somewhat picky. Any more suggestions?
abdllhygt
14:31hi!!!!
14:31@9214 @rebolek i fixed the problem :D
9214
14:31@abdllhygt nice!
abdllhygt
14:32i made a mistake :/
9214
14:33happens with all of us from time to time ;)
abdllhygt
14:33:) but red are not good for errors
14:34red needs "good error message" and gtk support :)
rebolek
14:35@abdllhygt cool! And I agree it needs GTK support :)
abdllhygt
14:35i leave object pascal and i select red for this project :)
14:36I don't know to make a gtk lib :)
dander
17:23@toomasv nice! now I just need a bigger monitor :grinning:
toomasv
greggirwin
18:27@dsgeyser, see http://www.rebol.org/view-script.r?script=capture-screen.r for clues. Also, @moliad wrote a really nice screen capturing utility in R2 some years back.
18:32@toomasv, your table is a great GUI stress test. :^)
toomasv
18:33@greggirwin But does it work for you?
greggirwin
18:34I saw the highlight on the header row/col, but no other highlighting. Will try again.
18:35Ah, now I see it. Very subtle.
toomasv
18:36For me highlighting is working, kind of, but sometimes failing!? I'm trying to find the cause.
greggirwin
18:36Highlight sometimes goes back to row 1 or part of left col.
toomasv
18:37It's probably because of the layering of horz and vert.
greggirwin
18:37Takes a looooooong time to close the window. Much longer than to open it.
toomasv
18:37I have to kill this one three times. Why?
greggirwin
18:37Really nice though, given how new it all is.
toomasv
18:38 :kissing_closed_eyes:
dander
18:39yeah, I have to click the x 3 times too. Each time, only a subset of the faces clear out. pretty interesting effect
greggirwin
18:40We profiled, I think, that blocks are slow to remove from the head, yes? I wonder if something in disconnecting many internal handlers makes it slow, if the GUI objects are destroyed and removed in order.
18:40Same here x3.
18:41I can't imagine the internals have some limit when destroying faces, but maybe there's some condition that confuses the teardown process.
18:42Are you both also on Windows?
toomasv
18:44Yup! W10Pro
dander
18:44yes, same
greggirwin
18:47I wonder if the internal awake handler is still processing, sending events to faces, and getting confused as events are active while thing tear down.
toomasv
18:48??? Really dumb here
greggirwin
18:51View is trying to tear down the GUI, but Windows is still pumping events, which the GUI sees in a handler called awake.
18:52In the system/view object.
18:55I think this is the core of tearing things down: https://github.com/red/red/blob/master/modules/view/backends/windows/gui.reds#L508
18:55Could change to gui-branch room.
toomasv
18:57@greggirwin Yes, I think it would be proper. I have to meditate on the link.
19:58@greggirwin @dander Gee, if I comment out font and para, I can kill it with one foul strike
greggirwin
20:07I thought about that, seeing them in free-faces as treated specially.
toomasv
20:25When I include these guys in-face as font [size: 8] para [wrap?: yes align: 'center], the excruciating 3xkilling is back.
greggirwin
20:28Which trickles down to free-font
toomasv
20:29Would you confirm, that font and para are the culprits?
greggirwin
20:32Confirmed.
20:342x to kill with just para in there.
toomasv
20:44So, is it a bug or what?
greggirwin
20:49Changed to red/gui-branch.

sptorin_twitter
10:29Exist simple way to generate sequence in block (for example from 1 to 100)? Or need make loop with append?
9214
10:29@sptorin_twitter
>> collect [repeat i 10 [keep i]]
== [1 2 3 4 5 6 7 8 9 10]
are1000
10:31going with the punch:
10:31
range: function [max][collect [repeat i max [keep i]]]
sptorin_twitter
10:31if need from 10 to 20 and from 30 to 40 in one block? append two collect?
are1000
10:32no, you can just do
range: function [min max][collect [repeat i max [if i >= min [keep i]]]]
10:33and then range 10 20
10:33ooor
10:34
range: function [min max][collect [repeat i (max - min) [keep (i + min)]]]
sptorin_twitter
10:35or make op!, ok, I see
are1000
10:35This only works if min < max, so you can safely compose [ (range 10 20) (range 30 40) ]
10:36yep, with make op! you can i.e. do ~: make op! :range and then compose [ (10 ~ 20) (30 ~ 40) ]
sptorin_twitter
10:37Tnx. Just thinking some function already exist.
9214
12:19@are1000 I think you can pass an optional predicate in your range function
are1000
12:20@9214 to filter what number I want and what numbers I don't want?
9214
12:20@are1000 yup
are1000
12:20@9214 this is against the Jedi way
12:21filter range 1 10 function [x] [x >= 5]
12:21Why put on filter inside, when you can just use it outside and be more clear?
12:21ReUsAbIlItY
12:23(btw. I know it is more optimised the way you suggested, because you only loop once; however I do think that readability, granularity and composability is altogether more important than performance)
9214
12:30true Jedi (or are we Siths?) would create a list comprehension dialect
are1000
12:32Is this even a question? What is Siths favourite colour of lightsabers???
12:34magic-list [ x in range 1 to 10 where x squared is greater than 10 ]
rebolek
12:34I have such a function somewhere.
12:38http://box.lebeda.ws/~rebolek/rebol/swymir.html
9214
12:39I hacked @rebolek's github and here it is
https://github.com/rebolek/dvorek/blob/master/serie.reb
rebolek
12:40Ah, that's it, thanks for hacking it in there, @9214
are1000
12:40@rebolek this is really cool!
rebolek
12:46@are1000 thanks
9214
12:52@dander also did some interesting work with iterators and cyclers IIRC
dander
17:31@9214 are you talking about [this gist](https://gist.github.com/dander/66ad65555b30286115cee675b16bf1d7)?
Mind the mess at the top. There is still a lot of experimentation code in there. I'd like to clean it up and try re-implementing the generator function using Doc's [closure by value function](https://gist.github.com/dockimbel/79237c5454481bcb7d68105281b142a8) but haven't gotten around to it.
9214
17:35@dander yup
greggirwin
19:18@toomasv also has https://gist.github.com/toomasv/0e3244375afbedce89b3719c8be7eac0 and https://gist.github.com/toomasv/1b1d8e859eeb1acfa230cc5357ca12fa. And I have old R2 stuff: https://gist.github.com/greggirwin/20f11d27bfe8a46075a09264a179f7d1
19:20As we work on the design of these dialects, and I think we should, the key thing is to have concrete examples of their use.

gltewalt
05:46https://imgur.com/a/7YdFl
05:47Giving input a 'b with call/console/input {echo :-(} x: input gives an access violation
05:47But not with 'a
05:49annnnd... now it isn't doing it
06:00Oh... I know what happened.
>> call/console/input {echo hi} x: input
call/console/input {echo hi} x: input

:sweat_smile:
06:01Fed it back to itself by accident. Kaboom.
06:38red --cli
call/console/input {echo hi} x: "thirty-four-characters-and-kabooms"

With a fresh windows CMD console. Sometimes a string of length 34, sometimes a string of length 37, and not every time.

greggirwin
17:42What build and version @gltewalt? Local build with current source seems OK.
--== Red 0.6.3 ==--
Type HELP for starting information.

>> call/console/input {echo hi} x: "thirty-four-characters-and-kabooms"
hi
== 0
9214
17:43I vaguely remember something similar being reported a long while ago
greggirwin
17:43
>> call/console/input {echo hi} x: input
test
hi
== 0
>> x
== "test"
17:45https://github.com/red/red/issues/3090 was for a GUI console crash.
9214
17:46no, not that, something to do with character limit and cli
17:46maybe this https://github.com/red/red/issues/1281
17:51
text
>> call/console/input {echo hi} x: input
test
*** Internal Error: reserved for future use (or not yet implemented)
*** Where: call
*** Stack:
17:52
text
>> x
== "test"
gltewalt
17:57Red for Windows version 0.6.3 built 14-Jan-2018/20:06:48-07:00
18:01Win7 64bit
18:09Also blows up with set 'x "blahblahblah" when the string is length of 34
18:10I know it’s roughly equivalent. Has different side effects for scope sometimes, if I remember correctly
greggirwin
19:45I'm also on Win7 64-bit, but can't dupe this problem.
gltewalt
19:47New command.exe, the red —cli, then paste in that snippet
19:48*then
greggirwin
19:51That's what I did. Works fine.
gltewalt
19:56I swear it’s happening.
I swear :sweat_smile:
19:56Haven’t tried different build yet
greggirwin
20:09I believe you. Just need to find the difference in environs.

ghost~5680c5f416b6c7089cc058a5
12:02I think it may be fixed in the latest build.

On a month old console I get -
>> call/console/input {echo hi} x: input
test
hi

*** Runtime Error 1: access violation
*** at: 77AE1161h


On today's automated build, I get -
>> call/console/input {echo hi} x: input
test
hi
== 0
abdllhygt
16:16hi again
9214
16:16what's up @abdllhygt ?
abdllhygt
16:16@9214 i have a question, you guess :)
16:17
parse gelen [
		{yaz } copy text to {\n} (print text)
]
16:18i want to keep new line
9214
16:19you mean at the end of the text should be \n?
abdllhygt
9214
16:19try thru {\n}
16:19instead of to {\n}
abdllhygt
16:22doesn't work, i guess; the ask func don't have a new line?
16:22i take with ask
9214
16:22you want \n **as symbols** or by \n you mean literal newline?
abdllhygt
16:23no, i want newline
9214
16:24then it should be thru newline
16:25Red doesn't use C-style escape sequences (such as \n)
abdllhygt
16:27sorry doesn't work
16:27i see
9214
16:28
text
>> parse "yaz foo bar^/qux baz"["yaz " copy text to newline (print text)]
foo bar
== false
>> parse "yaz foo bar^/qux baz"["yaz " copy text thru newline (print text)]
foo bar

== false
16:28which one of these you need?
16:29note that this rule will work only once for one newline
16:29here ^/ is an escape sequence for newline
abdllhygt
16:30can you show with ask func?
9214
16:31@abdllhygt ask omits trailing newlines
16:31
text
>> probe ask "? "
? blah blah blah (ENTER)
"blah blah blah (ENTER)"
== "blah blah blah (ENTER)"
abdllhygt
16:31it works but it doesn't work with ask
9214
16:32@abdllhygt yes, because there's no newline at the end
abdllhygt
16:32oh i see
9214
16:32if you want to extract something from yaz to the end of the string, try to end
16:33
text
>> parse ask "? " ["yaz " copy text to end]
? yaz foo bar baz qux
== true
>> text
== "foo bar baz qux"
abdllhygt
16:33yes, it works now :)
16:34thank you!
9214
16:34alternatively, you can use find/tail
>> find/tail "yaz foo bar baz qux" "yaz "
== "foo bar baz qux"
abdllhygt
16:36i start to make a scripting language :)
9214
16:36that's cool!
abdllhygt
16:37but 17line now :)
9214
16:38Rome wasn't built in a day
abdllhygt
16:42Hard but necessary for a project. My project needs string operation very much. I develop with ruby language now, 1200line. I want more short, more easy and more understandable code.
9214
16:45would be interesting to look at comparison of two implementations once you've finished
abdllhygt
16:46yes, exactly!
16:56how to i keep empty OR space OR spaces
9214
16:57any space means "zero or more spaces"
16:57some space is "one or more spaces"
abdllhygt
16:58thank you!
9214
16:58you're welcome :)
abdllhygt
16:59are you in red developer team?
9214
16:59@abdllhygt no :D
abdllhygt
17:00how can you know these :P
9214
17:01I read a lot and ask much ;)
17:01http://www.red-lang.org/2013/11/041-introducing-parse.html
abdllhygt
17:02i guess i will be as you :)
17:35how any chars ?
9214
17:36either any [ | | | ...] or make a charset out of string of chars and use it instead
17:36chars: charset "your chars here"
abdllhygt
17:38i see
17:38i want to select all words
9214
17:38words in a sentence?
abdllhygt
17:39so, i want to make this:
gadkgmadk (9214) aglkgklda => 9214
17:40to keep ( )
9214
17:40
text
>> parse "gadkgmadk (9214) aglkgklda (abdllhygt)" [collect some [thru "(" keep to ")"]]
== ["9214" "abdllhygt"]
abdllhygt
17:41:D thanks
17:42what is task of collect?
9214
17:43it's used in combination with keep keyword to extract data that matched some pattern
17:43in this example it's everything between parentheses
abdllhygt
17:44i see but i will need different examples about collect-keep
17:44thanks
9214
17:46
text
>> digit: charset [#"0" - #"9"]
== make bitset! #{000000000000FFC0}
>> parse "letters, lots of letters and stuff and then BAM 9214 digits! d1g1t5 3v32y74323!" [
[    collect some [keep digit | skip]
[    ]
== [#"9" #"2" #"1" #"4" #"1" #"1" #"5" #"3" #"3" #"2" #"7" #"4" #"3" #"2" #"3"]
abdllhygt
17:48okay now, i understand %70~ :)
17:50i think that, red is hard about these
9214
17:51it really isn't, you just need to practice a little
17:51then everything will come naturally
abdllhygt
17:51i see
17:53actually i want to do:
afdfafad (123)adgagd => afdfafad 123adgagd
17:54after:
afdfafad (1+3)adgagd => afdfafad 4adgagd
9214
17:58
text
>> parse x: "afdfafad (1+3)adgagd" [some [change ["(" copy match to ")" skip] (do form extract/into match 1 copy []) | skip]]
== true
>> x
== "afdfafad 4adgagd"
18:00hm, doesn't work for first case
18:02ah, I see
18:02the problem is that you want 1+3 evaluate to 4
abdllhygt
18:03haha yes :D
9214
18:03so I tokenized it as [#"1" #"+" #"3], but first example then tokenized as [#"1" #"2" #"3"] and evaluated to just 3
abdllhygt
18:04( ) is mathematical operation
18:04I have a long way
9214
18:05
text
>> parse x: "afdfafad (123)adgagd" [some [change ["(" copy match to ")" skip] (do match) | skip]]
== true
>> x
== "afdfafad 123adgagd"
>> parse x: "afdfafad (1 + 3)adgagd" [some [change ["(" copy match to ")" skip] (do match) | skip]]
== true
>> x
== "afdfafad 4adgagd"
abdllhygt
18:11this is good
18:11only?
9214
18:11fixed :)
abdllhygt
18:16oh thank you very much
9214
18:16if you want to stick with this way of parsing, note that expression inside parentheses follow Red evaluation rules
18:17so e.g. 1 + 2 * 3 will yield 9 and not 7
18:17you can partially fix it by changing do match to math load match
18:17however currently math dialect supports only * and / operators
abdllhygt
18:18yes thank you, there have a problem too
18:18how will parser spaceless
9214
18:19yes, if you want to parse "spaceless" expressions, you need to come up with more stricter rules for tokenization
rebolek
9214
18:22in general, you need to design a separate parser for math expressions which will suit your needs
rebolek
18:22I need to revive redbot, let *it* do the stats (so I do not have to do it manually) and let it also announce *the most helpful person of the day*. Because @9214 is certainly today's winner.
9214
18:23[![peaaaachy_by_peachypatrickplz.jpg](https://files.gitter.im/red/help/M1yQ/thumb/peaaaachy_by_peachypatrickplz.jpg)](https://files.gitter.im/red/help/M1yQ/peaaaachy_by_peachypatrickplz.jpg)
rebolek
18:26http://static.tvtropes.org/pmwiki/pub/images/rsz_zayats-iz-nu-pogodi-bilo_7913.png
9214
18:35@rebolek you'll need to consider different timezones though
rebolek
19:01@9214 UTC FTW
19:05Not everyone spoils their timezone...
9214
19:06:shipit:
abdllhygt
19:21@9214 digit+digit => digit + digit
19:21last stage
19:22help me if i complete the first stage
9214
19:22let's see
abdllhygt
19:24okay thank you :)
9214
19:29
text
x: "afdfafad (1+3)adgagd"
also x parse x [
    some [
        change ["(" copy match to ")" skip](
            do also match parse match [
                some [
                    change copy op ["+" | "-" | "*" | "/"](rejoin [space op space])
                    | skip
                ]
            ]
        ) 
        | skip
    ]
]
abdllhygt
19:33what's also?
9214
19:34have anyone checked if some [to change blah bleh | thru end] is faster than some [change blah bleh | skip]?
greggirwin
19:34@abdllhygt help also
9214
19:34@abdllhygt also evaluates both of its arguments, but returns the first one
greggirwin
19:34@9214, let's profile it!
9214
19:35@greggirwin :sleepy:
>> now
== 19-Jan-2018/0:35:00+05:00
abdllhygt
19:35i didn't know help func, thanks @greggirwin
greggirwin
19:35@abdllhygt, let me suggest a possible alternative, after you've spent some time getting comfortable with parsing at the string level. If you make your scripting language a dialect of Red, you can use load on the input, then parse at the block level. What you're doing is still a great learning exercise, but you don't have to do all the low level tokenization if you work at the block level.
9214
19:36@rebolek should bite the bait :fish:
greggirwin
19:36@abdllhygt help and source are your best friends in the console.
19:36Changing of the guard I guess, time for @9214 to sleep. :^)
9214
19:36:guardsman: sir
19:39@abdllhygt as Gregg suggested, it's easier to leverage existing capabilities of Red instead of doing everything by hand, though, for that you'll need to change your specification a little. Remember that everything is a trade-off.
abdllhygt
19:42so you say that, i should make only my information?
9214
19:43@abdllhygt not sure what you mean :(
greggirwin
19:43
>> blk: load "afdfafad (1 + 3) adgagd"
== [afdfafad (1 + 3) adgagd]
>> parse blk [collect [some [keep word! | set p paren! keep (do p)]]]
== [afdfafad 4 adgagd]
19:44Note that in this example, I've only changed the spacing of your input, so Red can load it.
9214
19:44blk/2: do blk/2 :smirk:
greggirwin
19:45Wanted to stick close to the original but, yes, there are a lot of ways to do it.
9214
19:45@9214 :sleeping:
greggirwin
19:46
>> blk: load "afdfafad (1 + 3) adgagd"
== [afdfafad (1 + 3) adgagd]
>> forall blk [if paren? blk/1 [change/only blk do blk/1]]
== none
>> blk
== [afdfafad 4 adgagd]
19:46The main point, @abdllhygt, is that once you have your data in a block, it's much easier to process with Red.
abdllhygt
19:46i don't understand different of @greggirwin's code :) i think learning these
19:47string process is hard,
load process is easy, true?
greggirwin
19:48Your original was "afdfafad (1+3) adgagd". I just added spaces.
>> load "afdfafad (1+3) adgagd"
*** Syntax Error: invalid integer! at "1+3) adgagd"
*** Where: do
*** Stack: load  

>> load "afdfafad (1 + 3) adgagd"
== [afdfafad (1 + 3) adgagd]
19:48Yes! That's the idea. Parsing after loading is much easier.
abdllhygt
19:49Oh i see now @greggirwin
greggirwin
19:50
>> parse [1 2.3 #4 %5 6% () <> "" []] [some [set v any-type! (print type? :v)]]
integer
float
issue
file
percent
paren
word
string
block
== true
abdllhygt
19:50but i don't like (1 + 3), i like (1+3),(1 + 3) or (1+ 3)
greggirwin
19:50Well then, back to string parsing for you. :^)
abdllhygt
19:51@greggirwin thank you!
19:53now, my programming language:
<< "hello"
hello
<< =(1+3)
4
<< "=(1+3) hello"
4 hello
19:54<< is print
greggirwin
19:54Congratulations!
abdllhygt
19:55@greggirwin thanks
19:58@greggirwin @9214 roadmap:
"hello.txt" << "hello" is writing file
>> value is read console to value
"hello.txt" >> value is read file to value
value: "hello" is you know :D
20:00So, it's easy for englishless people :)
greggirwin
20:01More operators, less words, understood.
abdllhygt
20:02@greggirwin
? 10 = 10 {
    << "yes, 10 is 10"
}

if statement :)
greggirwin
20:03Another approach would be to alias words for the subset of features you want. e.g.
okunmak: :read
yazmak: :write

Though your approach works across languages.
abdllhygt
20:05in your opinion; english people don't read turkish codes
greggirwin
20:06Aliasing words doesn't solve the problem globally, only for one language at a time, if you're writing something for local use.
abdllhygt
20:07but i have a idea as your idea;
! write | yaz (i) {
    << i
}

multi name function for users
greggirwin
20:08You can absolutely do that too.
abdllhygt
20:09do you like my programming language @greggirwin :D where is @9214 , i want that, you look these examples :)
20:12i want to show a example too:
! up | büyüt (i){            #Func Of Standart Library
    ... #uppercase
}
<< "hello"
<< "hello".up           #HELLO
<< "hello".büyüt    #HELLO
greggirwin
20:12@9214 is sleeping I think. Your basic operators make sense ? for if, and arrows for moving data and STD I/O. The most important thing is for you to try it, document it, and explain it to others. Get a small piece of it working, and post for us to play with.
20:15I see the Ruby influence. :^)
20:16I think offering features in native languages is a great idea.
abdllhygt
20:16about class? yes :) i liked this style (operators)

9214
04:27@abdllhygt interesting approach for a scripting language, short and meaningful symbols are undervalued in most programming languages ;)
PeterWAWood
04:46@abdllhygt Like Ruby, there are many different ways of doing things in Red. I thought that it might be interesting to automatically insert spaces when loading (1+1):
Red []

system/lexer/pre-load: func [src part][
	digit: charset [#"0"-#"9" #"."]
	operator: charset [#"+" #"-" #"*" #"/"]
	paren: [ #"(" some digit operator some digit #")"]
	parse src [ 
		any [
			s: paren (
				insert find s operator " "
				insert find/tail s operator " "
			) 
			| skip 
		]
	]
]

foreach test ["(1+2)" "(3-4)" "(5*6)" "(7.0/8)"] [
	print mold load test
]

The output is:
(1 + 2)
(3 - 4)
(5 * 6)
(7.0 / 8)
greggirwin
05:56I thought about that too, Peter, but you went and did it! +1
PeterWAWood
06:08I'm sure it can be greatly improved upon.
abdllhygt
10:39@9214 so you don't like as @greggirwin :D
10:41@PeterWAWood is (1+4*5) working?
9214
10:47@abdllhygt no, @PeterWAWood's solution supports only digit op digit expressions
meijeru
10:52You might wish to consult the source of the math function to add precedence rules.
9214
11:32rather number op number
abdllhygt
11:47my opinion; present method is well( code of @9214 ). but this method use do. this isn't well. i need to learn parse very good. after we will talk about these :)
9214
11:49that's the spirit :+1:
11:50only string-level parsing, only hardcore
PeterWAWood
12:18@abdllhygt It should be quite easy to change the pre-load function to process number followed by any number of op number.
abdllhygt
12:22@PeterWAWood i see, thank you!
PeterWAWood
14:45@abdllhygt Here is a cleaned up version that will handle multiple sequential operators:
Red []

system/lexer/pre-load: func [src part][
	digit: charset [#"0"-#"9"]
	number: [some digit opt [#"." some digit]]
	operator: charset [#"+" #"-" #"*" #"/"]
	paren: [
		#"(" 
			number 
			some [ 
				s: operator (
					new: copy " "
					append new reduce [first s " "]
				)
				e: (s: change/part s new e) :s
				number 
			]
	    #")"
	]
	parse src [any [paren | skip]]
]

foreach test ["(1+2+3+4+5)" "(3-4+4)" "(5*6)" "(7.0/8+10*2)"] [
	print reduce load test
]
14:46These are the test results:
15
3
30
21.75
9214
14:49@PeterWAWood I'd use some [change copy match operator (rejoin [space match space]) number]
PeterWAWood
14:49It doesn't handle embedded (). That is possible but I'll leave it to you (or others).
14:50@9214 That's okay as long as the operators don't appear outside of the parens.
meijeru
14:51I don't see how this handles precedence!
PeterWAWood
14:51e.g. "my-calculation (1 + 2)"
14:52@meijeru The purpose of this pre-load function is to allow (1+2) to be loaded. It can then be processed with a dialect.
9214
14:53print math load test?
gltewalt
19:34The problem still exists for me with call/console/input {echo hi} x: "blahblah........."
19:35https://imgur.com/a/D4v6R
19:40I mean, it's not an actual problem for me - I was just poking things with a stick and happened upon this issue
RnBrgn
gltewalt
BeardPower
21:35Sorry, I don't read brail.
gltewalt
21:37Problem with the default buffer (or reallocating buffer) with set-word.

x: make string! 3
call/console/input {echo hi} x: input
1234

21:37At a certain length, it blows up with: call/console/input {echo hi} y: input
BeardPower
21:39
>> call/console/input {echo hi} x: input
1234
*** Internal Error: reserved for future use (or not yet implemented)
*** Where: call
*** Stack:
gltewalt
21:40-cli, not the GUI console
21:42And it doesn't happen every time
BeardPower
21:43Ah, mom.
21:43Confirmed:
>> x: make string! 3
== ""
>> call/console/input {echo hi} x: input
1234
hi
== 0
>> call/console/input {echo hi} x: input
f
hi
== 0
>> call/console/input {echo hi} x: input
hellos
hi
== 0
>> call/console/input {echo hi} x: input
asdadadasd
hi
== 0
>> call/console/input {echo hi} x: input
asdadasdasdaqwfsas
hi

*** Runtime Error 1: access violation
*** at: 777005D2h
21:47Crashed instantly:
>> x: make string! 3
== ""
>> call/console/input {echo hi} x: input
1234
hi

*** Runtime Error 1: access violation
*** at: 777005D2h
gltewalt
21:57Something sticky going on because it doesn't always crash at the same length with just x: input, and won't always instantly crash with x: make string! 3
greggirwin
21:57This will be a great ticket when you finally narrow it down.
gltewalt
22:31If I make a string of 1, looks like it breaks after 16
22:31
test-call: has [count str][
    count: 0
    str: make string! 1
    loop 100 [
        count: count + 1
        ; 0 is the 'success' result
        write/append %log.txt reduce [count call/console/input {echo hi} append str "*"]

    ]
]
22:38Nope, still random
22:38https://gist.github.com/gltewalt/6153359bb52cb4d1efb7f88741060b8d

gltewalt
02:02Don't do this: system/console/history: ""
02:16I bet it's this because windows CMD.exe is bad with unicode:
emit-red-char: func [cp [integer!] /local n][
	n: 2 * unicode/cp-to-utf16 cp pbuffer
	pbuffer: pbuffer + n
]
02:17@qtxie
02:19Or pbuffer in input
BeardPower
02:45@gltewalt
>Don't do this: system/console/history: ""

Why not? Is this addressed to someone or just a general hint?
gltewalt
02:48Just a general hint from my weird poking and prodding. You can try it, or look in the Sandbox room to see what happens
02:50General warning, I guess
mikeyaunish
05:38Not sure why this is crashing the console:
05:40
a: context [ f: function [ a ] [ return a ] ] 
>> a/f "hey"
== "hey"
>> b: a/f "what"

Crashes the console
9214
05:40@mikeyaunish https://github.com/red/red/issues/3156
greggirwin
07:34@gltewalt, those kinds of warnings are always fun to see. If I posted about every time I've done something like that... ;^)
rebolek
11:10This is the most evil bug, that basically makes Red useless. I am running on two/three months old console build just to be able to use Red.
abdllhygt
11:34@PeterWAWood thank you :) i will start to learning parser
gltewalt
18:36@rebolek Which bug? The mikeyaunish example?
rebolek
19:24@gltewalt https://github.com/red/red/issues/3156
toomasv
19:49@rebolek Is explicit typing of any help?

gltewalt
00:13No problem with reduce or do reduce
abdllhygt
14:00What is union?
14:01I don't understand this code:
non-zero: charset "123456789"
    digit:    union non-zero charset "0"
9214
14:01it's one of the set https://en.wikipedia.org/wiki/Set_(mathematics) operations
14:02here it unifies two sets of characters and creates another set of characters
14:03
text
>> ? "data set"
     difference      native!       Returns the special difference of two data...
     exclude         native!       Returns the first data set less the second...
     intersect       native!       Returns the intersection of two data sets.
     union           native!       Returns the union of two data sets.
     unique          native!       Returns the data set with duplicates removed.
abdllhygt
14:03so, = charset: "0123456789"
9214
14:03correct
abdllhygt
14:04= charset + charset i understood
gltewalt
15:03How do we compile console from source via Rebol do/args in Debug mode? Or is there another tool
9214
15:04@gltewalt have you checked readme?
gltewalt
15:04Yeah. I normally compile with rebol console and do/args
15:07Is there another tool? do/args %red.r "-d %environment/console/console.red" fails
9214
15:07it depends on what do you mean by "Debug mode"
gltewalt
15:10Looking at this: https://github.com/red/red/wiki/How-to-Debug:-A-use-case-by-@DocKimbel

"First thing to do is to compile the above code in debug mode (-d option) or re-compile a GUI console version in debug mode. Many assertions and debug logs through the Red runtime code are not available in release mode."
15:11What does he mean "recompile"?
9214
15:11someone decided to bite the https://github.com/red/red/issues/3156 ? :smirk_cat:
gltewalt
15:12Yeah, wading in over my head
9214
15:12well, if you read really carefully
> First thing to do is to compile the above code in debug mode (-d option) **or** re-compile a GUI console version in debug mode. Many assertions and debug logs through the Red runtime code are not available in release mode.
15:13https://github.com/red/red/wiki/Debugging
15:15@gltewalt kudos for courage btw :+1:
15:18I might say a pure nonsense, but what if you try to compile console with Red itself (as it seems the only thing that supports -d flag)?
15:19I mean GUI console
gltewalt
15:31Can't get that to work.
9214
15:35maybe the reasonable thing to do is to revert the commit that caused the regression? https://github.com/red/red/commit/bca86785936b0750b994702daa15734361237f1f
15:35at least for now, since @dockimbel is quite busy
gltewalt
15:39That probably is the reasonable thing to do, but my goal was to stretch my wings and follow the debugging article.
15:39https://i.imgur.com/wAcH6Me.jpg
9214
15:40you're more likely to hamstring yourself if you'll start with something that complex (IMO) :bird:
gltewalt
15:41Yeah, you're probably right
15:57I can use probe and ?? in release mode, but I was hoping to use stack/dump and dump4
9214
15:58@gltewalt I believe those are R/S functions
gltewalt
15:58Yeah. Aren't they the ones that require compilation in debug mode?
9214
16:00at least this is what was mentioned in a debugging article
gltewalt
16:02I'm just going to have to wait until some of the gurus get un-busy
abdllhygt
16:02hi again
9214
16:02hi @abdllhygt :)
abdllhygt
16:03@9214 how are you :)
16:03
four:     charset "01234"
    half:     charset "012345"
    non-zero: charset "123456789"
    digit:    union non-zero charset "0"

    byte: [
          "25" half
        | "2" four digit
        | "1" digit digit
        | non-zero digit
        | digit
    ]
9214
16:03alive and kicking
abdllhygt
16:04is this humor? :P
16:04you means baby?
9214
16:04@abdllhygt https://idioms.thefreedictionary.com/alive+and+kicking :D
abdllhygt
16:05:D i understand now
16:06so i don't understand "25" half
16:06what is it?
9214
16:07"25" followed by any character from half charset
16:07i.e. "25" [#"0" | #"1" | ... | #"5"]
abdllhygt
16:07as 251
9214
16:08yeah, like that
abdllhygt
16:08oh thanks
9214
16:08all numbers between 250 and 255
abdllhygt
16:09i understood
16:11what is skip?
9214
16:12"match any value"
16:12
text
>> parse "abcd" [4 skip]
== true
abdllhygt
16:13
parse data [some [copy value ipv4 | skip]]
9214
16:13@abdllhygt either ipv4 matches or we skip one character and moving to the next one
16:14
text
>> parse "abcd" [2 skip x: (print x) to end]
cd
== true
abdllhygt
16:14i guess i understand
9214
16:15in the example above 2 skip skipped first 2 characters ab
abdllhygt
16:19i understand!
16:19thanks
16:20which jobs does reducer working?
9214
16:20:question:
abdllhygt
16:20:D sorry, what is jobs of reducer?
gltewalt
16:21Are there jobs for Red?
abdllhygt
16:21No :)
16:22reducer works on gui program or parsing program? in office?
16:23so, php programmers make a website
16:23red programmers?
16:23maybe now, they doesn't work, true?
16:24do you write red code in your job?
9214
16:25well, Red is general-purpose enough, but I don't fully use it in my "job", as it requires some scientific computation for which Red (at least for now) is not really suitable and lacks all the required libraries and stuff
16:26I do rely on parse from time to time
abdllhygt
16:27i see
16:28parse of red is elegant
16:29red is best parser your opinion?
9214
16:30I have nothing to compare with, because it's the only parse-like functionality I learned to use :)
abdllhygt
16:32@9214 me too :D
16:32
parse data [some [copy value ipv4 | skip]]

16:32
parse data [copy value ipv4 | skip]

16:33why we use some in this code?
9214
16:33some repeats [copy value ipv4 | skip] rule one or more times
16:33and traverses all data that way
abdllhygt
16:34thanks
16:35
>> parse "abcdefg" [some ["cdefg"] | skip]
== false
16:36why doesn't work?
9214
16:36@abdllhygt some ["cdefg" | skip]
abdllhygt
16:37ah :)
9214
16:37"either match "cdefg" or just skip char and move to the next one -- repeat til the end"
abdllhygt
16:38yes, i see
16:44
expr:    [term ["+" | "-"] expr | term]
    term:    [factor ["*" | "/"] term | factor]
    factor:  [primary "**" factor | primary]
    primary: [some digit | "(" expr ")"]
    digit:   charset "0123456789"
    
    parse "1+2*(3-2)/4" expr        ; will return true
    parse "1-(3/)+2" expr           ; will return false

i don't understand this :/
9214
16:44well, it's a recursively defined grammar, takes some time to digest
16:48in short, it checks if math expression is correct (you'll need to implement something like that for your scripting language ;))
abdllhygt
16:48yes i know :)
16:50@endo64 is Turk. He will help me about parser. But he is offline now.
BeardPower
16:52Red is for everything and perfect for data series. It just needs more libs and features like concurrency, async I/O, ports.
9214
16:52@BeardPower yes, exactly
16:53and optimization layer ;)
greggirwin
16:54@9214, *you* are the optimization layer. ;^) Well, and @rebolek and @toomasv, and...
BeardPower
16:54It would be great, if performance would be at about 90% of C code.
9214
16:54meanwhile I'm looking into J and Julia :neckbeard:
greggirwin
16:56As for parse, Red's approach is my favorite, but others may prefer different tools or libs. We'll build more tools over it at some point, but it's power comes from block level parsing, that other parser toolkits don't have, because they don't use Red. VisualParse++ was a nice, old tool for writing shift-reduce parsers, and ANTLR has some nice things in it, but not as approachable for me.
9214
16:57perhaps @greggirwin meant that all active users should sell their souls to Fullstack so they can power the magical optimizer... :shipit:
greggirwin
16:57@BeardPower, while I agree, that's kind of an arbitrary and vague goal. Good for benchmark comparisons, but I'd rather accept current general performance, with a focus on a couple high performance areas for things like array processing as J targets.
16:58@9214! Shhhhhh. *^|
16:59Maybe I need a real emoji there. :^) Back later folks.
9214
16:59and now he speaks in [parseltongue](http://harrypotter.wikia.com/wiki/Parseltongue)! :snake:
17:04I think ML and scientific computing are another domains there Red could potentially benefit with its dialect-first approach, because it's on hype peak (just like blockchains) and unifies different fields, both scientific and computing, hence there's a need for a "common language", so to speak.
17:05I mean, I would rather use full-fledged matrix dialect (@tommasv :exclamation:) than write NumPy mess
17:06that's another reason why I'm looking into J -- it's a perfect domain-specific notation, albeit a cryptic one
gltewalt
17:06Every time I see ML I think people are talking about the language
9214
17:07:camel:
abdllhygt
18:20what is reduce?
18:21
ws: charset reduce [space tab cr lf]

as union?
9214
18:21@abdllhygt try ? reduce in console and see for yourself
abdllhygt
18:23i try now
charset "abc"
charset reduce ["a" "b" "c"]

is it same?
9214
18:24
text
>> a: "a" b: "b" c: "c"
== "c"
>> charset [a b c]
*** Script Error: cannot MAKE bitset! from: a
*** Where: make
*** Stack: charset  

>> charset reduce [a b c]
== make bitset! #{00000000000000000000000070}
>> reduce [a b c]
== ["a" "b" "c"]
abdllhygt
18:26so, for multi chars or phrase, true?
9214
18:26sort of
abdllhygt
18:27variables need reduce for charset
9214
18:28blocks are data and are not evaluated by default, what you're passing to charset in charset [a b c] is a block of 3 words, not a block of 3 strings
abdllhygt
18:29i see now
18:31can you tell collect. i try ? collect in console, but i need examples.
9214
18:31you mean parse keyword or a function?
abdllhygt
18:32collect in parse
18:32
parse html tags: [
        collect [any [...
9214
18:32
text
>> parse [a 1 b 2 c 3][collect some [keep integer! | skip]]
== [1 2 3]
abdllhygt
18:33collect is for keep?
9214
18:33collect everything that is keeped, yes
abdllhygt
18:36i see
9214
18:36it might not be clear, but collect accepts a parse rule as its argument, in the example above it's a some rule, in turn some accepts another rule, which is [keep integer! | skip]
gltewalt
18:36Time for your parse blog
abdllhygt
18:39what is opt?
9214
18:39optional match
18:39i.e. either match or not, but continue to parse in any case
18:40
text
>> parse [a 1][opt word! integer!]
== true
>> parse [1][opt word! integer!]
== true
abdllhygt
18:41i see thanks, i understand with examples, thank you!

greggirwin
02:01@abdllhygt, have you read http://www.red-lang.org/2013/11/041-introducing-parse.html?
sptorin_twitter
10:23can I make typeset! with restrictions? for example it's positive number not more then 100
9214
10:24@sptorin_twitter AFAIK no, you can play around with reactors though
10:25@dockimbel am I right that #alias directive is not implemented yet?

> a new #alias compilation directive will be introduced. This directive will allow users to turn an object definition into a "virtual" type that can be used in type spec blocks
sptorin_twitter
10:26and in func argument block I can make some checks? x < 100 etc...?
9214
10:27@sptorin_twitter yes, if you really want
10:28@rebolek done something like this http://red.qyz.cz/dependent-types.html
10:28I also helped one of the users to implement such boundary checks, though, can't find any snippets right now
10:29in general, Red doesn't have built-in functionality as the one you ask for, so you should implement your own custom function constructor
10:30like @rebolek's afunc
sptorin_twitter
10:30I see, tnx. afunc - good example
9214
10:34although the easier way would be to check argument's boundaries inside function's body with switch, case or whatever
rebolek
10:49@9214 how do you think that afunc checks boundaries?
9214
10:51@rebolek the same way as I proposed :smirk:
insert body compose/deep [
                    assert [(word) (symbol) (val)]
                ]
10:51well, almost, I believe it's R2 code?
10:52because of assert
rebolek
10:52I believe R3, I haven't used R2 very much, after R3 came out.
9214
10:52heretic!
rebolek
10:55Actually, there's lot of R3 stuff in Red.
abdllhygt
11:58@greggirwin yes, i read but my english isn't good
9214
15:42@abdllhygt hi Abdullah, next round of questions? :)
kokenge
16:19This is my first quick look at REBOL or RED. Might be a stupid question, but can you write web application. Do you write HTML code with links to RED. Or can you make the application you create appear in a browser and be sent back to RED. I guess my question is, How exactly does it work with the web. What are the steps to develop a web app
9214
16:20@kokenge hi, welcome! Unfortunately not yet, though, there're plans to compile down to asm.js and, in the future, to webasm.
16:21@are1000 seems to be brewing in web developing, maybe he can say something more helpful
are1000
16:28@kokenge right now there is no simple way to create webapps with Red. However you can look at using Red as CGI ( @rebolek can tell you more about it) or you can wait until Red/JavaScript transpiler is completed (I just started working on proof of concept). I think that in the near future (as soon as Red will have full IO and Webview built in) there will be some workarounds for this.
Oldes
16:31Any example how to use into rule in parse?
9214
16:32@Oldes
>> parse [a b c [1 2 3]][3 word! into [3 integer!]]
== true
16:34i.e. "dive down" into the matched series (it this case it's the block under the pointer) and parse it with a given rule
Oldes
16:36
>> parse [flags [a b c]] ['flags into [x: 1 skip (probe x)]]
[a b c]

I expected to have the into rule go to inside the series... so instead of above result to have:
a
b
c
16:37So the into is just an additional check if the input is valid, right?
9214
16:37
text
>> parse [flags [a b c]]['flags into [some [set x skip (probe x)]]]
a
b
c
== true
16:38@Oldes yes, instead of parsing [a b c] as block! at top level you're checking its content
Oldes
16:38ech.. my fault than... my parse skills are quite rusty:)
BeardPower
16:41Wouldn't parse be a bottleneck, if it's called 10 times a second?
9214
16:41@BeardPower into doesn't call another parse, if that's what you mean
BeardPower
16:42E.g. running an animation DSL with 60fps. Parse would be called quite a lot.
16:42@9214 No sorry, I was referring to parse itself.
9214
16:42IIRC @dockimbel mentioned that in the future Parse compiler will be implemented for such intensive tasks
BeardPower
16:44Nice. As I want to make an animation DSL with plugins (the parse rules would be changed at the first start), the parse rules would be called every 16ms.
rebolek
16:45You can test speed of parse to see if it runs fast enough.
BeardPower
16:46Or would it be better to just code some functions instead of a DSL?
16:46Will do.
9214
16:46@BeardPower parse is not the only way to create DSLs in Red
BeardPower
16:46@9214 I'm exchanging a Red token for more infos/examples on that :)
9214
16:48well, you can roll out macros or work with bind and custom contexts only
BeardPower
16:48I had the impression, that parse is the (only) way to go for implementing a DSL, because in all the examples I read about, parse was used.
9214
16:48though, it wouldn't be that elegant
16:48in simpler cases, you can just use built-in functions
16:49dialect is any piece of data that get "special" treatment
16:49say, [here](https://github.com/9214/daruma/blob/master/src/datasheet.red#L119) I described 3 steps of permutations, kind of a dialect
16:50and [here](https://github.com/9214/daruma/blob/master/src/decoder.red#L28) how I interpret this "dialect"
16:50just a combination of looping and binding
dsgeyser
16:50Is RedBin Red's solution for implementation of something similiar to Protocol Buffers? And will RedBin allow easy exchange of data between various platforms and languages? I believe technology behind sandstorm.io will have a huge impact on the internet in years to come.
9214
16:50well, and composing
BeardPower
16:51Thanks, greatly appreciated!
9214
16:54@dsgeyser I believe @greggirwin might answer this questions in detail, as I recall that he mentioned Protocol Buffers at some point
BeardPower
16:56Protocol Buffers is kind of "retro". FlatBuffers, Cap' n Proto, SBE etc., are the new kids on the block. Just saying :)
16:58IIRC PB was mentioned for transferring the RedBin data over the network. Slap me, if I'm wrong.
rebolek
17:00@BeardPower I did anim dialect for my pitch.green demo, I may still have it somewhere. IIRC it precompiled the dialec to some internal representation tha was faster to work with.
BeardPower
17:02But, as I understand RedBin being some kind of "concise memory snapshot/representation of the code in memory", it has similarities with PB as a serialization format.
17:04@rebolek Cool. Counting on your search & rescue capabilities :)
rebolek
17:09I am on phone now, so it will have to wait until I get home, I ket you know then.
dsgeyser
17:10Yeah, sandstorm.io is using Cap'n Proto extensively. The head developer of sandstorm is a former Google engineer and did most of the Protocol Buffer development, used by Google to this day. Interesting concept.

But I need an AMD64 box to set up my own server. Quite hard to find one these days.

Would be interested to see something similar running on Red code one day.
BeardPower
17:39And he also developed Cap'n Proto 🤓
17:40@rebolek Awesome. Take your time ✌
rebolek
17:42Btw the demo is available on rebol.org so you can see it in action right now ;) but it's obfuscated because of the rules.
BeardPower
17:46Will try to break it, the app, not the obfuscation 👍
rebolek
19:02@BeardPower hm, it's probably not on rebol.org, but someone uploaded it on youtube https://www.youtube.com/watch?v=KrIWf-fIhA0
BeardPower
19:04👍
rebolek
19:11Hm, it must have been recorder on *very slow* computer.
19:13Ah, here it is http://www.rebol.net/demos/C25FFB73CAA5321B/pitchgreen.r
BeardPower
19:21Are these files also available? files: [%aggregator.r 10056 %mostik.jpg 14908 %pitch-green.ran 2353 %pitch-green.song 829]
rebolek
19:22That's the description of the archive, all those files are part of it.
BeardPower
19:22W00t :clap:
rebolek
19:24It is self-extracting archive.
greggirwin
20:16Redbin info: http://www.red-lang.org/2015/04/053-faster-compilation-and-extended.html
20:20@dgeyser, this means we shouldn't have to worry about any external formats if all we want to do is store and exchange Red data efficiently. Be sure to read the http://www.rebol.com/article/0044.html article Doc's blog links to as well.
BeardPower
20:27@greggirwin How about securing such data against decompilation?
greggirwin
20:30From Carl's article:

> For encapsulated programs, there is also the extra advantage that developers can selectively remove symbols from the REBin symbol table. This allows commercial developers to do a better job of hiding their code
20:31As it's just data, we may also see refinements for save/load like, /secure, which add a key param.
BeardPower
21:38@greggirwin So let's assume the following:
There is a nice Red package manager call Repaman and I wrote a module called wdftlm.rm (rm for Red Module; world domination for the little man). Some user wants to download my module with Repaman and link against my module to use it within his code, but also keep it save from skiddies, not so much from very sophisticated crackers.
Can this already been pulled of with the current state of Red? Is the code sufficiently protected? /secure could be great. E.g., encrypting it with AES, fetching the key through Repaman or the like.
gltewalt
21:43No, nothing is protected right now
21:47And levels (that I’m aware of), yet
21:47Err, and no security levels
abdllhygt
22:02@9214 the questions for tomorrow, i will sleep :)
greggirwin
22:34@BeardPower, as @gltewalt says, none of that is in place today. What we don't know is how this will all play out when we get to module design. Simpler is better, and there are a lot of old systems to learn from. @roobie and I were going to look at PkgMgmt ideas at one point, as I have a lot of old notes. But consider this new world of blockchains, where SemVer and lock/pack concepts meet. How does that all work?

Your module could live in a block, behind a contract, paid or not in some form, per use or per download, source code vs encrypted, etc. The package system could build packs of components into blocks, and maybe the runtime module system can even load them side by side. When you go to debug, you may have all source or, as with natives today, be linked to a system of record, or even get a "Nope, that's a secure piece of code you're trying to view." response.
22:36How to make it easy to use, secure, and maintain is the work. But a system like this could prevent things like the NPM leftpocalypse, but also means you, as an author, may give up rights to rescind work, or that's part of the contract. e.g., no new users can be accepted, but old users continue to get access, or can get the source via escrow.
BeardPower
22:39Absolutely, the d-Ledger opens very exciting new ways.
22:40I need to research on some of the ledgers, maybe there is something tailored to "package managment". BigchainDB's ACLs could be used for it.
22:42Thank you for your insights!
22:49@gltewalt Thanks to you too!
gltewalt
23:01:+1:

Oldes
09:35What is the best way how to merge 2 map type values?
9214
09:36@Oldes extend
Oldes
09:37thanks
9214
09:37
text
>> extend #(a 1 b 2) #(c 3 d 4)
== #(
    a: 1
    b: 2
    c: 3
    d: 4
)
toomasv
16:48How to draw dashed borders?
9214
16:49@toomasv pen pattern maybe?
toomasv
16:50I can do dashed borders for boxes with pen patternbut how to do dashed borders for roundy figures?
9214
16:54*shrug* :confused:
rebolek
17:00@toomasv pen pattern does not support curves yet.
toomasv
17:00OK, thanks!
17:12Is this the correct way? Seems quite complicated.
view [
   image 245x245 draw [
      pen pattern 50x50 [
         pen off fill-pen black 
         box 10x10 35x35
      ] 
      line-width 5 
      box 10x10 235x235
   ]
]

![dashed.png](http://vooglaid.ee/red/dashed.png)
greggirwin
18:24I believe they went for R2 draw compatibility, but if we can define easier syntax, it may not be too late to change them. Are you thinking something like a pen style?
abdllhygt
18:42hi again!
9214
18:42@abdllhygt :wave:
abdllhygt
18:431+3*2 = 8
i want 1+3*2 = 7
9214
18:44@abdllhygt math [1 + 3 * 2]
18:44remember that Red doesn't have any operator precedence
18:44not even in arithmetic operations
18:44math is a mini-dialect that partially does what you want
abdllhygt
18:45thanks
18:50Mathematical operators are func ?
9214
18:50@abdllhygt no, they are op!, but you can treat them as special kind of funcs, which are infix and work only with 2 aruments
abdllhygt
18:54they aren't func but they are as func. true?
9214
18:54@abdllhygt well, yes, with a few caveats
rebolek
18:55@abdllhygt they are infix funcs
18:551 + 3 * 2 is same as multiply add 1 3 2
abdllhygt
18:57@rebolek i know as you, infix func
toomasv
18:57@greggirwin Yes, something that you can just declare for the pen. Current pen pattern (and pen bitmap) seem to work by clipping the plane which does not extend to curved lines and is rather cumbersome/messy for boxes/lines too.
abdllhygt
18:59@9214 @rebolek i'm writing tutorial. This is important, can i write func ?
9214
18:59@abdllhygt not sure what you mean
19:00can you define your own operator?
rebolek
19:00@abdllhygt f: func [x][x + 1]?
9214
19:00
text
>> my-add: make op! func [x y][x + y]
== make op! [[x y]]
>> 1 my-add 2
== 3
abdllhygt
19:02
avg: func [
      [infix] a [integer!] b [integer!] return: [integer!]
][
   (a + b) / 2
]
10 avg 6
rebolek
19:02
>> m: #(a 1 b 2)
== #(
    a: 1
    b: 2
)
>> from: make op! func [key map][select map key]
== make op! [[key map]]
>> 'a from m
== 1
9214
19:02@abdllhygt
>> avg: make op! func [x y][divide x + y 2]
== make op! [[x y]]
>> 10 avg 6
== 8
19:03[infix] is a flag from R/S and doesn't work in Red
abdllhygt
19:06I teach red in my blog for turkish. New lesson is math of red. I said that, "mathematical operators are function". This is false?
9214
19:07they're function (an infix one), but they're not function!
19:07
text
>> type? :avg
== op!
abdllhygt
19:07i see thanks
greggirwin
19:08And you can *make* infix ops from functions. But start slow. e.g. ? op!
abdllhygt
19:09I don't show op! to them
greggirwin
19:09Ah, I see I'm slow again. :^(
19:09Too much chat to keep up with.
9214
19:09@abdllhygt one thing you should really stress out is the fact that operators have precedence over functions
greggirwin
9214
19:10
text
>> add 1 3 - 2
== 2

here 3 - 2 evaluated *before* add
19:11this is the major source of headaches for some newcomers, as they think that order of precedence is add then -
19:11and that result should be... well, 2 too :D
19:12
text
>> multiply 4 3 - 2
== 4

:tada:
rebolek
19:12bingo
abdllhygt
19:15@9214 thanks. This is an important information!
19:20block! > op! > func!. True?
9214
19:20why block! is here?
abdllhygt
19:22
math [ multiply 4 3 - 2]
9214
19:23@abdllhygt yes, and? math is a function
abdllhygt
19:23before block! of math, after op!, after func!
19:24do you understand?
9214
19:24not quite
19:24inside block! given to math function operators will have arithmetic precedence
abdllhygt
19:25block! is preferential
9214
19:25block! itself is just a piece of data
abdllhygt
19:25oh i see, my example is false
9214
19:25it can't have any precedence over functions or operators
abdllhygt
19:26my new exapmle:
math [3 - 2]
9214
19:26okay, it's the same as just 3 - 2
abdllhygt
19:27yes, so first is block!
9214
19:27but block can't evaluate all by itself
19:27*function* or *operator* is what evaluates a block
19:28operators have precedence over functions, yes
19:28saying that blocks have precedence over functions and operators doesn't make any sense to me
abdllhygt
19:28so block isn't preferential everytime
9214
19:28I don't get what you mean by "preferential block" :D
19:29block is just an argument to a function
19:29what function does to a block is another matter
19:30you can't say that in 1 + 2 1 have precedence over +, right?
19:30"precedence" is defined between things that evaluate something
19:30in Red it's either functions or operators (well, rather any-function! values)
>> any-function!
== make typeset! [native! action! op! function! routine!]
abdllhygt
19:33Thank you, my english is bad, you know it :)
9214
19:33math isn't special in this regard, i.e it's just a function and follows same rules of precedence
19:34but all operators inside math block will follow arithmetic precedence
19:34because this is just how math works
19:34
text
math: func [
    {Evaluates a block using math precedence rules, returning the last result} 
    body [block!] "Block to evaluate" 
    /safe "Returns NONE on error" 
    /local rule pos op sub end
][
    parse body: copy/deep body rule: [
        any [
            pos: ['* (op: 'multiply) | quote / (op: 'divide)] 
            [ahead sub: paren! (sub/1: math as block! sub/1) | skip] (
                end: skip pos: back pos 3 
                pos: change/only/part pos as paren! copy/part pos end end
            ) :pos 
            | into rule 
            | skip
        ]
    ] 
    either safe [attempt body] [do body]
]

you can study it as a parse example btw ;)
abdllhygt
19:35i see now :)
19:35my red is bad, you know it :D
greggirwin
19:35Getting better every day though!
9214
19:35@abdllhygt just keep learning :)
abdllhygt
19:36@greggirwin @9214 yes :)
greggirwin
19:36And I wouldn't say it's bad, at all, just new to you.
abdllhygt
19:37:+1:
19:44it's prepared; http://abdllh.com/red-dersleri-4-matematiksel-islemler/
9214
19:45:clap:
greggirwin
abdllhygt
19:48the visitors of my blog don't speak turkish :)
greggirwin
19:48Not me anyway.
9214
19:49well, I can get the main ideas
abdllhygt
19:53google analytics:
turkish: "%38,46"
english: "%30,77"
chinese: "%23,08"
sv-se: "%7,69"

but all lessons are in turkish language :D
9214
19:54well, maybe they studying both Red and Turkish in your blog ;)
abdllhygt
19:57haha maybe. But they are 10 people :/ My blog is new. And the visitors came sometimes in here :)
20:20Red is ready for system programming? I have an idea about operating system.
greggirwin
20:36Yes, Red/system is the low level dialect.
20:36http://static.red-lang.org/red-system-specs-light.html
abdllhygt
20:42is it compiling as ".img" format?
greggirwin
20:43It compiles to native code.
abdllhygt
20:43what different are red and red/system?
20:44can i develop an operating system with red/system?
greggirwin
20:45Red is high level and dynamic, with lots of datatypes. Red/system is a C level language. Manual memory management, few datatypes. More efficient.

Yes, you could write an OS with it, just as you could with C.
abdllhygt
20:46thank you!
20:47without asm?
rebolek
20:47You could write an OS in Red.
20:48Red/System compiles to asm. Writing in asm can result in faster code, but may be harder.
greggirwin
20:49Compiles direct to machine code, not ASM, yes? i.e., no assembler required.
rebolek
20:49Sorry, yes
abdllhygt
20:49i know it. but can i develop an OS without asm?
9214
20:51@abdllhygt theoretically - yes
abdllhygt
20:51@9214 thanks
BeardPower
21:50@greggirwin I just found this https://www.npmjs.com/package/interplanetary-package-manager
greggirwin
21:53Cool! Seems like coming up with new project names and logos may be the biggest challenge we all face in the future.
BeardPower
21:54Yeah, sometimes this is the hardest thing 🤓
greggirwin
21:55https://github.com/red/red/wiki/Package-Management
gltewalt
21:59Reminds me of this quote:
“Many have said that one of the biggest problems with lisp is the proliferation of non-standard and incompatible mascots.”
:smile:

abdllhygt
rebolek
abdllhygt
13:36
{"} copy text1 to {"} any space {<<} any space {"} copy text2 to {"}

In parse, it doesn't work for "aaa"<<"merhaba"
rebolek
13:37
>> parse {"aaa"} [{"} copy text to {"} p: (print  p)]
"
13:37to stops at matched character
13:37you need to get past it with skip for example
9214
13:38copy text to {"} skip
abdllhygt
13:38thanks! i will study
rebolek
maximvl
13:39parse-trace is very useful for this:
>> parse-trace {"aaa"<<"merhaba"} [{"} copy text1 to {"} any space {<<} any space {"} copy text2 to {"}]
 -->
   match: [{"} copy text1 to {"} any space "<<" any space {" 
   input: {"aaa"<<"merhaba"}   
   ==> matched
   match: [copy text1 to {"} any space "<<" any space {"} co 
   input: {aaa"<<"merhaba"}   
   -->
     -->
       ==> matched
     <--
   <--
   match: [to {"} any space "<<" any space {"} copy text2 to 
   input: {"<<"merhaba"}   
   -->
     ==> matched
   <--
   match: [{"} any space "<<" any space {"} copy text2 to {" 
   input: {"<<"merhaba"}   
   ==> not matched
return: false
== false
abdllhygt
13:44@9214 @maximvl thanks! But it works when i added skip
greggirwin
17:10@abdllhygt experiment with to and thru and you'll see the difference.

Ungaretti
09:48The following code runs fine on console:
Red[needs: 'view]

funOne: has [][
a: 10
]

funTwo: has [][
a: a * 2
]
funOne
funTwo
print a


But when I try to compile it, I get an error:
C:\Users\André\Documents\ESP8266book\Isolation>red-063.exe -r -t windows Isolation.red

-=== Red Compiler 0.6.3 ===-

Compiling C:\Users\AndrÚ\Documents\ESP8266book\Isolation\Isolation.red ...
*** Compilation Error: undefined word a
*** in file: C:\Users\AndrÚ\Documents\ESP8266book\Isolation\Isolation.red
*** near: [a]


Could this be a bug or am I missing something?
rebolek
09:49@Ungaretti compiler is stricter and you need to define local words
Ungaretti
09:50@rebolek Boy that was quick!
Thank you.
rebolek
09:56@Ungaretti you're welcome :)
9214
10:44@Ungaretti you can also try to compile with -e flag, dunno if that will help
Phryxe
14:07Fiddling around with tiny examples. At first I thought I needed to-string after pad and to shorten the code I tried binding pad/left/with to-string to a word, but couldn't get it to work.

dash: #"-"
m: now/month
d: now/day - 20
iso8601: rejoin [
	now/year
	dash
	either m < 10 [pad/left/with m 2 #"0"][m]
	dash
	either d < 10 [pad/left/with d 2 #"0"][d]
]
9214
14:55@greggirwin ?
>> pad/left/with "-Jan-2018" 10 #"-"
== "--Jan-2018"
>> pad/left/with "2" 10 #"-"
== "---------2"
>> pad/left/with "25" 10 #"-"
== "--------25"
>> pad/left/with "25-Jan" 10 #"-"
== "----25-Jan"
>> pad/left/with "25-Jan-20" 10 #"-"
== "-25-Jan-20"
>> pad/left/with "25-Jan-2" 10 #"-"
== "--25-Jan-2"
14:59ah, I see
14:59date already fills 10 characters
14:59that's smart
15:00IMO it's worth to specify another refinement, in case I really want to pad with exactly 10 chars
>> pad/left/with d: now/date 10 + length? form d #"-"
== "----------25-Jan-2018"
abdllhygt
9214
18:22hi @abdllhygt
abdllhygt
18:22how to add member in array?
9214
18:22you mean block?
abdllhygt
9214
18:23append or insert
abdllhygt
18:24same?
9214
18:25no, append adds element to the tail and returns head of the series, while insert adds element at the current position of the series and returns series past the insertion
18:25
text
>> block: [1 2 3]
== [1 2 3]
>> append block 4
== [1 2 3 4]
>> block: skip block 2
== [3 4]
>> insert block 'a
== [3 4]
>> block
== [a 3 4]
>> head block
== [1 2 a 3 4]
abdllhygt
18:27thank you!
9214
18:27there're also more function that can add element to a series, like move or swap for example, but append and insert are most common
18:27@abdllhygt you're welcome! :)
abdllhygt
18:31
>> << "merhaba"
merhaba
>> << "merhaba =(9213+1)"
merhaba 9214
>> "file.txt" << "hello"
>> value: "merhaba hello"
== merhaba hello

but values don't work now.
18:33Print, Math and Writing File work
9214
18:33nice!
abdllhygt
18:39how to make a value in context?
9214
18:39@abdllhygt ?
>> context [a: 1 + 2]
== make object! [
    a: 3
]
18:39context is an alias for object
abdllhygt
18:41no, i want this:
VALUES: context []

add* [value: "merhaba"] VALUES
18:41
>>  print VALUES/value
== merhaba

9214
18:42there's extend function that, well, extends existing objects (and maps) with new key/value pairs, but currently it supports only map! datatype
abdllhygt
18:43can you show this func
9214
18:43@abdllhygt ? extend, see for yourself
18:46if possible, you can use block instead of an object
18:46and then needed, convert this block to an object with context your-block
abdllhygt
18:46i don't understand, i try as this:
extend VALUES [value: "hello"]
9214
18:46@abdllhygt as I said earlier, it does not support objects yet, only maps
18:47
text
>> m: #(a 1)
== #(
    a: 1
)
>> extend m [b 2]
== #(
    a: 1
    b: 2
)
18:47
text
>> o: object [a: 1]
== make object! [
    a: 1
]
>> extend o [b: 2]
*** Internal Error: reserved for future use (or not yet implemented)
*** Where: extend
*** Stack:
abdllhygt
18:48sorry i understand, i didn't know map
18:54
a: "value"
b: 10
extend m [a b]

it doesn't add "value" and 10, it add a and b :/
9214
18:54extend m reduce [a b]
abdllhygt
18:55thanks!
9214
18:55remember that blocks are nothing more than data and that you need explicitly evaluate expressions in them to get what you want
abdllhygt
18:58:+1:
dander
20:47@abdllhygt you can't add new words to an existing object, but you can create a new one that extends it
>> o: object [a: 1]
== make object! [
    a: 1
]
>> o2: make o [b: 2]
== make object! [
    a: 1
    b: 2
]
9214
20:48@dander it doesn't modify the original, but creates a modified copy
20:48i.e. uses original as a prototype
20:49from @abdllhygt's description it seems that he want to modify original data structure
20:49I think it's easier to use just block and append
dander
20:49that is what I meant to say, if it wasn't clear. Just another option if you are using object for whatever reason
9214
20:50@abdllhygt if you don't need a context to bind words to (and if you don't understand what bind is), try to use block! instead
dander
20:50it seems like the default choice should generally be "use blocks, unless you need something more". Keep it simple
Ungaretti
22:38@9214 Yes, compiling with -e flag worked! Where did you come up with -e flag? This thing isn't even documented in Red's github! What is it?

greggirwin
07:46@Ungaretti I thought it had made it to the readme. -e means "encap" which works like rebol did. So you get a single EXE but all code is internally interpreted, so any issues that are compiler limitations can be worked around.
9214
07:59it's not documented because Doc considers it to be experimental feature and a subject to change
abdllhygt
10:22I guess;
@dander object isn't usable, because i need one thing for to shelter data.
@9214 block isn't usable, because; the value name should be unique.
rebolek
10:51@abdllhygt so use map!
abdllhygt
10:54@rebolek yes
12:34hi again!
12:34how to add button in view?
rebolek
12:35hi :)
12:40for example view [box 0x300 button "add button" [append face/parent/pane layout/only compose [at (0x30 + select last face/parent/pane 'offset) button "new one"]]]
abdllhygt
12:45thanks but i don't understand somethings. face/parent/pane => ofbox? and others...
12:45do you know examples webpage about this?
rebolek
12:46box 0x300 is there just to make windows taller, so you could see added buttons.
12:46face/parent/pane refers to pane where new buttons should be added
abdllhygt
12:49thanks, where do you learn it?
rebolek
12:51See [Rebol/View documentation](http://www.rebol.com/docs/view-guide.html). There are differences, but overall it's very similar.
abdllhygt
12:53@rebolek thanks!
9214
13:03@abdllhygt you want to add button dynamically or just create an interface with button?
15:34is it possible to force parse collect to keep one char string instead of just one char?
str: "ABC[DE][SG[HI[JK]L]MNO]"

set [push pop]["[" "]"]
node:   [not [push | pop] skip]
edge:   [collect some [keep some node | branch]]
branch: [push edge pop]

probe parse str edge

["ABC" ["DE"] ["SG" ["HI" ["JK"] #"L"] "MNO"]]
15:37I know that I can hack my way around with
15:38
text
edge:   [collect some [copy n some node keep (form n) | branch]]
15:38but still
15:39ah, it's even easier
edge:   [collect some [copy n some node keep (n) | branch]]

["ABC" ["DE"] ["SG" ["HI" ["JK"] "L"] "MNO"]]
abdllhygt
17:29@9214 just create :) thanks
9214
17:29@abdllhygt then something like view [button "click"] will do
abdllhygt
17:31@9214 no, i want to create button when i clicked other button
rebolek
17:31then see my code above :)
9214
17:32this is what I called "to dynamically add button" :joy:
abdllhygt
17:33@rebolek i can't understand yours :)
rebolek
17:35@abdllhygt it's quite easy :) But I should probably split it into separate functions, so it will be more clear.
abdllhygt
17:37@rebolek maybe i will use ruby for web programming, if i don't make, then i return gui programming :)
rebolek
17:39@abdllhygt ok, it's up to you :)
DideC
21:40@abdllhygt faces are objects.
in an actor, facerefer to the face that run the function code (the first param of the actor function). Kind of self or this in other languages. face/parent point to the face that contain the current face.
face/pane is a block where are stored the sub face of a face.
So : win: layout [button "bip"] produce an object!. The word! win is set to it, and win/paneis a block with one element: yes, the "bip" button.
And then, in an actor code, face/parent/pane means "the faces that are near myself in the face tree".
Hope this help you understand a bit more above Rebolek's code.

abdllhygt
13:10@DideC thanks!
Ungaretti
13:14I found that the -e compiling option is essential. Not only it solves the "global variables inside functions" problem, but also solves an issue I was having where I had to close one view and open another layout. This only worked with -e option. Thanks for that @9214 !
9214
13:15@Ungaretti does this issue appear only after compilation?
Ungaretti
13:16Yes, on console it works fine.
9214
13:17okay then, it's a limitations of current bootstrap-phase compiler, IIRC Doc mentioned that most of them will be mitigated with JIT-compilation and features in dyn-stack branch
13:18@Ungaretti if you think that the issue you have looks like a bug, it's worth to be mentioned and reported
Ungaretti
13:21Also, on my trials, before the magical -e , I had to remove all print(debug) statements from the code to make it work. I'm not sure if -e would have solved that too.
I'll try to isolate it to report a bug.
9214
13:22I can't remember fully, but there's a reason why probe and print wreck havoc after compilation
13:23but they should work once script is encapped
Ungaretti
15:41@9214 No, it was not a bug. While trying to isolate it, I found that I left behind some print statements in the code. They were "in between" views for debugging, hence the crash. My code seems to compile fine now even without the -e option.
9214
15:53@Ungaretti IIRC you can also try compilation as usual with [Options: [red-strict-check?: off]] added to a script header
15:54it should resolve an issue with "global variables" as far as I remember
Ungaretti
17:50@9214 Interesting. I'll try that. Thanks. Where do I put that option? at the Red header?
18:04I mean, like "Red [needs: 'view Options: [...]]"?
9214
18:04@Ungaretti yes
18:11you can write just [needs: view] btw, without lit-quote
abdllhygt
9214
18:18@abdllhygt hi Abdullah :)
abdllhygt
18:18how to keep member of map?
9214
18:19@abdllhygt can you show an example?
abdllhygt
18:20
xmap: #(a b)
xkeep: "a"
print xmap/(load xkeep) ;-- for print b
9214
18:21you're already showed how to do what you want, what's the problem?
>> load "a"
== a
>> m: #(a b)
== #(
    a: b
)
>> m/a
== b
>> m/(load "a")
== b
abdllhygt
18:22my method is true? :)
9214
18:22sure :)
abdllhygt
18:22==none :/
18:23i will look now
18:26oh i do an error in parser :/ now it's okay :)
Ungaretti
18:34I have a drop-down. During execution, I change drop-down/data to add new items. But my drop-down does not seem to update by itself at the view. Is there a way to do a "refresh" on a face?
9214
18:35@Ungaretti https://github.com/red/red/issues/3153
18:35I believe @toomasv hacked his way around this somehow
18:37https://gitter.im/red/red/gui-branch?at=5a3aac75a2be466828c64598
Ungaretti
18:38@9214 How can you remember all this things? I can't remember what I had for breakfast! Thank you again.
9214
18:39@Ungaretti
https://www.youtube.com/watch?v=BSUMBBFjxrY
Ungaretti
18:43:laughing: Come on! You don't write it all down...
... do you? :confused:
abdllhygt
18:48My programming language on console:
?? Programlama Dili
Versiyon 0.0.2

>> numHello: "=(12+5*9) hello"
== 153 hello
>> << numHello
153 hello
>> newH: numHello
== 153 hello
>> "write_file.txt" << newH
>> .
(kapandı)
(halted)
9214
18:50@abdllhygt that's cool!
abdllhygt
18:51@9214 thanks. How to use colorful words on console?
9214
18:52@abdllhygt you mean syntax highlighting?
abdllhygt
9214
18:52it's not in Red console yet, but there's some work on that in 0.6.3 engine
abdllhygt
18:53but before i want for first >>
9214
18:53https://twitter.com/red_lang/status/817332739372265472
abdllhygt
18:53i see :/
18:54so on windows
9214
18:55demonstration is on Windows, yes, but I believe new GUI console will be cross-platform
abdllhygt
18:55what is GUI console?
18:56VIEW console :D?
9214
18:57@abdllhygt Red console that uses OS graphical components instead of bare-bone terminal
abdllhygt
18:58so, red console use terminal, doesn't use window, true?
9214
18:59it can use both, except for Linux
abdllhygt
19:00new console supports linux?
9214
19:00maybe, I don't know details
abdllhygt
19:04thanks
19:10how to compile red with ask? i try:
#include %environment/console/input.red, but doesn't work :/
9214
19:10@abdllhygt https://github.com/red/red/wiki/Guru-Meditations#how-to-compile-ask
19:10use -r flag
abdllhygt
19:12
*** Compilation Error: word terminate not defined in system/console/terminate 
*** in file: /home/abdllh/yyorum/main.red
*** near: [system/console/terminate]

in linux without wine
9214
19:14@abdllhygt can you try to compile with -e and -r flags?
abdllhygt
19:14yes, -r flag
19:15i don't use -e
9214
19:15@abdllhygt well, now add -e flag and try again
19:15not sure if that will help though
abdllhygt
19:17it doesn't work, i did try with wine, it's okay.
9214
19:17you can come up with basic I/O interface using View I think
abdllhygt
19:20it's not necessary now :) why ask is a problem in red? this is bad, very bad :/
Ungaretti
22:47When I use the checksum function with SHA256, I get something like #{D4...} . What is this #{...} datatype? Can I extract the hexadecimals from it as a string?
9214
22:48@Ungaretti it's a binary! datatype, which is basically a series of bytes (integer!s)
22:50
text
>> b: #{deadbeef}
== #{DEADBEEF}
>> b/1
== 222
>> b/2
== 173
>> to binary! b/1
== #{000000DE}
>> to binary! reduce [b/1]
== #{DE}
>> enbase/base to binary! reduce [b/1] 16
== "DE"
Ungaretti
22:53@9214 Thanks.
endo64
23:01And for extracting hexadecimals:
head remove back tail remove/part form #{deadbeef} 2 ;== "DEADBEEF"
or easier trim/with form #{deadbeef} "#{}"
9214
23:03
text
>> form to-hex to integer! #{deadbeef}
== "DEADBEEF"
endo64
23:13@9214 but this doesn't work with result of checksum or similar longer binary values.
9214
23:14@endo64 1 : @9214 0 :)
23:31
text
>> enbase/base #{deadbeef} 16
== "DEADBEEF"
endo64
23:42Interesting, I thought enbase could be faster:
>> profile/show/count [_9214 _endo] 10000000
Count: 10000000
Time         | Time (Per)   | Memory      | Code
-0:00:00.051 | 0:00:00      | 0           | _9214
-0:00:00.051 | 0:00:00      | 0           | _endo
23:42
_9214: [enbase/base #{A94A8FE5CCB19BA61C4C0873D391E987982FBBD3} 16]
_endo: [trim/with #{A94A8FE5CCB19BA61C4C0873D391E987982FBBD3} "#{}"]

23:43Hmm sometimes it's faster
-0:00:00.133 | 0:00:00      | 0           | _endo
-0:00:00.114 | 0:00:00      | 0           | _9214

JiaChen-Zeng
06:16How to draw an arc in Shape dialect? I tried

view [ box draw [ shape [ arc 10x10 10 10 90 ] ] ]


It shows nothing.
endo64
06:40You need to use move before arc I think, this one works:

view [ box draw [ shape [ move 50x50 arc 10x10 10 10 90 ] ] ]
06:40[![image.png](https://files.gitter.im/red/help/rPi1/thumb/image.png)](https://files.gitter.im/red/help/rPi1/image.png)
JiaChen-Zeng
06:44@endo64 Thank you!
06:50I find that whatever degree I set, the arc remains the same?
06:54And radius-x and radius-y seems reversed.
toomasv
07:26@AT-Aoi Some [examples](http://vooglaid.ee/red/arcs.png):
view [image 200x100 draw [
   shape [move 20x60 arc 20x80 10 50 45] 
   shape [move 20x60 arc 20x80 10 50 45 large sweep] 
   shape [move 120x15 arc 120x35 50 10 45] 
   shape [move 120x15 arc 120x35 50 10 45 sweep large]
]]

![arcs.png](http://vooglaid.ee/red/arcs.png)
JiaChen-Zeng
07:35@toomasv Thank you. Now I understand.
toomasv
07:36@AT-Aoi You are welcome! :)
08:06Still [playing](http://vooglaid.ee/red/arcs2.png):
view [image 250x200 draw [
   fill-pen brick shape [move 70x110 arc 70x130 10 50 45 large sweep] 
   fill-pen gold shape [move 70x110 arc 70x130 10 50 45 large] 
   fill-pen red shape [move 70x110 arc 70x130 10 50 45] 
   fill-pen beige shape [move 70x110 arc 70x130 10 50 45 sweep]
   
   fill-pen brick shape [move 170x65 arc 170x85 50 10 45 sweep large]
   fill-pen gold shape [move 170x65 arc 170x85 50 10 45 large]
   fill-pen red shape [move 170x65 arc 170x85 50 10 45] 
   fill-pen beige shape [move 170x65 arc 170x85 50 10 45 sweep] 
]]

![arcs2.png](http://vooglaid.ee/red/arcs2.png)

gltewalt
05:11Should _read-input be exposed to Red console?
05:11
>> _read-input "!"
!_read-input "!"
== "!"

*** Runtime Error 1: access violation
*** at: 770A3208h
05:11Crash happens after pressing Enter
05:12Visual Studio says:
Unhandled exception at 0x770A2EE5 (ntdll.dll) in console-2018-1-23-59513.exe: 0xC0000005: Access violation reading location 0x005F006D. occurred
07:16IS it exposed? Or is this due to my slightly modified console?
rebolek
07:19I can confirm that it is exposed.
gltewalt
07:29Should ask and input be actions functions?
07:32blah... that probably didn't make sense. Time for bed
rebolek
9214
07:40they can't be actions
gltewalt
07:45disregard hallucinations
JiaChen-Zeng
12:28May I ask where does the t of facet come from?
mydoghasworms
12:29[![image.png](https://files.gitter.im/red/help/wIi2/thumb/image.png)](https://files.gitter.im/red/help/wIi2/image.png)
12:30It means as much as "aspect" or "feature", so it's not the same as "face" :-)
BeardPower
12:32>Her friendliness is just one facet of her personality.
12:33>Life has many facets.
JiaChen-Zeng
12:34@mydoghasworms @BeardPower Thank you. I thought it was an abbreviation.
BeardPower
12:35You're welcome. Red just tries to keep a natural language flow.
12:38Like depictions of familiar objects and terms. Ports, views, facets...
9214
12:39dialects
BeardPower
12:39Exactly.
12:42Can't even live without the different data types any more :smile:
endo64
12:44> @mydoghasworms @BeardPower Thank you. I thought it was an abbreviation.

I've been using Rebol since 1999, and all this time I thought it was an abbreviation :)
BeardPower
12:45@endo64 Knowledge comes better late than never. ;-)
9214
12:45@endo64
https://www.youtube.com/watch?v=a1Y73sPHKxw
gltewalt
15:51Facets modify a Style
15:52Styles describe Faces
15:53Faces are graphical objects
9214
15:53@9214 https://www.youtube.com/watch?v=euCb8hhw2Nc
gltewalt
16:00I thought it might be Face(<t>ransform style)
9214
16:01some of the Redbol terminology's meaning is lost in translation
16:02faces, facets, mezzanines
endo64
20:31mezzanine is also a weird word for people like me, non-native English speakers,
when I look at dictionary it means kinda "balcony" or "clerestory" in Turkish which doesn't mean anything to me in context of a programming language.
BeardPower
20:36It's origin is italian: mezzo; half. Mezzanine capital.
rebolek
20:38I like it. mezzanine means mezipatro in Czech, space between floors. It accurately describes the purpose of mezzanines, they are between the native "floor" and user "floor".
DideC
20:39In french, it is a level you build in between a floor, like children bed up to it's desk:
![Mezzanine](https://s1.qwant.com/thumbr/0x0/3/9/8811fa2327897df33142a05cf1e0df/b_1_q_0_p_0.jpg?u=http%3A%2F%2Fwww.espace-loggia.com%2Ffiles%2F_gammes%2Flits-mezzanine%2Fphotos-gamme%2Fgamme-mezzanine-grand.jpg&q=0&b=1&p=0&a=1)
So in rebol, it as the sense thats it's something build a level up to the core, cause its based on the few natives.
BeardPower
20:40A name for higher level functions that are a standard part of the language. These are not native functions. They are between native functions and routines.
20:42In German: Halbgeschoss
BillDStrong
20:42Adjective

mezzanine (not comparable)

(engineering) Fulfilling an intermediate or secondary function.

To make interconnections easier, we added a mezzanine PCB.

20:43Per Wikitonary
BeardPower
20:43Little helper functions.
PeterWAWood
22:53This is the definition of mezzanine functions from the Rebol User Guide:

**Mezzanine** A name for higher level functions that are a standard part of the language. These are not native functions.
22:54So mezzanine functions are those functions included in the Rebol binary that are written in Rebol not C.

The distinction between a function being written in Red and/or Red/System is not so black and white.
22:56Probably the best definition of a **Red Mezzanine** is a function included in the binary that does not require compilation to run.
gltewalt
23:21I don’t think it’s a good name to carry over.
PeterWAWood
23:31I agree. I think we should think more in terms of Red **core functions** and a **standard library** for Red.

BeardPower
00:01Isn't the description misleading, as it does not return an integer?
> Returns the nearest integer. Halves round up (away from zero) by default.

>> round 45 * 11%
== 5.0


00:01It should return 5
9214
05:54@BeardPower this was discussed some time ago
05:54bear in mind that round works not only with numbers
05:55
text
>> round/to 45 * 11% 1
== 5
rebolek
05:56@BeardPower IMO the description is misleading and should say *to nearest integer **value***.
9214
05:58https://gitter.im/red/bugs?at=5a5b5c52290a1f4561889cfa
greggirwin
08:48@rebolek submit a ticket or PR for that. It won't solve all confusion, but maybe some.
08:49Mezzanine is not used by other langs, but it's a suitable word. Another fun one, which *is* used in some other CS contexts, is *trampoline*.
rebolek
08:50@greggirwin Ok, I will do PR.
9214
08:50whenever I hear *orchestration* or *pythonistas* I want to punch someone in the face really hard
pekr
08:53@rebolek there was enough of PR lately, do some code instead :-)
rebolek
08:55@pekr :D
greggirwin
09:01@9214 , is an orchestration of Pythonistas like a crash of rhinos, or a murder of crows?
9214
09:01@9214 doesn't want to punch Gregg so he punches himself
greggirwin
09:02Oooohhh, now I feel responsible and want to punch myself.
09:03How do you feel about overarching Rubyists?
09:04OK. Time for bed. Just had to check in because I miss you all. :^)
9214
09:04awww

JiaChen-Zeng
11:14> Deferred mode updates many changes at the same time on screen in order to avoid glitches or when best performance is the goal.

What does "glitches" here mean?
9214
11:43@AT-Aoi graphical artifacts
toomasv
11:44@AT-Aoi Compare performance of these two snippets. Drag face to left border and move it up and down:
system/view/auto-sync?: on
view [base teal loose on-drag [if face/offset/x < 0 [face/offset/x: 0]]]

system/view/auto-sync?: off
view [base teal loose on-drag [if face/offset/x < 0 [face/offset/x: 0 show face]]]

First glitches, second not. At least on W10.
JiaChen-Zeng
11:48Let me try...
11:51Thanks! Easy to understand.
toomasv
11:51You are welcome!

dander
00:44@endo64 As a native English speaker, I had some trouble with mezzanine when I encountered it first as well. Now it has more meaning to me in Redbol than the vague meaning of a balcony-ish thing.
BeardPower
02:54Just to throw in my 2 cents: it's used a lot in financials. Please excuse me for getting too much off topic here, but maybe this article/video helps you a little more in understanding this term https://www.investopedia.com/terms/m/mezzaninefinancing.asp6
gltewalt
03:17404 for me
Phryxe
04:42Should be .asp, not .asp6.
gltewalt
07:27Oh yeah. :smile: didn’t even notice
mydoghasworms
07:53So "mezzanine" originally refers to a low storey between two storeys in a building according to the OEM: https://www.etymonline.com/word/mezzanine. The term has been adopted elsewhere: https://en.wikipedia.org/wiki/Mezzanine_(disambiguation) for meaning something in the middle, intermediate, or something that bridges other things. It sounds like a good choice of word for what other languages term their "standard library". (That is what the mezzanine functions in Red are, I'm assuming).
07:54It seems that Red and Rebol not only enrich your programming skills, but give you an English lesson at the same time :-)
rebolek
endo64
14:45@mydoghasworms could "intermediate functions" be better in that matter. Also as @PeterWAWood mentioned Probably the best definition of a Red Mezzanine is a function included in the binary that does not require compilation to run.
BeardPower
16:21Oops, how did that 6 got in there... Unfortunately the edit possibility timed out.
dander
17:49I think the usage of mezzanine makes sense given its meaning, and there probably aren't many single words (maybe none?) that can fit that role. It just isn't part of my normal lexicon. I think if there are more common words that fit, and aren't ambiguous, it could make sense to use one of those instead. But there is also a big benefit to terms which are concise and have precise meanings. There are a lot of other jargony CS terms (more common in other languages) that I would apply to this situation, like context, proxy, semaphore, etc. etc. I wonder if other languages just don't really have the same 'layer' of things to talk about...
All this crypto stuff is exposing me to lots of financial terms that I never really understood too.
gltewalt
19:13I’m with @PeterWAWood - think in terms of core functions and standard library
greggirwin
23:27Words are hard. Mezzanine may be new to a lot of people, but we can clearly define it. We started a glossary at one point, which we need to pick back up. "Mezz" is also a nice, unambiguous abbreviation. And when some of them are works in progress, we can say they're a bit "mezzy" (messy).

gltewalt
00:01Why would you want to clearly define it? It applied to Rebol code that came as part of the “standard library”, so to speak. A distinction between C and Rebol code.
Does that model apply to Red?
BillDStrong
00:03Difference between if it is Red/System code, or Red code?
gltewalt
00:39I don’t know. Folks are ready to refer to it as Red or Red/System (or system code)
greggirwin
01:39See, already some confusion. ;^)
gltewalt
01:49They don’t refer to C as mezzanine in a ASM / C system do they?
greggirwin
02:14No, because the two are unrelated. In Red, we're talking about where things live in a *system*, more than what language they're written in. Their *conceptual* position.
BillDStrong
02:16On that note, it isn't a library, as a library is external to the langauge. So Mezzanine is more descriptive than Standard library?
greggirwin
02:18We have a lot of terms, and there will be overlap in how things are implemented. You could, for example, have a library of related functions, dialects, etc. or a module that contains mezzanines which span multiple domains.
02:19We need documentation describing all this. ;^)
gltewalt
02:19No mezzanines
greggirwin
02:19@gltewalt, what does that mean?
JacobGood1
02:20@greggirwin eta on the blog post?
gltewalt
02:20Means I don’t want the term.
02:20I’ll call them Snorks.
greggirwin
02:21@JacobGood1, we'll try to have it out early next week. Nenad still has some travel stops to make.
02:21@gltewalt, make a constructive suggestion for an alternative.
BillDStrong
02:21Call them Smurfs. Each is named after the job they do.
JacobGood1
02:22@greggirwin by your estimation, did Carl have some exciting things to say?
greggirwin
02:23@JacobGood1, yes. :^)
02:23The Rebol def of mezzanines is:

> Mezzanine: A name for higher level functions that are a standard part of the language. These are not native functions.

From http://www.rebol.com/docs/core23/rebolcore-9.html
JacobGood1
02:23as long as that is not a Pinocchio nose... good
greggirwin
02:24My nose is big, but not growing.
02:26So we could say that functions may be promoted to mezzanine status when they become a part of the standard runtime, until then they are just functions. Just by changing their status, what I referred to as their position above, they get a promotion and a new name.
gltewalt
02:27Isn’t that the same as standard library?
greggirwin
02:30Do we have a "standard library"? I don't like it. I think I'll call it gargle-flum. ;^)

If we say "standard library", do we then care about the distinction between actions, natives, ops, and functions? And what do you then call functions that are part of the standard library, to distinguish them from functions that aren't?
gltewalt
02:32Builtins
greggirwin
02:32Look at the Rebol page I linked to above. Consider that Carl put a *lot* of thought into that, just the section describing the *types* of functions we have. Now, come up with something better.
gltewalt
02:34Are there any other programming language uses the term mezzanine?
02:34Er, ‘that use the term mezzanine’
02:35(Mobile strikes again)
greggirwin
02:36Do we want to do things just because other languages do? Do they have similar concepts in the types of functions available? If people want to learn Red, they'll need to learn new concepts and terms. Others will come up with analogous concepts, but *we* need to define the best term for Red.
gltewalt
02:37That term isn’t necessarily a holdover from Rebol
greggirwin
02:38On "builtin" vs "mezzanine", builtin isn't a real word. Details.
02:38Not sure what you mean. Rebol used the term, and so do we. Seems like an inherited trait to me.
gltewalt
02:40I haven’t seen it used here in Redland, outside of a few mentions on the homepage. (I think that’s where it was)
BillDStrong
02:41There is a whole room here on Gitter devoted to it. Red/Mezz
greggirwin
02:41@BillDStrong +1
gltewalt
02:41I thought that was for a guy named Mezz
JacobGood1
02:42it does not really seem like something worth arguing for
greggirwin
02:43Mezzistopheles, yes. Be careful when he offers you a great deal for your function.
02:43@JacobGood1, words are the things we discuss more than anything . :^)
gltewalt
02:45I’ll probably get used to it
greggirwin
02:47Yup. Maybe we can write a mezz called mezzmerize that converts a plain old func to a mezzanine when it is brought into the fold (for @JacobGood1).
sergeantWilson
16:01Hi, I read somewhere about encap -e in Red, but cannot find any info on it, is this possible? If so, are there any examples, thanks
JacobGood1
16:06@greggirwin don't mezz with me now...
endo64
16:16I have no problem with the word mezzanine, but some times its difficult for me to write or read (pronounce) when I try to explain what it is to someone new to Redbol.
I usually explain them as "builtin functions in the language but the ones you can see their sources, not like print or read, as they are natives"
9214
16:20@sergeantWilson hi, it's an experimental option. Just supply -e or --encap flag among with -r or -c flags during compilation
16:20e.g. ./red -r -e -t WindowsXP ./script.red
sergeantWilson
16:28thanks @9214 - In Rebol it was possible to encap images and files along with the script, as a sort of container. Can that be done ?
9214
16:41@sergeantWilson I think you can embed all the necessary data inside scripts themselves as binary!, but that's kinda ugly
sergeantWilson
16:48@9214 yes I have done that base64 but only one image makes the script to long. Why I was hoping it might be possible to encap files.
planetsizecpu
16:49@sergeantWilson [here](https://github.com/planetsizecpu/alert) you have an example
9214
16:50-e option just forces script to be interpreted on launch, rather than statically compiled, that way you can bypass some limitations of current compiler
https://github.com/red/red/commit/3ccd217b7ca62ec38619db8a0a2cb6743ee3e794#diff-79938e092d331e67d7ce1e29b39d6045
sergeantWilson
16:57@planetsizecpu @9214 thanks for your help
planetsizecpu
17:00@sergeantWilson you're welcome
greggirwin
19:34Red has a preprocessor, which can help: https://doc.red-lang.org/en/preprocessor.html

https://gist.github.com/greggirwin/f8b39af02096a7f65849275e7377be83

One thing we don't have in there yet is an #include-binary directive, which would make it easier to include things like images directly from their source files. Ladislav's include func for Rebol has that, and I imagine Red can support it without too much effort. If there's no ticket for it, someone could create one.

JiaChen-Zeng
06:46From [the documentation of date!](https://doc.red-lang.org/en/date.html#_runtime_creation):

> year and day fields are interchangeable, but only for low year values. The year can be used in first position **only** if its value is >= 100 and less than the value of the third field. When that rule is not satisfied, the third field is considered the year. Negative years should always be specified in the third position.

How can the year be >= 100 and less than the third field? The third field is supposed to be year or day. If year is used in the first position, then the third field is day, which ranges from 1 to 31, so year(>=100) must greater than day in this case, right?
toomasv
07:18@AT-Aoi Agreed, this doesn't make sense. (Logically, it says year can never be in the first position) Besides, year *can* be smaller than 100 on first place, e.g. 001-1-31 and at the same time greater than the value of the third field, e.g. 032-1-31.
>> 001-1-31
== 31-Jan-0001
>> 032-1-31
== 31-Jan-0032
10:47OK, document speaks about runtime creation with make, and this indeed doesn't accept year values < 100 in the first position.
11:07@AT-Aoi I think I got it: The confusing remark applies to the syntax with to date!, where day in third position can be day-of-the-year, e.g.:
>> to date! [365 1 364]
== 30-Dec-0365
>> to date! [363 1 364]
== 28-Dec-0364

But still, number in the first position is interpreted as year only if it is **greater** than number on the third position:
>> to date! [100 1 101]
== 10-Apr-0101
>> to date! [101 1 100]
== 10-Apr-0101

JiaChen-Zeng
12:23Indeed. Thank you for your help. @toomasv
toomasv
12:24@AT-Aoi You are welcome!
JiaChen-Zeng
12:26I'll open a ticket for this.
9214
13:06is there a more idiomatic way to write the following parse rule?
[set word something | (word: none)]

i.e. if pattern matched - set word to it, otherwise, if match failed, set word to none
toomasv
18:03@9214 How about
>> parse [anything] [set word ['something | none]]
== false
>> word
== none
>> parse [something] [set word ['something | none]]
== true
>> word
== something
9214
18:05@toomasv that's interesting, I tried that but either messed up or it didn't worked, lemme re-check
18:06the problem is that none doesn't advance the input
18:06
text
>> parse ["a" "b"][set x [string! | none] string!]
== true
>> x
== "a"
>> parse [1 "b"][set x [string! | none] string!]
== false
>> x
== none
toomasv
18:07@9214 Brr... was just going to suggest it (i.e. the (deleted) none skip - did this not work? Jee, it eats anything)
9214
18:09@toomasv :(
>> parse [1 "b"][[set x string! | set x none skip] string!]
== true
>> x
== none
18:09set eats skiped value
18:09i.e. instead of being setted to none x is setted to 1 in the example above
18:11:muscle:
>> parse ["a" "b"][set x opt string! string!]
== true
>> x
== "a"
>> parse [1 "b"][set x opt string! string!]
== false
>> x
== none
18:12which is kinda surprising :smile:
toomasv
18:13I usually set the word to none somewhere before parse or in parse before checking interesting parts, e.g.:
>> x: y: z: none parse [1 "b"][some [set x string! | set y integer! | set z block!]]
== true
>> probe reduce [x y z]
["b" 1 none]
18:15Alternately:
>> parse [2 [a b]][(x: y: z: none) some [set x string! | set y integer! | set z block!]]
== true
>> probe reduce [x y z]
[none 2 [a b]]
9214
18:16yes, that was my though too
endo64
18:44I didn't follow the whole conversation but, none always returns success, a catch all rule.
parse [1 2 3] [some none some integer!] ;== true
something like, it just skips the rule without advancing the input position.
9214
18:46@endo64 I know that, that's why none alone won't cut it
18:46something needs to match anyway for parsing to continue
greggirwin
19:42> I usually set the word to none somewhere before parse or in parse before checking interesting parts

That's what I've done in the past as well.
19:42It's not as concise, but it's clear.

koba-yu
11:29Hi, is using a block as hash's key not expected?
I tried the code below,

hash: make hash! [[1 2] "value"]
blk: [1 2]
equal? hash/1 blk ; return true
select hash blk   ; return none


I expected the last select can find "value", but not sure it is reasonable.
(I have checked Rebol, it does the same above)
rebolek
11:31Using block! as key is forbidden in map!s so I guess hash! works similar in this regard.
9214
11:33@koba-yu select/only
11:33
text
>> select/only make hash! [[1 2] "value"][1 2]
== "value"
11:34or select/only/skip ... 2, which is better if you want to use hash as key-value storage
rebolek
11:34Cool, I stand corrected. Then I don't understand why we can't have blocks as keys in maps also.
9214
11:35something to do with lookup efficiency
rebolek
11:36not a problem for hash?
9214
11:36*shrug*
11:38@rebolek https://github.com/red/red/issues/3084
11:38does that mean that usage of hash! instead of block! in such cases is ineffective?
11:42or are they identical?
rebolek
11:42It does. I've tested it and it's the same speed as block!.
9214
11:42:+1: good to know
koba-yu
11:42@9214 @rebolek Thank you for your answers!
9214
11:42@koba-yu you're welcome

toomasv
08:10I am confused about usage of the path! type in blocks. It seems it cannot be found in block nor used for selecting in block.
>> q: 'a/1
== a/1
>> d: [a/1 x]
== [a/1 x]
>> q = d/1
== true
>> find d q
== none
>> find d 'a/1
== none

rebolek
08:11Maybe you should report it.
toomasv
08:12Neither does Rebol find path in block!
rebolek
08:15This really doesn't look like expected behaviour:
>> find d first d
== none
9214
08:16@toomasv find/only
08:16remember that path! is a series
toomasv
08:16@9214 Ahh, thanks!
9214
08:17
text
>> q: 'a/1
== a/1
>> d: [a/1 x]
== [a/1 x]
>> q = d/1
== true
>> find/only d q
== [a/1 x]
>> find/only d 'a/1
== [a/1 x]
08:34does print supposed to output something in console after compilation?
rebolek
9214
08:37e.g. if I compile print system/script/args and launch executable from shell with some arguments, it should print them back, right?
rebolek
08:41@9214
~/C/red ❯❯❯ ./delme asdf
asdf
08:41source:
Red[]
print system/script/args
9214
08:42yes, but more complicated script which I use, once compiled for Windows and launched under Wine, crashes
rebolek
08:44And it crashes when printing args?
9214
08:44@rebolek apparently yes
08:44I'll try to narrow down this case
08:45yup
isheh@sam ~/dev/red $ ./scratchpad 123
123
isheh@sam ~/dev/red $ wine ./scratchpad.exe 123
fixme:dwmapi:DwmIsCompositionEnabled 0x33fdc0

*** Runtime Error err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x4161db
08:46I also checked my script on Win7, no output
08:46though before compilation everything works fine
08:46i.e. from interpreter
rebolek
08:47Do you compile with MSDOS or Windows target?
9214
08:47WindowsXP
08:47because there's an option to use GUI interace, i.e. if no arguments were supplied, a window will pop up, otherwise it will work in CLI mode
08:49it works with MSDOS as a target
isheh@sam ~/dev/red $ wine ./scratchpad.exe 123
fixme:dwmapi:DwmIsCompositionEnabled 0x33fdc0
123
08:50but then with MSDOS GUI won't work?
rebolek
08:51Hm, I've got crash too with WXP as target:
~/C/red ❯❯❯ wine delme.exe
0009:fixme:dwmapi:DwmIsCompositionEnabled 0x32fe40

*** Runtime Error 0009:err:seh:raise_exception Unhandled exception code c0000005 flags 0 addr 0x416203
9214
08:52@rebolek can you check it on your W10 Vbox?
08:52maybe it's Wine-specific, though, again, I checked it on Win7 without success
rebolek
08:52@9214 not now, sorry. In the evening.
9214
toomasv
11:11@9214 I can try on W10. Tell me what to do. I am total newbe in compilation.
rebolek
11:13@toomasv If you have Rebol installed, run it and type in console: do/args %red.r "your-program.red"
9214
11:13@toomasv create script with
Red []
print system/script/args

in it, then call toolchain with -c flag (you can also try -r), e.g. red.exe -c script.red
11:14then check if it works with script blah-blah from cmd
rebolek
11:15You can ignore arguments, it crashes without them also.
9214
11:15I think it crashed because of print
rebolek
11:15That's possible.
9214
11:16if no argument supplied, system/script/args is just "", but it will be printed anyway
11:16I mean print will be called in any case
rebolek
11:16Right.
toomasv
11:18
C:\Users\Toomas\Documents\Red>red.exe -c script.red

-=== Red Compiler 0.6.3 ===-

Compiling C:\Users\Toomas\Documents\Red\script.red ...
Compiling libRedRT...
...compilation time : 1666 ms

Compiling to native code...
...compilation time : 47907 ms
...linking time     : 544 ms
...output file size : 960512 bytes
...output file      : C:\Users\Toomas\Documents\Red\libRedRT.dll

...compilation time : 31 ms

Target: MSDOS

Compiling to native code...
...compilation time : 1387 ms
...linking time     : 82 ms
...output file size : 67072 bytes
...output file      : C:\Users\Toomas\Documents\Red\script.exe
9214
11:18ah, it takes MSDOS as default, okay
11:18does it work?
toomasv
11:20
C:\Users\Toomas\Documents\Red>script.exe
none
9214
11:20so it's none instead of "" :confused:
rebolek
11:21try WindowsXP as target
9214
11:21@toomasv could you please retry with -c -t Windows ?
11:21and then WindowsXP, yes
toomasv
11:24After including Needs: View in the header:
C:\Users\Toomas\Documents\Red>red.exe -c -t Windows script.red

-=== Red Compiler 0.6.3 ===-

Compiling C:\Users\Toomas\Documents\Red\script.red ...
...using libRedRT built on 6-Feb-2018/13:17:08+2:00
...compilation time : 22 ms

Target: Windows

Compiling to native code...
...compilation time : 1182 ms
...linking time     : 59 ms
...output file size : 67072 bytes
...output file      : C:\Users\Toomas\Documents\Red\script.exe


C:\Users\Toomas\Documents\Red>script.exe

C:\Users\Toomas\Documents\Red>

I.e. empty line returned in the end.
11:26
C:\Users\Toomas\Documents\Red>red.exe -c -t WindowsXP script.red

-=== Red Compiler 0.6.3 ===-

Compiling C:\Users\Toomas\Documents\Red\script.red ...
...using libRedRT built on 6-Feb-2018/13:17:08+2:00
...compilation time : 21 ms

Target: WindowsXP

Compiling to native code...
...compilation time : 1180 ms
...linking time     : 56 ms
...output file size : 67072 bytes
...output file      : C:\Users\Toomas\Documents\Red\script.exe


C:\Users\Toomas\Documents\Red>script.exe

C:\Users\Toomas\Documents\Red>
9214
11:26@toomasv can you try to supply some argument to WinXP version?
11:27it should print it back if everything is ok
11:27script.exe blah for example
toomasv
11:27
C:\Users\Toomas\Documents\Red>script.exe -p "hi"

C:\Users\Toomas\Documents\Red>script.exe -p

C:\Users\Toomas\Documents\Red>
9214
11:28it seems that exe is bugged after all
rebolek
11:28@9214 this crashes also:
Red[Needs: 'View]
print "something"
9214
11:29@rebolek with WinXP target?
rebolek
11:29Yes, on wine-3.0-rc6
9214
11:29@toomasv can you re-check the Windows one, not WindowsXP?
toomasv
11:31
C:\Users\Toomas\Documents\Red>red.exe -c -t Windows script.red

-=== Red Compiler 0.6.3 ===-

Compiling C:\Users\Toomas\Documents\Red\script.red ...
...using libRedRT built on 6-Feb-2018/13:17:08+2:00
...compilation time : 26 ms

Target: Windows

Compiling to native code...
...compilation time : 1171 ms
...linking time     : 58 ms
...output file size : 67072 bytes
...output file      : C:\Users\Toomas\Documents\Red\script.exe


C:\Users\Toomas\Documents\Red>script.exe blah

C:\Users\Toomas\Documents\Red>
9214
11:31@rebolek good catch btw, I was lost in the details :smile:
11:31@toomasv :+1: so it's not only WinXP or Wine specific, but affects all Windows targets
11:32thanks guys
toomasv
9214
11:32can anyone with Mac check this too?
11:43and the fact that on MSDOS it printed none and on Windows it's an emtpy string "" :suspect:
11:43or not?
rebolek
11:44Linux prints none
9214
11:44@rebolek :+1:
11:49same with prin
11:51https://github.com/red/red/issues/3221
JiaChen-Zeng
12:17> The escape character in Red is '^' - codepoint U+005E. As a result, the ^ character itself must be escaped. **The string literal for codepoint** is #"^^" not #"^". In fact, #"^" is invalid.

Should that be "The string literal for the escape character"?
9214
12:18@AT-Aoi I think this is about UTF-8 codepoint
12:19which is ^ or U+005E
12:21the existent explanation IMO is accurate enough, I don't think it should be changed to "escape character"
JiaChen-Zeng
12:22OK. Thank you. @9214
9214
12:39can anyone point me to examples of how parse can be used for graph rewriting?
toomasv
15:01@9214 Please amplify
9214
15:01@toomasv wat
toomasv
15:01Explain what do you mean
15:02More specifically
9214
15:02I mean that I have tree-like structure, I have some nodes, and I want to rewrite this nodes in that structure
toomasv
15:02Example?
9214
15:03say, block of nested blocks of nested blocks of nested blocks :neckbeard:
15:03each node is specified by unique path to this node and a set of paths that start from this node
toomasv
15:05You mean something like graph [a - [b c - [d e - [g h] f]]] May I show you a picture?
9214
15:05basically yes
rebolek
15:06What do you mean by rewriting?

>> graph: [1 [2 [[3 4][5 6]]]]
== [1 [2 [[3 4] [5 6]]]]
>> rule: [some [change set value integer! (#"A" + value) | into rule]]
== [some [change set value integer! (#"A" + value) | into rule]]
>> parse graph rule
== true
>> graph
== [#"B" [#"C" [[#"D" #"E"] [#"F" #"G"]]]]
9214
15:06It boils down to compiling a one big messy parse rule with cleverly placed combinations of into, ahead, change and such
15:07I wonder if there's saner approach for that
rebolek
15:08So, some dialect?
9214
15:08precisely
toomasv
15:09![graph2.png](http://vooglaid.ee/red/graph2.png)
9214
15:10@toomasv yes, now suppose that you have two c nodes ( let's replace e with c) and you need to rewrite only the upper one
toomasv
15:11Umm.. I am too dumb to understand..
9214
15:12graph [a - [b c - [d c - [g h] f]]]
15:13there two c's in this graph, right?
toomasv
15:14This one?
![graph3.png](http://vooglaid.ee/red/graph3.png)
9214
15:16now you want to change either one to some letter, say, x
15:16how can you specify which node exactly you want to replace?
15:17you can't just say c, because there two of them
15:17i.e. if you'll say c, each of them will be rewritten, but you need only one or another, not both
toomasv
15:17In my graph DSL it's actually:
graph [a - [b c - [d e "x" - [g h] f]]]
;or
graph [a - [b c "x" - [d e - [g h] f]]]
9214
15:18not in the graph description itself
toomasv
15:19It is graph description, specifying what to show separately of how to implement.
rebolek
15:21@9214 for example
>> graph: [a - [b c - [d c - [g h] f]]]
== [a - [b c - [d c - [g h] f]]]
>> index: 0 match: 1
== 1
>> rule: [some [ahead 'c (index: index + 1) if (index = match) change 'c 'x | into rule | skip]]
== [some [ahead 'c (index: index + 1) if (index = match) change 'c 'x | into rule | skip]]
>> parse graph rule
== true
>> graph
== [a - [b 'x - [d c - [g h] f]]]
toomasv
15:31BTW Sorry for bragging, too excited to be silent - todays feats:
![graph4.png](http://vooglaid.ee/red/graph4.png)
9214
15:36@rebolek yes, I have similar drafts
15:36I meant - is it an OK approach or are there better solutions?
15:43in your example nodes are identified by indexes, but in my case they are identified either by unique path to them (left context), part of rightmost graph(s) that starts from them (right context), both (left and right contexts) or none of the above (context-free)
rebolek
15:48@9214 I chose indexes because that was the easiest solution, other solutions are possible.
15:49Better solution would be probably to add some kind of rules with arguments.
9214
15:49okay, I can't come up with anything besides DSL compiler anyway

greggirwin
03:36@9214 :point_up: [February 6, 2018 5:39 AM](https://gitter.im/red/help?at=5a79a2007084124a34419d54) http://www.colellachiara.com/soft/Misc/rewrite.html
03:38Written with Gabriele's literate programming system.
03:38http://www.colellachiara.com/soft/Misc/rewrite.r is just the code.
toomasv
04:16@greggirwin Thanks for the link, interesting projects/articles.

9214
14:26Suppose I have set of patterns to match, e.g. ab, and I want to check if there's exactly one a and exactly one b, but without any specific order (i.e. ba should match too). What's the best way to tackle this with parse?
14:26because something like some ["a" | "b"] will match bb and aa, which is undesirable
14:28once pattern matched, it should be excluded from rule
14:30the only solution that comes to my mind is modifying top-level rule (["a" | "b"]) after every successful match, so if a matched it becomes just ["b"]
rebolek
14:31Probably something like [2 ["a" not "a" | "b" not "b"]]
9214
14:35it's cumbersome to generate such rule if set is bigger, abcdefg say
14:35or not, hmm
rebolek
14:35I would suggest some rule generator
14:38
>> rulegen: func [string][out: collect [foreach char string [keep reduce [char 'not char '|]]] remove back tail out reduce [length? string out]]
== func [string][out: collect [foreach char string [keep reduce [char 'not char '|]]] remove back tail out reduce [length? string out]]
>> rulegen "abcdefg"
== [7 [#"a" not #"a" | #"b" not #"b" | #"c" not #"c" | #"d" not #"d" | #"e" not #"e" | #"f" not #"f" | #"g" not #"g"]]
9214
14:39thanks @rebolek, I'll take a note on this approach
rebolek
14:51Although the rule would need to be more complicated, this one accepts "abadefg"
Phryxe
15:57
c: charset "abcdefg"
x: "gfeabcd"
parse x [if (equal? (length? unique x) (l: length? x)) l c]
9214
16:01@Phryxe I don' think set operations are quite there (https://github.com/red/red/issues/3195) for this task, but it's an interesting approach
Phryxe
16:33c: charset unique x might be better, but this was probably a stupid solution.
16:34or rather limited :worried:
9214
16:35even if it's limited to strings only, the basis idea is quite nice and can be enhanced :+1:
greggirwin
17:03
c: charset "abcdefg"
x: "gfeabcd"
parse x [some [set ch c (remove/part c to integer! ch)]]
17:04Not deeply tested. But the idea of modifying the rule as you match is something I've done before.
17:05Won't work if you need to match more than single values, but it's easy to imagine ways to do that too.

Phryxe
12:20
>> parse [-1] [integer!]
== true
>> parse [-1 -1] [1 2 integer!]
== true
>> parse [-1 -1] [1 2 -1]
*** Script Error: value out of range: -1
*** Where: parse
*** Stack:

Just trying things. I thought the last also would be true. Maybe I misunderstand how it works.
rebolek
12:35
>> parse [-1 -1][1 2 quote -1]
== true
12:36integers in parse mean length
Phryxe
12:37@rebolek OK, thanks, or range.
rebolek
12:37that's the word! ;)
Phryxe
12:38I notice it differs from Rebol.
12:40In Rebol Wikibooks:
parse [-1] [1 1 -1]
; == true
rebolek
12:41Interesting. But I think that Rebol doesn't have quote in parse.
Phryxe
12:43I don't have Rebol installed. I'll try to remember quote then.
rebolek
12:43I take a look.
12:44
>> parse [1][quote 1]
== false
12:44So it doesn't.
Phryxe
12:45Okey
xqlab
13:12@toomasv
>> cs: charset "abcdefg"
== make bitset! #{0000000000000000000000007F}
>> st: "gfeabcd"
== "gfeabcd"
>> parse st [some [ copy  c cs  (probe c) not ahead c]]
"g"
"f"
"e"
"a"
"b"
"c"
"d"
== true
>> parse "abddef" [some  [ copy  c cs  (probe c) not ahead c ]]
"a"
"b"
"d"
== false
toomasv
14:41@xqlab I think it's still about @9214 's question. Here is my try, assuming that he wants to return true if and only if:
1. string includes either "ab" or "ba"
2. it does not include any more "a" or "b"
parse <something> [
   some [
      ["ab" | "ba"] [to [#"a" | #"b"] reject | to end] 
   | [#"a" | #"b"] reject 
   | skip [end reject |]]
]
14:49P(r)oof:
rule: [some [["ab" | "ba"] [to [#"a" | #"b"] reject | to end] | [#"a" | #"b"] reject | skip [end reject |]]]
>> parse "" rule
== false
>> parse "ab" rule
== true
>> parse "ba" rule
== true
>> parse "bba" rule
== false
>> parse "baa" rule
== false
>> parse "b" rule
== false
>> parse "a" rule
== false
>> parse "skfjakabölfd" rule
== false
>> parse "skfjkablfd" rule
== true
>> parse "skfjkabläöafd" rule
== false
>> parse "skfbjkablfd" rule
== false
>> parse "skfabjkablfd" rule
== false
15:20Correction :exclamation: Rule should use fail instead of rejectin one place:
rule: [some [["ab" | "ba"] [to [#"a" | #"b"] reject | to end] | [#"a" | #"b"] fail | skip [end reject |]]]

Otherwise "a" or "b" in last position are wrongly accepted:
parse "cb" [some [["ab" | "ba"] [to [#"a" | #"b"] reject | to end] | [#"a" | #"b"] reject | skip [end reject |]]]
== true

The good news is, that same technique can be used with blocks:
rule: [
   some [
      ['my 'pattern | 'pattern 'my] [to ['my | 'pattern] reject | to end] 
   |  ['my | 'pattern] fail 
   |  skip [end reject |]]
]
>> parse [d my apples e my pattern] rule
== false
>> parse [d your apples e my pattern] rule
== true
>> parse [who's pattern] rule
== false


rebolek
15:23Such rule really needs rule generator :)
toomasv
15:28:( I don't understand, why sometimes reject is needed, but sometimes fail :question: E.g. here reject works:
rule: [some [['my 'pattern | 'pattern 'my] [to ['my | 'pattern] reject | to end] | ['my | 'pattern] reject | skip [end reject |]]]
>> parse parse [my apples or my pattern] rule
== false

But fail does not:
rule: [some [['my 'pattern | 'pattern 'my] [to ['my | 'pattern] reject | to end] | ['my | 'pattern] fail | skip [end reject |]]]
>> parse [my apples or my pattern] rule
== true

9214
15:29something to so with backtracking and rule success/failure I suppose
15:29can't dig up documentation on mobile
rebolek
15:30reject: break out of a matching loop, returning failure.
fail: force current rule to fail and backtrack.
toomasv
15:44Basic logic:
In each advance:
1. Is it my pattern?
1.1. Yes! Does any part of the pattern follow?
1.1.1. Yes: failure
1.1.2. No: Success
1.2. No! Backtrack
2. Is it some part of the pattern?
2.1. Yes! Failure
2.2. No! Backtrack
3. Skip
3.1. Have I reached the end?
3.1.1. Yes! Failure
3.1.2. No! Go to the start of the loop
9214
15:45I'll play around with your proposals once I get my mind back to project, thanks guys :+1:
15:48the tricky part is that set might contain things that look identical but are different
>> x: [me]
== [me]
>> y: [me]
== [me]
>> equal? x y
== true
>> same? x y
== false
15:49would be worth to check if parse matches something based on sameness or equalness
toomasv
15:49
>> same? x/1 y/1
== true
9214
15:51@toomasv
>> bind x context [me: 'not-me]
== [me]
>> equal? x/1 y/1
== true
>> same? x/1 y/1
== false
rebolek
15:53
>> same? in o1 'a in o2 'a
== false
>> b: reduce [in o1 'a in o2 'a]
== [a a]
>> parse b ['a 'a]
== true
15:53So it's equalness, which makes sense.
9214
15:54so it's only spelling that matters, not "meaning"?
rebolek
15:55In parse? Yes, your rules define the meaning.
9214
15:55no, I meant, suppose I want to match words by their meaning
15:56i.e. this a and that a
rebolek
15:56In parse?
9214
15:56I know that I can do that my matching word and checking its value in paren expressions
rebolek
15:57Right:
>> parse b [set val 'a (if same? val in o1 'a [print "o1/a"]) set val 'a (if same? val in o2 'a [print "o2/a"])]
o1/a
o2/a
9214
15:58@rebolek what if you'll parse b with rule that is b itself, only slightly modified (words should be quoted)?
15:58wait, it doesn't make sense :D
rebolek
15:58Rule that matches itself?
9214
15:58parse [][]
rebolek
15:59That's too easy ;)
9214
15:59I thought at the beginning of my exposure to Red and parse that it would be cool to construct such "quiney" rule
15:59and then I thought about that a little it was "duh"
rebolek
15:59
>> parse [][]
== true
>> rule: ['a]
== ['a]
>> parse rule rule
== true

16:00It's too easy unfortunately.
greggirwin
16:24Have to think about semantic parsing. Parse is based purely on data and lexical forms, but actions allow you to do meaningful checks above that level. That means you could write a semantic parsing dialect and generate both rules and actions, yes? I think that's the way to go. Unless someone comes up with a way to make it work directly in parse without confusion. Parse is already one of the more advanced features of Red.
9214
16:24I was just thinking aloud ;)
greggirwin
16:27Me too. :^)
16:27I hadn't seen that question before, so it's interesting to think about.
xqlab
16:58@toomasv , I thought there should be no double char. But the two demands you mentioned will be fulfilled by
cs: charset "ab"
parse str [ 2 [ copy  c cs  (probe c) not ahead c]]

9214
17:05I wasn't clear enough in formulating this problem: *exact* number of as, *exact* number of bs, but in *no specific order*
17:05in the simplest case of course
toomasv
17:06@xqlab Yes, it probes first two chars from charset. But where is the pattern?
xqlab
17:07The pattern is either "ab" or "ba" without repetition of a char
17:08@9214 how many "a" or "b"s ?
toomasv
17:08Sorry, I tried with earlier charset. But still:
>> cs: charset "ab"
== make bitset! #{00000000000000000000000060}
>> str: "cdab" parse str [ 2 [ copy  c cs  (probe c) not ahead c]]
== false
9214
17:09@xqlab you can't know in advance
xqlab
17:09You mean other chars are allowed?
toomasv
17:10I understood so. Only second a and b are not allowed.
xqlab
17:11I am sure that this can be done with this rule and a small modification too. Unfortunately I have to leave now. Will try later
toomasv
17:11OK. Would be nice to have simple rule for that!
9214
17:12The task is to find a "thing" that is followed by some "things" in no specific order
17:12say, c followed by ab
17:12cba, cab, ccab, cwhateverb
toomasv
17:13But you mean in string?
9214
17:13no, not string
17:13more like a graph or a tree
17:13node followed by a tree
toomasv
17:14Aaa, so stringifying is needed? Or you mean these examples as generalised pattern?
9214
17:14generalized and simplified pattern
17:17I have an input
"ABC[DE][SG[HI[JK]L]MNO]PQ"

which will be parsed into a "tree"
[#"A" #"B" #"C" [#"D" #"E"][#"S" ...]]

and I need to find a thing that is specified like
["BC"<"S">"G"["H"]"M"-"XX"]

i.e. edge S which you can find by following BC somewhere in the tree, and which itself is followed by a "tree" G[H]M
17:17and you need to replace that edge with XX
toomasv
17:17cfollowed somewhere by single a and single bin whatever order and not necessarily consecutively?
9214
17:17it will make a lot more sense if you'll draw that tree on paper actually
toomasv
17:20And what about non-repetition?
9214
17:20[![image.png](https://files.gitter.im/red/help/10EW/thumb/image.png)](https://files.gitter.im/red/help/10EW/image.png)
17:21well, suppose you have G[H]M
17:21and you're trying to match it with something that looks like [G | [H] | M]
toomasv
17:22I am listening..
9214
17:22but in fact there could be, say, G[H][blah [bleh [bluh]]][another bleh][uh [oh]]M or something
17:23the thing is that [G | [H] | M] will match GGG
17:23or MMM
17:23or whatever that is not our "tree"
17:23this is because how TDPL parsers work
17:23they choose the leftmost thing that match
17:24it's tricky, and I think maybe I misinformed you with problem statement a bit, because I'm still a bit confused about that :(
toomasv
17:28I am not listening. Dizzing..
greggirwin
17:30@9214, I think your example notation is what's tripping me up. My brain can't parse it right now.
17:31It's dense, and so am I.
9214
17:31@greggirwin it represents the tree I posted above
17:32or is this about [foo < bar > baz[qux] - stuff]?
17:33nvm, I would like to solve this on my own actually :neckbeard:
17:34because usually whenever you spill the beans about your project, @toomasv takes notes, implements everything in one hour and leaves you at the bottom of despair without anything to do :japanese_ogre:
17:35@greggirwin speaking of terseness - you haven't seen my Project Euler solutions in J
greggirwin
17:35Oh, I know *that* feeling. 17 years I've been Redboling and you whipper-snappers come along and put me to shame.

Maybe it's the non-repetition part that confused me. Is it a cyclic graph you have then?
17:36I'm only at level 1 in Project Euler. :^(
9214
17:37@greggirwin no, it's just a tree
17:37which I represent as a block of chars and nested blocks
toomasv
17:39OK, I am not interested... Just lurking around.. Incognito
greggirwin
17:39You don't fool me @toomasv.
9214
17:39@9214 makes guttural sounds :japanese_ogre:
17:40@greggirwin
+/I.+./0=3 5|/i.1e3
greggirwin
17:40@9214, so you need to specify the parent node, the edge to replace, and the following node, correct? Not *just* the edge to replace.
17:41And quit talking gibberish. ;^)
9214
17:41@greggirwin kinda like that, yeah
17:41but I can also specify *just* the edge
17:41or parent node and edge, or edge and following node
greggirwin
17:42OK. First I have to fix entab so @rebolek will respect me again.
9214
17:47@9214 looks at @toomasv suspiciously
https://www.youtube.com/watch?v=KOqtnU2faTc
greggirwin
18:00Philip Glass makes everything...everything...everything...Philip Glass.
9214
18:02@9214 [:neckbeard:](https://www.youtube.com/watch?v=kFuiTX8LrBQ)
xqlab
19:43to come back
>> cs: charset "ab"
== make bitset! #{00000000000000000000000060}
>> no-cs: complement cs
== make bitset! [not #{00000000000000000000000060}]
>> str: "cdab" parse str [ some [ [copy  c cs  (probe c) not ahead c]  |  no-cs ]]
"a"
"b"
== true

toomasv
08:46@xqlab Still doesn't work:
>> cs: charset "ab"
== make bitset! #{00000000000000000000000060}
>> no-cs: complement cs
== make bitset! [not #{00000000000000000000000060}]
>> str: "cdafb" parse str [ some [ [copy  c cs  (probe c) not ahead c]  |  no-cs ]]
"a"
"b"
== true
>> str: "cdafbfa" parse str [ some [ [copy  c cs  (probe c) not ahead c]  |  no-cs ]]
"a"
"b"
"a"
== true
>> str: "abfab" parse str [ some [ [copy  c cs  (probe c) not ahead c]  |  no-cs ]]
"a"
"b"
"a"
"b"
== true
xqlab
15:21The issue is that not does not work as I was expecting
>> parse "c" [ not "x"]
== false
9214
15:38not doesn't advance the input
gltewalt
19:51Looks like select doesn't work on nested blocks?
greggirwin
19:51Example? There is no /deep if that's what you mean.
gltewalt
19:52select [[[w 42] w 22]] 'w
19:53Works with Ladislav flatten
>> select flatten [[[w 42] w 22]] 'w
== 42
19:53So yeah, no deep
23:42No deep for find either?
>> find [[[w 42] w 22]] 42
== none
23:44Without thinking very deeply about it, I think find and select should have /deep. Or implicitly go deep.
23:44automagically

greggirwin
05:47> Without thinking very deeply about it, I think find and select should have /deep. Or implicitly go deep.

Think deeply about it first. Can you see a problem with that? Mock it up and look at your results.

raton3062015
12:39In c declare array like, int ar[50],
9214
12:40@raton3062015 and..?
raton3062015
12:43In c declare array like, int ar [50], now put data in it, ar [30]= 1, but in red, ar: make block! 50, but can't assign data, like ar/30: 1
9214
12:43@raton3062015 because block is empty
12:43you've just allocated some pre-defined space for it, but doesn't fill the content
raton3062015
12:44Then what will be the solution?
9214
12:45you can zero-fill it by yourself
>> blk: make block! 50
== []
>> empty? blk
== true
>> append/dup blk 0 50
== [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
>> blk/30: 1
== 1
>> find blk 1
== [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
rebolek
12:45or fake it with map!
raton3062015
12:46Time complexity?
9214
12:47I think accessing element by index in block is O(1)
12:47maybe it's the same for keys in map!
raton3062015
13:04 Find function algorithm ?
9214
13:06https://github.com/red/red/blob/master/runtime/actions.reds#L955
rebolek
13:06that's not very helpful :)
9214
13:07I know, find anything better :)
13:07https://github.com/red/red/blob/master/runtime/datatypes/block.reds#L746
rebolek
13:08I must add action! support to nsource :/
Phryxe
13:13> Find function algorithm ?

?? function
9214
13:14@Phryxe 2deep4me
13:14although I agree that question is not well formulated
13:15is it "find function algorithm?" or "find function algorithm?"
Phryxe
13:16Right ...
9214
13:17in any case, function just does deep-traversal of body and /localize all set-word!s
13:17and words that are used in iterators (repeat and foreach for example)
Phryxe
14:32Not sure how useful make block! 10 is. Noticed that make vector! 10 fills it with 0's.
9214
14:33well, yes, but vector! restricts its values to be of the same datatype
rebolek
14:33@Phryxe if you know your block size in advance, it is useful to prealocate the space, so the allocator doesn't have to expand series (which takes time) when filling it.
14:35also, vector! does not accept Red datatypes in the usual sense
14:36i.e. they are not boxed values
Phryxe
14:36Yes, I only meant it fills it with something as opposed to block.
rebolek
14:37Because it has to delete the allocated memory, otherwise there would be garbage. block! allocates the memory, but doesn't have to delete it.
Phryxe
14:37
>> blk: make block! 10
== []
>> length? blk
== 0
14:38Can you see if it has allocated memory?
rebolek
14:38From Red? No, you can't.
Phryxe
rebolek
14:39You have to believe it did ;)
Phryxe
14:39:smile:
9214
14:39maybe stats can help somehow?
14:40or stats/info, which is cryptic
Phryxe
14:40stats/show TBD
9214
14:40
text
>> probe new-line/all stats/info on
[
    [[9999 1 10000] [9999 1 10000] [2402 7598 10000]] 
    [[24 1048552 1048576] [918076 1179076 2097152]] 
    []
]
Phryxe
14:42Mysterious
rebolek
14:46See the difference? :)
>> b: [] dt [loop 30000000 [append b 0]]                  
== 0:00:10.190108
>> b: make block! 30000000 dt [loop 30000000 [append b 0]]
== 0:00:08.296904
Phryxe
14:48:thumbsup:
rebolek
14:49It was probably more significant on Pentium 4 :)
9214
14:50it allocates 30M of what?
rebolek
14:50memory slots
14:50memory slot is 128bits, IIRC
14:52unlike vector!, this:
>> v: make vector! [integer! 8 30000000]

allocates 30M bytes.
14:52So it's much more efficient.
14:53And 256 values should be enough for everyone.
9214
14:54is there a documentation on make specs?
rebolek
14:54Here's documentation on vector! http://www.red-lang.org/2015/04/053-faster-compilation-and-extended.html
9214
14:57and in general, for each datatype?
rebolek
14:58hm, I think there was something, but can't remember where
9214
14:58I wonder when using vector! over block! is preferable
rebolek
14:58maybe in wiki?
9214
14:58only this https://github.com/red/red/wiki/%60to%60-vs-%60make%60
rebolek
14:59@9214 if you have list of values of same type, like for example audio sample, or similar data
14:59basically binary stuff
15:04with 16 bit values, you need 8x less memory
9214
15:09> <bit-size> : 8 | 16 | 32 for integer! and char!

what will be the difference?
15:09for chars I mean
rebolek
15:11You can't fit Unicode chars in 8 bit slot
viayuve
15:11Go on guys I am learning so much today
rebolek
15:11Not sure what is it good for.
9214
15:11my thought too
15:24@rebolek wait, it's called utf-**8** for a reason :)
https://en.wikipedia.org/wiki/UTF-8
15:25> The name is derived from Unicode (or Universal Coded Character Set) Transformation Format – 8-bit
15:25or is it about all UTF encodings?
rebolek
15:26IIRC internal encoding is not UTF-8
15:27Putting á into 8bit vector works, which should not, if it was UTF-8
BillDStrong
17:24Internally, it is UCS. (I think it supports 16bit and 32bit?). UTF-8 is a text format, not an internal representation. (It does some really cool things for speed, though).
greggirwin
20:10Vector over block is an optimization, e.g. if you want to do faster math like in J. You can think of them basically as arrays versus collections in other languages, trading flexibility for performance.
PeterWAWood
22:27Internally,Strings are stored as either ISO-8859-1, UCS-2 or UCS-4 depending on their contents. Chars are 32 bits. More processing is required when adding, removing or finding characters than in Rebol2.

raton3062015
10:07I can use block as stack and queue. But how will i use it as priority queue
9214
10:16pair each element with an integer that represents its priority, then do something with it
10:19or use series index, but then elements with equal priority should be wrapped together in a block or other aggregate structure
raton3062015
10:56Then after append an element, i have to use sort
rebolek
11:06use map
9214
11:07@rebolek but sorting is not guaranteed in map!s if I'm not mistaken?
rebolek
11:08Or you can use reactors, I've implemented Redis-like sorted sets with them relatively easily.
9214
11:08yup, reactors sound better
rebolek
11:08It will sort for you automatically.
9214
11:08I believe Doc even showed some self-sorting example in blog article
11:08or was it about macros..?
11:10I'd rather inserted element at the right place instead of sorting whole thing every time
11:10you just need to find the element with priority equal to or greater than priority of inserted element
rebolek
11:10http://www.red-lang.org/2016/03/060-red-gui-system.html look for object ownership
11:11> I'd rather inserted element at the right place instead of sorting whole thing every time

That's not how it works, unfortunately. The action (like insert) is executed first and then you can run your code.
9214
11:12I mean - find appropriate element and make an insertion before it
11:12intead of appending to tail and then sorting
rebolek
11:13I was talking about on-deep-change, if you write your own functions, then fine.
9214
11:13ah, ok
11:14yes, I get what you mean now
raton3062015
16:36Is block use continuous memory location? Like array Or random memory location like linked list?
16:40If it uses continuous memory then insert an element in between will be time cconsuming
9214
16:43solve problem first, optimize later
16:43IIRC block is something in-between of array and linked list
greggirwin
17:34
Red [
    title:   "Tiny Priority Queue"
    file:    %tiny-priority-queue.red
    author:  "Gregg Irwin"
    email:   gregg@pointillistic.com
    date:    "Ported from circa 2007 Rebol code"
    version: 0.0.1
    purpose: {
        Provides functions, and an object def that uses them, to treat
        a series as a priority queue. When you insert items, you give
        them a priority (higher numbers mean a higher priority). In the
        actual series, the priority is stored along with the value, so
        you should always use the pq* functions to access them, to make
        things easier. 
    }
]

; Standalone PQ funcs, usable outside PQ objects
pq-insert: func [
    series [any-block!] "Series to insert value into"
    value "The value to insert"
    priority [integer!] "Higher numbers have higher priority"
][
    sort/skip/reverse repend series [priority value] 2
]
pq-first: func [series [any-block!]] [pick series 2]
pq-take:  func [series [any-block!]] [pick take/part series 2 2]

; PQ Prototype
priority-queue: make object! [
    data:   copy []
    insert: func [item priority] [pq-insert data item priority]
    first:  does [pq-first data]
    take:   does [pq-take data]
]



pq: copy []
print pq-insert pq "A" 1
print pq-insert pq "B" 10
print pq-insert pq "C" 100
print pq-insert pq "D" 1000
print mold pq
print pq-insert pq "CC" 100
print pq-insert pq "CCC" 100
print pq-insert pq "D" 1000
print pq-insert pq "CCCC" 100
print pq-insert pq "CCCCC" 100
print pq-insert pq "CCCCCC" 100
print pq-insert pq "CCCCCCC" 100

print ""
while [not empty? pq] [print pq-take pq]

pq: make priority-queue []
print pq/insert"A" 1
print pq/insert"B" 10
print pq/insert"C" 100
print pq/insert"D" 1000
print mold pq/data
print pq/insert"CC" 100
print pq/insert"CCC" 100
print pq/insert"D" 1000
print pq/insert"CCCC" 100
print pq/insert"CCCCC" 100
print pq/insert"CCCCCC" 100
print pq/insert"CCCCCCC" 100
while [not empty? pq/data] [print pq/take]

planetsizecpu
17:42Do some one know if there is a way to redirect stderr from console to a view widget, let's say box or area?
9214
17:43from console?
planetsizecpu
17:44Y es I want to output errors inside my app
9214
17:44you mean Red console? i.e.
>> 1 / 0
*** Math Error: attempt to divide by zero
*** Where: /
*** Stack:
planetsizecpu
17:45Maybe un system/console mmm... Have to test
9214
17:45you can catch error! objects with try
>> probe try [1 / 0]
make error! [
    code: 400
    type: 'math
    id: 'zero-divide
    arg1: none
    arg2: none
    arg3: none
    near: none
    where: '/
    stack: 5474656
]
*** Math Error: attempt to divide by zero
*** Where: /
*** Stack: probe
rebolek
17:45@planetsizecpu Red errors or system errors?
9214
17:46and call has /error refinement for stderr redirection
rebolek
17:46Red errors don't go to stderr
9214
17:46yes, so you'll need to dispatch on them manually
planetsizecpu
17:46Yes you have a do ... And want to display eventual errors
17:47In a red widget not console
9214
17:48@planetsizecpu the
*** Math Error: attempt to divide by zero
*** Where: /
*** Stack: probe

part?
planetsizecpu
17:48@rebolek red errores
9214
17:49as @rebolek said, these messages don't go to stderr
planetsizecpu
17:49Y es
17:50Thx I'll investigate
17:52Today I pushed some improvements to my forms app
rebolek
17:52@planetsizecpu ,
planetsizecpu
17:53And have to display errors on view
rebolek
17:53@planetsizecpu try is your friend
9214
17:53in simplest case you can just display formed id
planetsizecpu
17:53I will test thx. Sorry on phone...
9214
17:54
text
>> form get in try [1 / 0] 'id
== "zero-divide"
planetsizecpu
17:54Please test the app forms in my repo to see
rebolek
17:55I will take a look later, I'm on tram now
planetsizecpu
17:56Ok :smile:
9214
17:59@planetsizecpu nice! Unfortunately I was able only to add/delete one button, after that (or somewhere in between)
*** Script Error: path FontSel/color: is not valid for none! type
*** Where: set-path
*** Stack: view do-events do-actor do-safe FormFontChange 
*** Script Error: VID - invalid syntax at: [none 255.228.196 0.0.255]
*** Where: do
planetsizecpu
18:02Ahh I will test tomorrow, still alpha :smile:
18:06@9214 thx

snotbubble
07:12quick question, what's the simplest way to do this:
make date! "1-feb-2018"
rebolek
07:15@snotbubble
>> type? load "1-feb-2018"
== date!
snotbubble
07:18@rebolek perfect thanks!
rebolek
07:18@snotbubble you're welcome :shipit:
greggirwin
07:26I just saw this on the ML. Should have come here first, but then @rebolek would still have beat me.
rebolek
07:29Sorry @greggirwin I'll try to be slower :snail:
snotbubble
12:46nextquestion:
how to append the value of a variable to an array:
Red []
allofit: copy []
a: "one"
b: "two"
aa: copy a
bb: copy b
append allofit [a b]
append allofit [aa bb]
print["allofit=" allofit]

returns: allofit= a b aa bb
9214
12:47@snotbubble use reduce on your "array"
12:48
text
>> a: 1 b: 2
== 2
>> append [][a b]
== [a b]
>> append [] reduce [a b]
== [1 2]
viayuve
12:49@rebolek like this slow http://t3.gstatic.com/images?q=tbn:ANd9GcSAtyN8WekENjc7QkkTzkRkwenCiDDwDshh0YryDNGcnVjt4Oxf
snotbubble
12:50@9214 great thanks!
12:50its 'block' not array right?
Phryxe
13:11Yes, block!
viayuve
13:12damn I got scarred lol that fly though notification lol :smile:
13:17idt(Interrupt Descriptor Table) with red/system right ?? :confused:
snotbubble
13:23how to append an intact block:

Red []
allofit: copy []
a: "one"
b: "two"
append allofit reduce [a b]
c: "three"
d: "four"
append allofit reduce [c d]
foreach i allofit [ 
	print[i/1] 
]

returns:
o
t
t
f

however I'm after:
one
three


trying to replicate:
allofit[["one","two"]["three","four"]]
9214
13:24@snotbubble append/only
viayuve
13:25@9214 any guess on my issue IDT
9214
13:29IIRC address of IDT is stored in IDTR register
13:29and per R/S specification, only following registers are accepted as of now
> IA-32: eax, ecx, edx, ebx, esp, ebp, esi, edi
viayuve
13:30damn you know everything can you link me page
13:33found it thanks http://static.red-lang.org/red-system-specs.html
13:34@9214 so red support only 32 bit ??
9214
13:39currently yes
viayuve
13:45@9214 is it possible to write kernel in red/system
13:46just using r/s without asm
9214
13:47I'm not qualified enough to give you a definite answer on that
viayuve
13:50@rebolek do you know ??
grazil
15:57Is it possible to modify the HTTP headers when using read or load?
9214
15:58@grazil [this](https://github.com/red/red/wiki/Guru-Meditations#how-to-make-http-requests)?
grazil
16:01yes! thanks a lot! :)
16:06I see, this is the /info refinement witch is not documented in the read and write helps. Do you think i have to open an issue for that, to clarify this point ?
16:08@9214 sorry, i forget to mention your name
9214
16:08@grazil and what should be added to docstrings?
grazil
16:11@9214 in the version 0.63, the docstrings is empty... What about writing the link that you gave me ? Or the example (but it would be too long i supprose) ?
9214
16:11@grazil as I understand it, /info refinement should be multi-purpose, and should be extended in the future versions
16:12i.e. it's not restricted to HTTP requests only
16:12usually when something is not documented, it means that this feature is experimental or a subject to change
grazil
16:13@9214 Ok, i see. thanks again for your lightning speed answer !
9214
16:13you can open a ticket for that I think, nothing scary will happen ;)
16:14or we can wait for @greggirwin and he'll tell us something more specific
grazil
16:15Yes, i will wait, for is answer before opening a ticket.
greggirwin
16:36/info is likely not documented, because it could change when we get full I/O. Most other refinements came from Rebol's design, and are well vetted.
rebolek
16:40@viayuve I think that theoretically it should be possible.
viayuve
16:50@rebolek than I will try that theory ;) I will let you guys know how it goes
rebolek
16:57@viayuve that sounds cool :clap: but if you're not successful, don't blame it on me :worried:
viayuve
16:59Okay but in processes I might eat some of best red personal brain is that OK ;)
17:00@rebolek and @9214 :smile:
rebolek
17:01:fork_and_knife:
9214
17:02@viayuve https://www.ops-class.org/
BeardPower
17:19@viayuve If the language allows you to address the hardware directly (interrupts, memory, input, screen, clock,...) then yes. IIRC R/S does not allow you to address everything of the hardware directly, so you need some Assembler. The first thing you need to code, is a bootloader anyway.
17:21After you have finished your bootloader, you have to decide on the kernel architecture: Monolithic? Micro? Hybrid? Exo?
17:55I'm also looking forward to the Mill. It would be great to implement a micro-/exokernel for it. The Mill needs no context switches and is a compiler target.
toomasv
19:25Can sombody remind me: how can dynamically changed function's body be rebound to function arguments?
9214
19:25@toomasv :question:
toomasv
19:27Let's say I change functions' body by eg.
append clear body-of :func [new body]

How shell I bind new body to func's arguments? I.e spec
9214
19:31@toomasv ?
>> foo: func [x y][x + y]
== func [x y][x + y]
>> foo 1 2
== 3
>> foo: func spec-of :foo [x - y]
== func [x y][x - y]
>> foo 1 2
== -1
19:33I don't get what do you mean by "bind body to func's arguments"
19:34you can't bind anything to it
19:34argument block is just a block, it's not a context
19:34jeez, gitter lags like hell
19:38bind [new body] :foo perhaps
19:38
text
>> foo: func [x y][x + y]
== func [x y][x + y]
>> foo 1 2
== 3
>> append clear body-of :foo [x - y]
== [x - y]
>> foo 1 2
*** Script Error: x has no value
*** Where: -
*** Stack: foo  

>> append clear body-of :foo bind [x - y] :foo
== [x - y]
>> foo 1 2
== -1
19:39aah, yes, now it makes sense
19:40here I'm binding to a context that doesn't exist, but appears once foo is called
toomasv
19:44Thank you @9214 :exclamation:
9214
19:44:pray:
toomasv
20:13@9214 See into gui-branch in few moments - it's thanks to you!
9214
20:14@toomasv I'm already feel myself too dumb and stupid after everything you showed there :older_man:
toomasv
20:15:flushed:
9214
20:15my wrinkly :peach: won't handle another round of coolness

raton3062015
09:22
a: 'b
09:24how can i convert lit-word to string?
Length? form a
09:25>> 2
rebolek
09:26'b gets evaluated to b, so you have word! in a, not lit-word!
09:27also, form converts to *human readable* form, so you need to use mold:
>> a: 'b
== b
>> type? a
== word!
>> a: quote 'b
== 'b
>> type? a
== lit-word!
>> form a
== "b"
>> mold a
== "'b"
raton3062015
09:29sorry. a: 'b'
rebolek
09:30So you want b'?
raton3062015
09:34How to convert 'b' to "b"
rebolek
09:35Ah, there are no single quotes.
09:36' before word! means lit-word!, ' after word is just part of word, you can have word like a'b'c' for example
raton3062015
09:40Thanks
9214
09:47
text
>> form/part 'b' 1
== "b"
rebolek
09:47@9214 you *can* do it, but that does not mean you *should* ;)
9214
09:48:japanese_goblin:
ralfwenske
11:12I am processing some csv data (csv.red) which returns strings in a block.
I then process each item like this:
num: dataitem
try [num: to float! dataitem]

this works: num is either float! or string!
trouble is when dataitem is "" —> Red seems to hang in an endless loop instead of returning error.
Run this:
num: to float! ""

could someone confirm this please?
Ungaretti
11:26I get an error:

>> num: to float! ""
*** Script Error: cannot MAKE/TO float! from: ""
*** Where: to
*** Stack:

ralfwenske
11:33I tried again and have to ^c to get out of it:
11:35
>> about
Red for macOS version 0.6.3 built 27-Jan-2018/14:34:08+10:00
>> num: to float! ""
^Cmacmini:red-crypto ralfwenske$

I will download the latest and try again…
11:57@Ungaretti I tried on Windows as well and with 0.6.3 built 25-Jan-2018 I get:
Red GUI Console has stopped working. This is strange - what Red version did you run it on?
9214
12:00
text
>> about
Red for Linux version 0.6.3 built 22-Dec-2017/23:01:43+05:00
>> to float! ""
Segmentation fault
12:01same with version from 25 Jan
15:55@ralfwenske as a temporal workaround, you can use load instead of to float! and check for an empty block! in case of empty string!
>> load "4.2"
== 4.2
>> load ""
== []
Ungaretti
18:43@ralfwenske Interesting:
>> about
Red for Windows version 0.6.3 built 18-Oct-2017/20:58:24-02:00
>> to float! ""
*** Script Error: cannot MAKE/TO float! from: ""
*** Where: to
*** Stack:

but version 0.6.3 built 10-Dec-2017 crashes! Seems like a bug.
19:01Please, how do I make my program constantly listen to keys pressed?
In other words: how do I listen to a "key pressed" event when my program's window (not just a face) is on focus?
And how do I get the value of the key pressed?
greggirwin
20:10@ungaretti, use the actors object or a global event handler.
win: layout []
win/actors: make object! [
	on-key: func [face event][
		? event/key
		if event/key = tab [return probe 'done]
	]
]
view win

or
https://doc.red-lang.org/en/view.html#_global_event_handlers
Ungaretti
20:30@greggirwin Thanks!
gltewalt
23:13Why does empty? return true is a series is at its tail? The data still exists - the series isn't empty
23:14Why not just have tail?
23:22
>> s: "hi"
== "hi"
>> s: next s
== "i"
>> s: next s
== ""
>> tail? s
== true
23:23 empty?: func [val][val: head val tail? val]
23:24
>> empty? s
== false
>> s
== ""
>> head s
== "hi"

greggirwin
01:48The semantics are slightly different for tail? and empty?. You can use empty? on none! values, which is convenient. Beyond that, it can be a more meaningful word, depending on what you're doing. Which of the following reads better to you?
if not tail? s: ask "Ready?" [print s]
; or
if not empty? s: ask "Ready?" [print s]

Or consider this.
blk: [1 2 3 4 5 6]
blk-ref: at blk 4
while [not empty? blk-ref][print take/last blk-ref]

Seems OK, yes? What about this then? (WARNING! This will hang your Red session.)
empty??: func [s][tail? head s]  ; == yours above
blk: [1 2 3 4 5 6]
blk-ref: at blk 4
while [not empty?? blk-ref][print take/last blk-ref]
gltewalt
03:56Oh yeah. empty? none
03:57Actually, I'd rather use if not tail? s: ask "Ready?" [print s] because empty? doesn't always mean there's nothing there
greggirwin
04:12When would it not mean that in the case of ask?
gltewalt
04:17Oh it would, but I’m general I’d rather stick with if not tail?
04:17In general
snotbubble
04:41another question: how to use a block as data for a text-list?
Red [ needs 'view]

sampledata: {title;fn;args;amt
one;weekly;2.15;100
two;monthly;3.1;100}

sd: split sampledata "^/"
print ["sample data:^/" sd]

view [
	Title "test"
	below
	srclist: text-list 700x300 data [sd]
]


prints the block 'sd' in the console, but no-show in the UI.
04:58nvm
srclist: text-list 700x300 data sd
greggirwin
05:39You got it. :^)
snotbubble
05:45hmm now if I split, pad and rejoin the strings it won't display in the UI:
Red [ needs 'view]

sampledata: {title;fn;args;amt
one;weekly;2.15;100
two;monthly;3.1;100}

sd: split sampledata "^/"

bd: copy []
foreach s sd [
	cc: split s ";"
	append/only bd cc
]

foreach i bd [
	i/1: pad i/1 6
	i/2: pad i/2 10
	i/3: pad i/3 5
	i: rejoin i
	print [i]
]

view [
	Title "test"
	below
	srclist: text-list 700x300 data bd
greggirwin
06:02Note that you now have sub-blocks in bd.
06:05So you can do something like this:
sampledata: {title;fn;args;amt
one;weekly;2.15;100
two;monthly;3.1;100}

sd: split sampledata "^/"

bd: copy []
foreach s sd [
    cc: split s ";"
    append bd rejoin [
        pad cc/1 6
        pad cc/2 10
        pad cc/3 5
    ]
]

view [
    Title "test"
    below
    srclist: text-list 700x300 data bd
]
dsgeyser
06:13Rebol has the 'anim' style whereby a series of images in a block can be played back at a given rate, resulting in an animated gif.

How can this be done in Red?
greggirwin
06:19There's no built in style for that in Red yet. Red uses native widgets, so that may be more work across platforms. You could roll your own using the base style and a rate though.
dsgeyser
07:00@greggirwin Thanks
snotbubble
07:13@greggirwin perfect thanks!
is there a way to print data as-is?
eg: show a series of blocks as a series of blocks?
9214
07:14@snotbubble probe
snotbubble
07:24@9214 got it thanks
rebolek
07:38@dsgeyser Here's simple anim type, it's really easy to do:
Red[]

random-image: function [size][i: make image! size forall i [v: random 255 i/1: make tuple! reduce [v v v]] i]

images: collect [loop 12 [keep random-image 100x100]]

view [
    style anim: base 
        on-create [
            face/rate: 12
        ]
        on-time [
            face/image: first face/data
            face/data: next face/data
            if empty? face/data [face/data: head face/data]
        ]
    anim data images
]
planetsizecpu
11:20here is another example:

Red [Needs: 'View]

Scr: [ size 350x250
pad 5x5
proRed: progress 100x200 red data 0.5 rate 3 on-time [either random 2 = 1 [push_up proRed] [push_dn proRed]]
proGre: progress 100x200 green data 0.5 rate 3 on-time [either random 2 = 1 [push_up proGre] [push_dn proGre]]
proBlu: progress 100x200 blue data 0.5 rate 3 on-time [either random 2 = 1 [push_up proBlu] [push_dn proBlu]]
return]

push_up: func [prg] [if prg/data < 100 [prg/data: prg/data + 0.01]]
push_dn: func [prg] [if prg/data > 0.0 [prg/data: prg/data - 0.01]]

view/no-wait Scr
toomasv
12:10@planetsizecpu :+1: Seems that colors are not showing up in W10. All are green. (Can also use random true or random false)
Phryxe
12:11@planetsizecpu All green also on Win 7.
planetsizecpu
12:19I know that, seems colours are locked for a while due to red/view works
@toomasv Thx! I will test true/false values
12:22Also I haven't defined func [prg] ... as object!, but it seems red know what I wanted :clap: bravo for red!
toomasv
12:37@planetsizecpu But prg argument refers to object.
12:39@rebolek Beautifully simple!
planetsizecpu
12:42This is one of the things that I like about red, kindness, no need to specify everithing.
rebolek
12:44@toomasv thanks, I believe it can be improved and made much more complicated ;)
Phryxe
14:14I'd like to see a minimal draw animation, plz. Thnx. :astonished:
rebolek
14:19@Phryxe here you go:
Red[]

view [
    style anim: base 100x100 
        on-create [
            face/rate: 12
            face/extra: 0
        ]
        on-time [
            face/draw/3: face/draw/2 + as-pair 50 * cosine face/extra 50 * sine face/extra
            face/extra: face/extra + 5 // 360
        ]
    anim draw [line 50x50 0x50]
]
Phryxe
14:21@rebolek :thumbsup:
toomasv
14:23
view [
   box 200x200 rate 10 
   on-time [square/2: square/2 + 1] 
   draw [square: rotate 0 100x100 [fill-pen brick box 50x50 150x150]]
]
Phryxe
14:26@toomasv :clap: Thank you both. Now I have something to study.
toomasv
14:26@Phryxe You are welcome!
dsgeyser
19:27@rebolek @toomasv @planetsizecpu Many thanks. Need to play with the examples. Came home late.
toomasv
19:29One more:
![flower](http://vooglaid.ee/red/animation5.gif)
greggirwin
19:48@toomasv <he he>. That's fun. Thanks to @rebolek and @planetsizecpu as well, for nice examples.
toomasv
20:04Oops! Forgot code :flushed:
system/view/auto-sync?: off
t: 0
view/tight [
	box 200x200 all-over cursor hand 
	draw [crv: curve 100x50 100x125 100x200 flr: translate 0x0 [rotate 0 100x50 fill-pen red polygon 100x50 95x48 90x35 97x40 100x30 103x40 110x35 105x48]]
	all-over 
	on-down [
		face/rate: none
		show face
	]
	on-over [
		if event/down? [
			crv/2: event/offset 
			flr/2: event/offset - 100x50 ;
			diff: crv/2 - crv/3
			flr/3/2: 180 / pi * (arctangent2 diff/y diff/x) + 90
		] 
		show face
	] 
	on-up [
		d: 100x50 - crv/2 
		dst: max absolute d/x absolute d/y
		face/rate: 25 show face
	] 
	on-time [
		t: t + 1
		d: 100x50 - crv/2
		crv/2/x: crv/2/x + round/to d/x / to-float dst 1
		crv/2/y: crv/2/y + round/to d/y / to-float dst 1
		flr/2/x: flr/2/x + round/to d/x / to-float dst 1
		flr/2/y: flr/2/y + round/to d/y / to-float dst 1
		diff: crv/2 - crv/3
		flr/3/2: 180 / pi * (arctangent2 diff/y diff/x) + 90
		dst: dst - 1
		if dst = 0 [face/rate: none]
		show face
	]
]

snotbubble
00:17how to do this:
idx: to-integer! reduce atextlist/selected

I'm getting idx = to-integer!
or none! if doing reduce only
02:30having a problem where 2 blocks are becoming entangled somehow,
block somedata contains the raw data,
block rd is for display in a list.
When I pad the display data the source data is also padded...
Red []

rd: copy []

renderdata: function [d] [
	clear rd
	foreach i d [
		append rd rejoin [
			pad i/1 10
			pad i/2 5
			pad i/3 5
		]
	]
]

somedata: [["one" "32" "xx"] ["two" "23" "ee"]]
print["^/data before render:^/"somedata]
probe somedata
print["^/padding data..."]
renderdata somedata
print["^/render:^/"rd]
probe rd
print["^/corrupted data after render:^/"somedata]
probe somedata
02:48nvm. copy/deep
Red []
rd: copy []
renderdata: function [d] [
	o: []
	foreach i d [
		append o rejoin [
			pad i/1 10
			pad i/2 5
			pad i/3 5
		]
	]
	o
]
somedata: [["one" "32" "xx"] ["two" "23" "ee"]]
print["^/data before render:^/"somedata]
probe somedata
print["^/padding data..."]
clear rd
copyofdata: copy/deep somedata
rd: renderdata copyofdata
print["^/render:^/"rd]
probe rd
print["^/data after render:^/"somedata]
probe somedata
9214
03:08@snotbubble either to-integer or to integer!
greggirwin
03:11@snotbubble, gets everybody at times. If you haven't seen it, https://github.com/red/red/wiki/Why-do-I-have-to-copy-series-values%3F is a great explanation.
snotbubble
04:45@9214 got it thanks!
ralfwenske
05:47@Ungaretti @9214 @PeterWAWood Thanks for helping and also #3227
btw I like load "4.2" even better.
abdllhygt
08:16I have a problem about installing red on my new os (elementary os)
08:20
error while loading shared libraries: libcurl.so.4:
 cannot open shared object file: No such file or directory

rebolek
08:28You need to install curl
abdllhygt
08:30i have curl but i use x64
9214
08:35@abdllhygt http://www.red-lang.org/p/download.html
08:36read instructions below "Download" section
rebolek
08:37You need to install 32 libs, see @9214 's link
abdllhygt
08:37i look now, and fixed, thanks @9214 @rebolek
planetsizecpu
09:31@greggirwin I have read this wiki at least five times in the past, every one you make me feel newbie in red, so probably I am :)
snotbubble
09:43getting this error:
Compilation Error: Windows target requires View module (`Needs: View` in the header)

but have the header:
Red [needs 'view]

Am I missing any additional files?
9214
09:44@snotbubble read error message **really** carefully
snotbubble
09:45@9214 k thanks allgood, was reading help here: https://ungaretti.gitbooks.io/red-language-notebook/content/hello-world-run-and-compile.html
09:47what difference does the ' make in this case?
9214
09:47@snotbubble what is needed
Red [needs: 'view] ; or Red [Needs: View], [needs: view], etc

what you have
Red [needs 'view]
09:47' makes no difference AFAIK
snotbubble
09:50lol win10 thinks the exe is a trojan, is this normal?
9214
09:51it's a common rite of passage, to fight with poorly tuned AV software either for your compiled exe or for Red toolchain itself ;)
09:52you probably should flag it as false-positive and send a report to vendor
09:53in the worst case scenario just exclude your working directory from antivirus scanning
snotbubble
10:05getting this error when running the exe via cmd:
*** Runtime Error : access violation
*** at: h

what tools/process should I use to to find out what went wrong?
9214
10:06@snotbubble compile with -d flag and probe places where error occurs, output should be displayed in shell window after compilation
10:07or try to compile with -e flag and see if problem disappears
snotbubble
10:12@9214 thanks got it: had an uncommented probe, allgood now.
9214
10:13@snotbubble you should fill a ticket on issue tracker if possible, I don't think access violation should happen because of that
snotbubble
10:20@9214 ok sent.
10:23Is there any way to speed up the text-list? I'm getting lag with mousewheel scrolling, but no lag when dragging the scrollbar.
9214
10:24I'm not aware of any such ways, maybe @qtxie or @greggirwin can say something if they have time
JohnPeoplefox
13:26first attempt at Red/System, trying to display a message box. here is the code


Red/System []

#import [
   "user32.dll" stdcall [
       msgbox: "MessageBox" [
           hwnd [integer!]
           text [c-string!]
           caption [c-string!]
           type [integer!]
           return: [byte!]
       ]
   ]
]


msgbox 0 "Hello" "Welcome" 1


The error message is

dates.exe - Entry Point Not Found
The procedure entry point MessageBox could not be located in the dynamic link library C:\red\toolchain\red\dates.exe.
OK

Of course, I have no idea what I'm doing :-(

PeterWAWood
14:07@JohnPeoplefox The name of the MS Function should be MessageBoxA to use the ANSI version or MessageBoxW to use the Unicode (UTF-16 version).

Your code above will work if the use MessageBoxA.
JohnPeoplefox
14:59@PeterWAWood oh thanks, much appreciated
greggirwin
18:54:point_up: [February 20, 2018 3:20 AM](https://gitter.im/red/help?at=5a8bf65f0202dc012e5cf15d) @snotbubble, how many items in the list? I just tested with 1'000 items and mouse scrolling is fast.
18:56:point_up: [February 20, 2018 2:31 AM](https://gitter.im/red/help?at=5a8beb02a2194eb80d8a77c9) @planetsizecpu, there are still times when I am coding away and realize I've forgotten how Red really works, because it's so well hidden. Then I hit a bit where I think "this should be easier", and remember.
snotbubble
23:24@greggirwin might be a system setting in win10, will check...
ok no lag when scroll is set to 1 page at a time, lags when set to x lines at a time. Probably a win10 feature.

snotbubble
00:00is there a way to read/write to tab-panel tab text?
tried this with no luck
tab-panel/pane/1/text
rebolek
00:06@snotbubble view [t: tab-panel ["a" [button "change"[t/data/1: "bflm"]]]]
snotbubble
00:11@rebolek got it thanks!
00:13what's the best way to construct strings like this?
"item count is " + to-string length? somedata + " items."
dander
00:20@snotbubble rejoin ["item count is " length? somedata " items."]
00:21rejoin stands for "reduce and join", so everything in the block is evaluated then joined together
snotbubble
00:22@dander thanks, so no need for to-string...
01:49is there a way to change a drop-list selection (via code) without triggering its on-change event?
toomasv
04:20@snotbubble
>> view/no-wait [
   drp: drop-list data ["one" "two" "three"] select 1 
      [sel/text: pick face/data face/selected] 
   text 50x20 "Selected:" 
   sel: text with [text: pick drp/data drp/selected]
]
== make object! [ ...
>> drp/selected: 2
== 2
>> drp/selected: 3
== 3

![drop-list](http://vooglaid.ee/red/example1.gif)
snotbubble
06:55@toomasv Thanks Toomas,
having trouble translating it to what I'm doing:

Selecting from a list changes faces below it (getdata),
Changing the faces below changes the data (setdata),
Changing the data updates the list (renderdata).
Setdata and renderdata are being needlessly triggered by getdata.
(sorry for long example)
Red [needs: view]

renderdata: function [] [
	print["        renderdata: ... "]
	o: copy []
	foreach r sampledata [
		rr: copy/deep r
		append o rejoin [
			pad rr/1 10
			pad rr/2 10
			pad rr/3 10
		]
	]
	o
]

getdata: function [d x] [
	print["    getdata [d x]:" d x]
	huh: (pick d x)
	tf/text: huh/1
	td/selected: index? find fndata huh/2
]

setdata: function [x t f] [
	print["    setdata [x t f]:" x t f]
	sampledata/(reduce x)/1: tf/text
	sampledata/(reduce x)/2: fndata/(reduce f)
	rendereddata: renderdata
	tl/data: rendereddata
]

sampledata: [["one" "fn1" "100"] ["two" "fn2" "200"] ["three" "fn3" "300"]]
fndata: ["fn1" "fn2" "fn3"]
rendereddata: renderdata

view [
	Title "test"
	across
	text "tl" 20x20 right
	tl: text-list data rendereddata
	on-change[print["tl on-change triggered..."]
		getdata sampledata (reduce tl/selected)
	]
	return
	text "tf" 20x20 right
	tf: field
	on-change[print["tf on-change triggered..."]
		setdata (reduce tl/selected) tf/text (reduce td/selected)
	]
	return
	text "td" 20x20 right
	td: drop-list data fndata select 1
	on-change[print["td on-change triggered..."]
		setdata (reduce tl/selected) tf/text (reduce td/selected)
	]
]
toomasv
07:44@snotbubble
1. Selecting item in tl triggers its on-change
2. tl's on-change calls getdata
2. getdata changes tf/text
3. Changing tf/text triggers on-change for tf
4. tf's on-change calls setdata
5. setdata sets both first and second field of selected sampledata
6. Only then td/selectedis set in getdata, i.e. already changed data.

I suggest to split setdata into two -- one for tfthe other for td and call them separately in respective on-changeactions.

(Also, I think you can use simpler syntax instead of parens, e.g. sampledata/:x/2: fndata/:f instead of sampledata/(reduce x)/2: fndata/(reduce f) and just getdata sampledata tl/selected instead of getdata sampledata (reduce tl/selected))
snotbubble
08:06@toomasv got it:
tl: text-list data rendereddata
    on-change[
    amsetting: False
    getdatafor sampledata (reduce tl/selected)
    amsetting: True
]

then put everything inside if amsetting [... in setdata...
Thanks for syntax suggestions, still very new to Red so appreciate it!
toomasv
08:07:+1:
loziniak
12:28
Red []

test: function [
	callback [function!]
][
	callback 12
]

f: function [
	param [integer!]
][
	print ["param: " param]
]

test :f


i have no idea why it's not working. do you?
12:38to be more specific (i discovered it just now): it's working with interpreter (>> do %code.red), but not when compiled (red -c -o code code.red)
rebolek
12:45it's too dynamic for compiler, I guess. Try changing it to do [callback 12] or do reduce [callback 12].
loziniak
12:47do [callback 12] worked. weird stuff :-)
rebolek
12:48do switches to interpreter
loziniak
12:49doesn't switching to interpreter make some performance penalty?
rebolek
12:50that's the price of the dynamic code
12:50anyway, if you're not doing some critical computations (and you probably would switch to R/S anyway) then I don't think it's a problem
loziniak
12:52sure, because callbacks are used mostly in time-costly operations anyway
12:53but a little error message could be helpful in understanding what's going on.
rebolek
12:53what does the compiler says
loziniak
12:54nothing, everything seems fine. just nothing is printed when I call ./code
rebolek
ghost~5680c5f416b6c7089cc058a5
13:14This issue should be solved and compiler would be able to run the code as it is whenever the dyn-stack branch is finished and merged to master.
13:16A bit of performance penalty would still be there I think. But performance will increase with an optimizing backend and JIT which are scheduled after 1.0
loziniak
22:08Guys, now i'm trying to figure out how to return data from red/system to red. I have an external library which uses callbacks, so I need a way to convert arguments between Red and R/S. Is it easier to construct red-object! in R/S or maybe red-binary! is simpler to construct in R/S, and then could be decoded in Red into an object?
rebolek
22:11@loziniak I would construct red-object! at R/S level, but I'm afraid there are no docs, you should take a look at Red sources, how it's done.
loziniak
22:13I'm trying to, but there is so much going on there, hard to figure it out.
22:17for example - is *ctx* in red-object! definition a pointer to red-context! or a r/s context?
rebolek
22:19I guess red context, there are no contexts in r/s
22:19I haven't worked with r/s for some time,
loziniak
22:20there are namespaces: http://static.red-lang.org/red-system-specs.html#section-7.3
rebolek
22:21right, but they not contexts, so I think it's pointer to red context
loziniak
rebolek
22:42I haven't used r/s for some time, so I can't be of more help, sorry

snotbubble
01:50just ran into the libcurl error on linux, before I install it: why is it required for a red program that doesn't access the internet ?
ne1uno
05:04guessing it's hard to know if a program will use net access
05:04sounds like a good option to turn off the requirement though
snotbubble
05:27tab-panel/selected is returning the previous selection in its event, regardless of on-change or on-select. Is there a way to get the currently selected tab?
9214
07:17@snotbubble rtfm https://doc.red-lang.org/en/view.html#_tab_panel
snotbubble
07:43Occurs when user selects a new tab. event/picked holds the index of the newly selected tab. selected property is updated just after this event.
so selected update is just laggy? is there a timer on it?
rebolek
07:44Not laggy.
07:44The value is the during the lifetime of the event.
07:45So you can have access to both old and new value.
9214
07:45> event/picked holds the index of the **newly selected tab**

@snotbubble is that what you want?
snotbubble
07:47
*** Script Error: cannot access event in path tp/event/picked

where tp is the tab-panel
rebolek
07:48just event/picked
9214
07:48it's not the facet, you should use even/picked inside block
snotbubble
07:49works thanks!
greggirwin
08:17:point_up: [February 21, 2018 6:50 PM](https://gitter.im/red/help?at=5a8e21f20202dc012e69ea58)
> just ran into the libcurl error on linux, before I install it: why is it required for a red program that doesn't access the internet ?

We don't have modular compilation yet.
JohnPeoplefox
12:04ok, here's my first experiment with Red/View. It's just a few blocks scrolling up and down. I'd appreciate any comments on the code


Red [needs: 'view]


scroll: function [square] [

    pos: square/offset/y
  
    switch pos [
        280 [square/data: "up"]    
        1 [square/data: "down"]
    ]
    
    switch square/data [
        "down" [square/offset: square/offset + 0x1]
        "up" [square/offset: square/offset - 0x1] 
    ]    

]

view [
    
    panel 150x300 [
    
        across
    
        a: base 20x20 green data "down" rate 20
            on-time [scroll a]
            
        b: base 20x20 blue data "down" rate 40
            on-time [scroll b]            
            
        c: base 20x20 red data "down" rate 60
            on-time [scroll c]            

        d: base 20x20 yellow data "down" rate 80
            on-time [scroll d]  

        e: base 20x20 gray data "down" rate 100
            on-time [scroll e]  
            
    ]
]

rebolek
12:18@JohnPeoplefox nice!
JohnPeoplefox
12:19@rebolek Thanks!
rebolek
12:19you can simplify the code a bit, like for example:
square/data: switch pos [
        280 ["up"]    
        1 ["down"]
    ]

    square/offset: square/offset +  switch square/data [
        "down" [0x1]
        "up" [0x-1] 
    ]

12:22Also, you can write your own style to make thing simpler a bit:
Red [needs: 'view]


scroll: function [square] [

    pos: square/offset/y

    switch pos [
        280 [square/data: "up"]    
        1 [square/data: "down"]
    ]

    switch square/data [
        "down" [square/offset: square/offset + 0x1]
        "up" [square/offset: square/offset - 0x1] 
    ]    

]

view [
    panel 150x300 [
        style mybox: base 20x20 green data "down" rate 20
            on-time [scroll face]

        across
        mybox green rate 20
        mybox blue rate 40
        mybox red rate 60
        mybox yellow rate 80
        mybox gray rate 100
    ]
]
9214
12:23@JohnPeoplefox WIP factored version
Red [
    Title: "Simple animation"
    Author: @JohnPeoplefox
    Needs:  View
]

scroll: function [square][
    square/data: any [
        select [280 "up" 1 "down"] square/offset/y
        square/data
    ]

    switch square/data [
        "down" [square/offset: square/offset + 0x1]
        "up" [square/offset: square/offset - 0x1] 
    ]    

]

view [
    size 160x300
    style box: base 20x20 data "down" on-time [scroll face]

    box green rate 20
    box blue rate 40        
    box red rate 60          
    box yellow rate 80
    box gray rate 100
]
12:23I'd also generated box ... stuff
JohnPeoplefox
12:34oh great, thanks all!
9214
12:45
text
Red [
    Title: "Simple animation"
    Author: @JohnPeoplefox
    Needs:  View
]

scroll: func [box][
    box/data: any [
        select [280 up 1 down] box/offset/y
        box/data
    ]

    box/offset: switch box/data [
        down [box/offset: box/offset + 0x1]
        up   [box/offset: box/offset - 0x1] 
    ]    

]

colors: [green blue red yellow gray]
canvas: [
    size 160x300
    style box: base 20x20 data 'down on-time [scroll face]
]
boxes: collect [
    r: 0
    forall colors [
        keep reduce ['box colors/1 'rate r: r + 10]
    ]
]

view append canvas boxes
rebolek
12:48:+1:
JohnPeoplefox
12:49Thanks, I'll have to experiment with it
9214
18:33is it possible to search for a given object! by its class identifier?
>> class-of object []
== 1000003
rebolek
18:36How did you even find this stuff.... I was working on some unique identifier of object for my ultramold and well, it exists.
9214
18:39@rebolek I'm not sure that it should be used that way, it's a WIP feature of ownership system
18:39just had a little idea for esolang, or rather esodialect
rebolek
18:39Hah, cheating
>> class-of system/words
== -1

You can't expand objects, unless you are the author of the language.
9214
19:10@rebolek was it addressed to me?
rebolek
19:54@9214 no, just general observations
19:58or was it you who made object non-extensible? :)
loziniak
21:11Hey, guys. I'm back with another problem.
Red []

test1: function [
	num [integer!]
	cb_arg [function! [param [integer!]]]
][
	cb: function [
		param [integer!]
	][
		do [cb_arg param]
	]

	#system [
		print "function "
		#call [cb 12]
;		print num ;; *** Compilation Error: "undefined symbol: num"
	]

]

test2_r: routine [
	num [integer!]
	cb [function! [param [integer!]]]
][
	print "routine "
;	#call [cb 14] ;; *** Compilation Error: "invalid #call function name: cb"
	print num
]

f: function [
	param [integer!]
][
	print ["param: " param]
]

test1 66 :f
21:12i'd like to do both things: call a function and access an argument . is it possible?
greggirwin
22:02@JohnPeoplefox nice!
22:03And welcome to the great Red optimizer, where distributed wetware comes to play.
22:05@loziniak, the first thing I see is that [function! [param [integer!]]] isn't valid in a Red func spec. That is you can't, currently, match on a func arg's spec that way.
22:08Is test2_r there for a reason? Does't appear to be used.
22:13I'm happy to be corrected but I also think that your num compilation error is because #system doesn't magically know the Red func arg names.

virtualAlan
00:39Hi, had a message on my site asking how to get a Licence key for Rebol SDK 278-3-1- can anyone help ?
greggirwin
03:56They no longer sell license keys, but we want to find a general solution that will help more people build Red on their own. Nothing set yet, but it's a goal.
ne1uno
07:40the red build without sdk/keys does not work correctly?
rebolek
07:43It does, you just need SDK keys to build Red exe (not to use compiler, compiler works perfectly fine without keys).
9214
07:44Red toolchain contains encapped Rebol interpreter, and it's possible to embed it only with SDK
rebolek
07:45I have SDK key, but never used it for building Red, compiler is good enough for me.
ne1uno
08:05still sounds like a no, it doesn't work correctly
9214
08:06@ne1uno what do you mean by "doesn't work correctly"?
08:06-c bug?
ne1uno
08:07if I can't embed the rebol interpreter what I build is not the same as the official distribution somehow? and how could it not matter?
rebolek
08:08It depends on what you're trying to achieve. Do you really need Rebol interpreter embedded in your build?
9214
08:08Why should it matter? You have all functionality that Red toolchain provides even without encapped Rebol
08:08ah, wait
ne1uno
08:08I noticed someone mention the sdk on the arch download page linked from the red download page. it's probably confusing people there too
9214
08:09@ne1uno you're building your Red from source, right?
08:09and then you get cryptic -c error?
ne1uno
08:09yes. and it seems to work ok except for commandline processing
9214
08:09that explains everything I suppose
08:10since you can't embed Rebol, and current compiler is written in R2, you can't compile your scripts
08:10so you need to stick with official builds
ne1uno
08:10they custom build on the arch page is also getting the error. so I guess we have the problem
9214
08:11yes, because whoever ships this custom builds doesn't have SDK key and can't embed Rebol inside toolchain executable
ne1uno
08:11I ran a linux vm with a nightly the other day and that worked ok. cross compiling an exe
9214
08:11@ne1uno I encourage you to check if compilation works with *official* build on Win7
ne1uno
08:12it's not only compiling, even --help fails
9214
08:12if what I've said is correct, then everything should work out of the box
08:12yes, because embedded R2 is called whenever you invoke toolchain with command line argument
ne1uno
08:12one of the nightly will probably work ok. thanks for the answers
9214
08:12no Rebol - no functionality
ne1uno
08:13have to find a better way to explain it on the download page. it mentions building red but doesn't tell you there will be consequences
9214
08:14we probably need to document this in readme and come up with more adequate solution for custom builds
08:14@ne1uno yes
ne1uno
08:40wonder now why lepinekong_twitter was getting the args error? I don't think he has custom built red. maybe something in his commandline was off?
9214
08:41@ne1uno IIRC he mentioned that he used some custom cmd shell
ne1uno
08:49ok, I thought I remembered he was averse to custom build
08:51with nightly -c -t windows just makes a dll, -c -t msdos create an exe but it's not working well, prints a bunch of gibberish and then access violation. this is way harder than you all make it look
9214
08:51makes a dll..?
ne1uno
08:52the exe built from the same day linux nightly worked ok
9214
08:53what about -r flag?
ne1uno
08:53no executable, just the dll and calling code. -t Windows, I guess that is a shared lib?
9214
08:53are you talking about libRed dll?
ne1uno
08:54libRedRT.dll defs & include too.
9214
08:55I recall that there was some cryptic Draw-related error during compilation on Linux, even though I just compiled empty script
ne1uno
09:01was that wine? I have better luck with utf8 encoding, anything but pure aschiii in the file gave me an error, copy & paste from anywhere these days is likely not 100% aschii
09:04I had verbose 3 when I compiled -t windows, way too much output for the scrollback. maybe there was an error I missed why it didn't make an executable
9214
09:05no, IIRC I didn't use Wine
09:06try -r and -r -e flags
ne1uno
09:08using -r, there was an error, windows target needs view. I may have had a dll in that dir already and it just rebuilt it using -c
9214
09:08extend your script header to Red [Needs: View]
ne1uno
09:09not 'view
9214
09:10there's no difference
ne1uno
09:15I think rocket science is simpler
09:16-r makes a windows exe but it doesn't do anything when run
9214
09:16and what should it do?
ne1uno
09:21print, just tried it again, no errors in the compile but bad exe. probably someone else would have noticed a problem by now. this was a nightly from a few days ago
09:28 -t msdos or -t windows produces corrupt exe but without -t the msdos exe seems to be ok
9214
09:31@ne1uno https://github.com/red/red/issues/3221
ne1uno
09:33thanks, missed that one
9214
09:33try something like view [text "test"] instead
ne1uno
09:34how does that travis tester or whatever not catch this? wouldn't tests break right away?
9214
09:36If I'm not mistaken, most tests target interpreter, not compiler
rebolek
09:36they should target both, IIRC
9214
09:37@PeterWAWood ? :point_up:
ne1uno
09:38it may be looser on compile error reporting? tests would avoid errors or be fixed
09:43@9214. view text works. will just have to remember compiler not 100% done yet
9214
09:44@ne1uno if compiler limitations get in your way, you can always use encap mode (supply -e flag among with -r or -c)
PeterWAWood
09:53@9214 The tests are written to run under both the compiler and the interpreter. Each tests in run twice, once compiled and once interpreted.

A small number of tests are coded to only run under the compiler and a similar number are coded only to be interpreted.
9214
09:54thanks @PeterWAWood
PeterWAWood
09:55Compiling a Red script does not mean that it will be completely compiled to machine code. Parts of the program, normally the most dynamic parts, will be be compiled to machine code.
9214
09:55you mean "won't be compiled"?
rebolek
09:56for example anything in do [] is not compiled but interpreted
PeterWAWood
09:56Yes, I meant won't be compiled.
09:57In fact, we simply insert do [ at the beginning of each test source and ] at the end and then compile the test to run it under the interpreter.
ne1uno
11:35it's probably not testing every dumb combination of options a user will

dreamyToto_twitter
10:24Hello, sorry to post here, where can I post a question on Rebol-based Cheyenne server, on its ability to process REST GET requests ?
9214
10:50@dreamyToto_twitter I believe it's the right place for your question, but @dockimbel (author of Cheyenne) is on a vacation now and won't be able to answer to you in full detail
10:51maybe @greggirwin or other old-timers can help
dreamyToto_twitter
11:05@9214 Thank you. Great that Nenad is in vacation, considering all the personal investment on Red during last years... No problem, but if anyone knows Cheyenne server, I will be glad to have some help.
11:33Is Rebol-based Cheyenne server able to process REST GET requests like « /product/1234» (with data in the URL, not as parameters) ? It could be possible if Cheyenne redirects URLs with wildcards like «/product*» or
«/product/*» and to a single RSP page. Is it possible through configuration ? Thanks
11:48I've done a few tries without success
11:56Sorry, wildcards don't appear at the end of the 2 URLs
12:10REST URLs like '/product/<productId>'
abdllhygt
9214
15:14hi @abdllhygt, how is your scripting language going? :)
abdllhygt
15:15aaah i don't have time and motivation :( :)
9214
15:15welcome to the club :D
abdllhygt
15:15:D :D
15:16we can do somethings maybe :)
15:17how can i run console code? so "echo 'hi'" bash code in red?
9214
15:17@abdllhygt use call
abdllhygt
15:18thank you, i will try now
9214
15:19/console refinement works only for CLI
>> call/console "echo hi"
hi
== 0
15:20see ? call for details
abdllhygt
15:20thanks!
15:20i run red "./red-063" in linux
15:21i want to run "red" like python or ruby
15:21can i do?
9214
15:21open a REPL in console or just execute a script?
BeardPower
15:22Is there some timer facility in Red? Like the rate for facets, but for general usage?
9214
15:22@BeardPower a counter of some sort? I don't think so.
abdllhygt
15:22@9214 both
9214
15:23well, maybe somewhere in system
abdllhygt
15:23so i want install
9214
15:23@abdllhygt to launch REPL, just type ./red-063 when you're in a working directory
BeardPower
15:23@9214 Yes. Does not need to be a high-precision timer. I see.
9214
15:24@BeardPower maybe you can use now
15:24@abdllhygt and to execute a script, ./red-063 your-script.red
BeardPower
15:25@9214 Yeah, thanks. That would work.
abdllhygt
15:27@9214 i know this :) i want to execute a script red my-script.red
15:28i run python python my-script.py, so i don't use ./python..
9214
15:28I see, you'll need to add red to your $PATH for that
abdllhygt
15:29how? can i find in google?
9214
15:29@abdllhygt sure
abdllhygt
15:29thanks!
9214
15:29https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path
15:30though on *nix there's another program named red
15:30some version of ed I presume
BeardPower
15:31Creating an alias would be a solution.
9214
15:32@abdllhygt in my case it was
isheh@sam ~/dev/red $ PATH=$PATH:~/dev/red/
isheh@sam ~/dev/red $ red-063
--== Red 0.6.3 ==-- 
Type HELP for starting information. 

>> print "hello!"
hello!
15:33yes, or add an alias to your bash config
abdllhygt
15:36i can't do it, after i will try
BeardPower
15:37Is this a limitation of the REPL? It does not print out anything. loop 4 [print now] just prints the output, when the loop ended.
15:38
forever [
    print now
]
9214
15:38@BeardPower https://github.com/red/red/issues/2627
abdllhygt
15:38now i want:
call/console "value=hi"
call/console "echo $value"
BeardPower
15:39@9214 Jesus, are you storing these links somewhere? Faster than light :smile:
9214
15:39@abdllhygt I'm not a bash guru, but does it support syntax like that?
15:39ah, I see $ now
abdllhygt
15:41yes it's working now in bash
15:42but doesn't work in red call
15:42i guess red doesn't support console session
9214
15:42@abdllhygt is it possible in other languages though?
15:42@abdllhygt https://stackoverflow.com/questions/48790877/setting-persistent-environment-variables-between-multiple-calls-in-rebol-or-re
abdllhygt
15:42i don't try in other languages
9214
15:43
text
>> set-env "value" "test"
== "test"
>> call/console "echo $value"
test
== 0
abdllhygt
15:44this is good thank you :)
9214
15:45@BeardPower
https://www.youtube.com/watch?v=0FSKTndbwVo
BeardPower
15:45:+1: I love that series!
15:47I wished I could do the same.
9214
15:47@BeardPower you have Doodle Palace instead ;)
15:48new face for each memory
BeardPower
15:49Off to the DP then :)
rgchris
16:08@dreamyToto_twitter There is a StackOverflow tag for [Cheyenne](https://stackoverflow.com/questions/tagged/cheyenne) questions.
dreamyToto_twitter
16:25@rgchris thank you.
16:28I will check it
rgchris
17:19It's a good place to get the attention of any Cheyenne users that aren't Doc, and to leave the question (and answers presumably) where they can be found by others.
dreamyToto_twitter
18:24@rgchris Thanks. I've posted my question there.
greggirwin
19:48@dreamyToto_twitter, maybe @x8x will show up and offer some advice. @PeterWAWood may also know if Cheyenne can handle REST args like that.
abdllhygt
rebolek
20:09@abdllhygt hello!
abdllhygt
20:30i fixed the problem, goodnight :)
rebolek
dreamyToto_twitter
20:36@greggirwin Thank you !
x8x
21:42@dreamyToto_twitter In httpd.cfg where you configure your domain, add on-status-code like below:
www.domain.com [
	default [%index.rsp]
	on-status-code [
		404 "/index.rsp"
	]
	;your other settings here
]

index.rsp will get all requests for any url
Use this to get the requested url inside index.rsp:
url: select request/parsed/headers 'internal-referer
greggirwin
22:06Thanks for jumping in @x8x!
x8x
22:32Cheyenne is an amazing piece of Art! Can't wait for a Red version. :sparkles:
dreamyToto_twitter
22:40@x8x thank you very much ! Playing with 404 for that, great idea ! I will try this tomorrow morning. I use Cheyenne as a simple REST web service mock on a project. Yes, Cheyenne, Mysql driver, of course Red...all what Doc does is kind of «simple and beautiful», and powerful for sure ! Future Red-based application server should be way more powerful...

rgchris
03:45Getting a bit of weirdness using a function from within an object in an INCLUDE'd file in a compiled program. Anyone else having this problem?
03:47file-1.red
Red []
obj: make object! [
    foo: "Foo"
    bar: func [arg][probe foo probe arg]
]
bar: get in obj 'bar


file-2.red
Red []
#include %file-1.red
probe bar "Baz"

03:48Instead of getting "Foo" "Baz" "Baz", I'm getting the source of the function.
04:01Looks like this is pertinent: https://github.com/red/red/issues/924
greggirwin
06:05Sounds like you need to use get-path! syntax for now. The ticket at least has a really good explanation.
06:48@rgchris et al, I started a page where we can collect notes on compiler limitations: https://github.com/red/red/wiki/Compiler-Limitations
rgchris
16:11It'd be helpful to have a primer somewhere on how the compiler, um, interprets code (if this exists, I do apologise for overlooking it). Perhaps just a few examples of code that works differently when compiled vs. interpreted. I can't figure out after a few hours why my USE macro breaks the compiler or under what conditions a function doesn't operate properly (it's not just the above ticket).
16:12I've tried building a function from blocks contained within an object and have the same result.
rebolek
16:15So far the compiler is fine for mostly static code - no fancy stuff as binding, function creation on runtime, etc. The dynstack branch should probably help with this. And you can always use do in compiler, when something doesn't work.
rgchris
16:16@rebolek Is there documentation on this?
16:18I'd like to have a stab at getting some things working, but trial and error can be pretty time consuming.
rebolek
16:20@rgchris I believe that beside what you can gather from blog articles, there's no doc.
16:21It will be improved eventually, do writing docs would be wasted time, unless some volunteer does it.
rgchris
16:23@rebolek Are there any insightful blog articles outside of red-lang.org on this?
rebolek
16:25None that I know about :(
rgchris
16:25Just looking for any notes that someone might have taken from a similar noodling around.
BeardPower
16:26What about https://github.com/reddoc/develop?
16:26https://github.com/reddoc/develop/wiki
16:28A lot of useful insights and info.
9214
16:34@rgchris don't forget that compiled macros currently relies on R2, which isn't 100% compatible with Red
16:36@rgchris I actually have my scars to show which are similar to your problem https://github.com/red/red/issues/2910
16:38solution is to either wrap troublesome parts of code in do [...] or to use encap mode
16:39but limitations of compiled macros won't go away until compiler is rewritten in Red (if I'm not mistaken)
rgchris
16:47Appreciate the links, and updated the page Gregg posted.
BeardPower
16:47:+1:
greggirwin

Ungaretti
rebolek
10:33@Ungaretti if you are on windows, compile Red with -t MSDOS
xqlab
10:43red.exe --cli
Ungaretti
10:58@xqlab @rebolek Thank you! xqlab answer is what I was looking for.
I was going crazy using "-cli" instead of "--cli".
11:03And is is it possible to write and save a script in cmd, as if cmd was an editor?
rebolek
11:04It can be done, but I don't think it would be very comfortable.
11:07for example you can save console session with save/header %history.red collect/into [foreach line system/console/history [keep reduce [line newline]]] {} []
Ungaretti
11:11@rebolek I see, thanks.
I'm musing with the idea of creating a little app to teach Red. Embed a full editor is beyond my capacity, but to embed the cmd prompt is quite doable. However, saving a script is a must. I'll play with the code you posted.
rebolek
11:12@Ungaretti do you know the livecode demo? It may be good fit for you.
Ungaretti
11:15@rebolek I'll search it.
rebolek
11:16@Ungaretti see for example here https://gist.github.com/DideC/85d60c99f97f2e4972a6f7b09a1fe630
11:16it's for wditing VID layouts, but you can easily change it to support all types of code plus add "save" button, the code is very simple.
Ungaretti
11:17@rebolek Very interesting! Yes, it may be helpful! Thanks!
rebolek
11:18you're welcome
greggirwin
16:37@Ungaretti you won't be able to easily use the command shell as an editor. The behavior will be different on each platform in how you'd have to try and hook it. There are some other simple IDE experiments people have done, including the one @rebolek linked to above. @virtualAlan, @vulnz, and others have built tools with buttons to compile and run, etc.
dreamyToto_twitter
19:25@x8x @rgchris @greggirwin by the way, thank you very much for the 404 trick in Cheyenne !
19:27My REST web service mock works perfectly !
19:31The drawback : it's difficult to keep default 404 behavior (by configuration) for another webapp running on the same Cheyenne server, no ? But, it's OK for my mock !
rgchris
22:53I could probably amend my SO answer, but the alternative I believe is to write a service module to replace e.g. CGI with a different handler. It would take a bit more work but may ultimately be a better fit.
BeardPower
23:43@rgchris Sorry, but what is a SO answer?

gltewalt
00:40Stack Overflow (website)
BeardPower
00:44Ah! :+1:
JohnPeoplefox
08:26I am experimenting with loops. In a repeat loop I try construct a pair! with the index. Here is the code

Red[]

coordinates: func [] [
    repeat x 20 [
        to-pair [x 1]
    ]
]

coordinates


Here is the error I get
*** Syntax Error: invalid construction spec: [x 1]
*** Where: to
*** Stack: coordinates to-pair
9214
08:28@JohnPeoplefox try to-pair reduce [x 1]
08:28or as-pair x 1
JohnPeoplefox
08:29@9214 worked thanks :smile:
10:23ok, after a couple of hours I'm throwing in the towel. I'm trying to plot a sine function. Here is the full code:


Red[Needs: 'view]


coords: []

coordinates: func [] [
    repeat i 400 [
        factor: i * 0.04
        s: sin factor
        amplitude: s * 80
        integ: to-integer amplitude
        x: integ + 150
        append coords as-pair x i
    ]
]
coordinates
print coords

view [
    canvas: base 400x300 white
    draw [line 0x150 400x150]
    draw [line coords]
]


I'm quite sure I calculated the coordinates right (I printed them). The problem is that the coordinates are in a series (coords) and line won't accept a series as the argument. The error I'm getting is

*** Script Error: invalid Draw dialect input at: [coords]
*** Where: ???


9214
10:26@JohnPeoplefox view compose/deep [... draw [line (coords]]
JohnPeoplefox
10:30@9214 thanks again, works perfectly!
9214
10:34@JohnPeoplefox you also mixed up x and i near as-pair
JohnPeoplefox
10:35@9214 yes, figured that out
9214
10:35and use only one draw block
10:35
text
[line 0x150 400x150 line (coords)]
JohnPeoplefox
10:36@9214 got that one too :smile:
10:37@9214 sorry to bother you again, any resources on changing the evaluation order of math operations, my coordinates function is pretty clumsy
9214
10:37@JohnPeoplefox use math dialect
10:38though it only supports * and / precedence
rebolek
10:38don't
10:43@JohnPeoplefox
coordinates: func [] [
    repeat i 400 [
        amplitude: 80 * sin i * 0.04
        append coords as-pair amplitude + 150 i
    ]
]
10:43you can do it as on liner also
JohnPeoplefox
10:46@rebolek I shouldn't bother with to-integer?
rebolek
10:47@JohnPeoplefox no
>> as-pair 3.14 1.619
== 3x1
JohnPeoplefox
10:47@rebolek oh great
10:49@rebolek Just one more question, can I call coordinates in a do block within view ?
rebolek
10:50@JohnPeoplefox I guess you can, maybe I don'd understand. Do you have some example?
JohnPeoplefox
10:52@rebolek something like this

Red[Needs: 'view]


coords: []

coordinates: func [] [
    repeat i 400 [
        amplitude: 80 * sin i * 0.04
        append coords as-pair i amplitude + 150
    ]
]

;coordinates

view compose/deep[
    canvas: base 400x300 white
    do [coordinates]
    draw [
        pen green line 0x150 400x150
        pen blue line (coords)]
]
10:52but i get a syntax error
rebolek
10:56@JohnPeoplefox because drawmust follow style to which it will draw. Move do line up:
view compose/deep[
    do [coordinates]
    canvas: base 400x300 white
    draw [
        pen green line 0x150 400x150
        pen blue line (coords)
    ]
]
9214
10:58
text
Red [Needs: View]

coordinates: collect [
    repeat x 400 [
        keep as-pair x add 150 80 * sin x * 0.04
    ]
]

view compose/deep [
    base 400x300 white draw [
        line 0x150 400x150 line (coordinates)
    ]
]
rebolek
10:59:+1:
JohnPeoplefox
11:00ok guys I won't bother you anymore today that's quite enough for me to process :smile:
9214
11:09@JohnPeoplefox your homework for today :mortar_board:
Red [Needs: View]

coordinates: collect [
    keep [line 0x150 400x150 line]
    repeat x 400 [
        keep as-pair x add 150 80 * sin x * 0.04
    ]
]

view [base 400x300 white draw coordinates]
JohnPeoplefox
11:24@9214 :worried:
abdllhygt
18:15how to size? [1 2 3] ?
18:20i find length?
rgchris
18:43@abdllhygt I wrote a [series primer](https://medium.com/@rgchris/understanding-rebol-series-d5d6f597a239) (for Rebol, but applies to Red)
abdllhygt
18:46thanks @rgchris
19:44hi again!
19:44i can't use switch in switch :(
Phryxe
19:54@abdllhygt It is easier to understand with a short example.
abdllhygt
19:56
switch (length? textS) [
            2 [ switch (length? textS/2)  [...

is not work, and i use case in switch now, thanks
Phryxe
20:10
x: 20
y: 10
switch x [
	10 [print "x = 10"]
	20  [
		print "x = 20"
		switch y [
			10 [print "y = 10"]
			20 [print "y = 20"]
		]
	]
]

This works ...
abdllhygt
20:20@Phryxe interesting :) so, error on me sorry
greggirwin
22:45@9214, you're going to make @JohnPeoplefox's head implode*! I love it!

*What happens when Reducers refactor. Things become so dense and powerful that we we create an infrared hole that looks almost black.
22:46The great Redshift if coming.

snotbubble
04:51compiling in Linux with this code gives me this error:
*** Compilation Error: undefined word font!

marks: make font! [size: 8 name: "courier new" style: 'bold]
append canvas/draw compose [font (marks)]


Is there a different way to do this in Linux?
PeterWAWood
04:55@snotbubble There is no Linux compatible GUI backend in the current Red alpha releases.
snotbubble
04:59ah ok, so for windows Red is grabbing its UI from the OS?
PeterWAWood
05:07The current Red GUI backends are a native Windows backend and a native macOS backend. Red GUI backends could be written for both native or cross-platform UI frameworks (that have a C-style API).

It is most likely that a GTK+ will be included in the "standard" Red distribution at some stage in the future.

In fact, some members of the community have made a good start on a GTK+ backend.

It is not currently clear when a GTK+ backend will be available. I think we will get the first indication when the Red roadmap is updated to include the Red blockchain dialect.
greggirwin
05:29@snotbubble Red runs fine under Wine, if that's an option.
JohnPeoplefox
11:05I'm trying to recursively enumerate a directory tree. I don't have much code to show, but here it is anyway

Red[]


enumerate: function [root] [

    items: read to path! root
    foreach item root[
        is-dir: dir? item
        either is-dir
            [print item]
            [enumerate item]
    ]
]

enumerate %/c/red/
11:18My starting point was this, which works for a single directory:

Red[]


items: read %/c/red/

foreach item items [
    print item
]
12:01Ok, after some digging through Rebol docs I kind of made it work

Red[]


enumerate: function [root] [

    
    items: read root
    
    foreach item items[
        either dir? item
            [
                print ["directory " item]
                enumerate root/:item
            ]
            [print ["    file " item]]
    ]
]

enumerate %/c/red/
rebolek
12:19@JohnPeoplefox if want to add indentation, try something like
enumerate: function [root] [
    indent: ""
    enum: func [root][
        items: read root
        foreach item items [
            either dir? item
                [
                    print [indent "directory " item]
                    append indent "    "
                    enum root/:item
                    remove/part indent 4
                ]
                [print [indent "file " item]
            ]
        ]
    ]
    enum root
]
JohnPeoplefox
12:20@rebolek thanks
12:20one quick question. Does Red support TCO?
rebolek
12:21What is TCO?
JohnPeoplefox
12:21tail call optimization to avoid stack overflow
rebolek
12:21Ah, I see. No.
JohnPeoplefox
12:22ok, I'm sure it will at some point :smile:
rebolek
12:22We will see :)
BeardPower
12:25@rebolek Time to mention the "Mill" again. It has TCO out of the box ;-)
rebolek
12:25hmmm :)
BeardPower
12:26I need to rename my myself to "MillPower :smile:
Ungaretti
14:47Sorry, but what is "mill"?
rebolek
14:48@Ungaretti https://en.wikipedia.org/wiki/Mill_architecture
Ungaretti
14:49Thanks.
BeardPower
14:56@Ungaretti There is an error in the wiki page.
>Registers 33

The MIll does not have any registers at all, it has a belt.
14:56It can do 33 instructions per cycle.
greggirwin
18:12BlackBeard, BlueBeard, MillBeard. Arrrrrr!

JohnPeoplefox
11:09I have a basic question: Is there a reference about which faces accept which types of events?
9214
11:11@JohnPeoplefox no, but it's more or less intuitive
https://doc.red-lang.org/en/view.html#_events
11:13also system/view/handlers
JohnPeoplefox
11:16@9214 Thanks!

snotbubble
14:19are commandline args readable without red-system?
9214
14:20@snotbubble system/script/args and system/options/args
snotbubble
14:33@9214 excellent thanks
14:33also how to block-comment ?
9214
14:33@snotbubble can you clarify?
14:34there's a comment function that just eats its argument and returns (almost) nothing
snotbubble
14:34multiline comment instead of using ; on each line
9214
14:35@snotbubble
comment {
...
}
14:36you can use (...) or [...] if you want; as I said, comment just receives its argument and doesn't return anything back
14:37in fact it returns unset, but that shouldn't be a problem in most cases
snotbubble
14:37@9214 too easy thanks!
BeardPower
14:53@9214 You posted a stacktrace of a Red program lately. How can did be done?
14:54What was the magic command? :)
9214
14:54@BeardPower can you remind me what exactly I posted? :D
BeardPower
14:55Can't find it on this shitty gitter search... You basically posted a bug of a program and also the stack-trace of it.
9214
14:56hmmm, I don't think I used any magic, stack trace was shown during attempt at compilation
BeardPower
14:56Ah, ok. I thought there was something like gdbst command for printing the stack-trace.
9214
14:57@BeardPower if we're talking about compilation, you can play around with -v and hight verbosity levels
BeardPower
15:00All clear :)
9214
15:01@BeardPower ah, set system/state/trace to bigger integers
BeardPower
15:01I was just testing the Drawing pad from @toomasv on macOS and wanted to provide the most info.
9214
15:01
text
>> 1 / 0
*** Math Error: attempt to divide by zero
*** Where: /
*** Stack:  

>> system/state/trace: 1337
== 1337
>> 1 / 0
*** Math Error: attempt to divide by zero
*** Where: /
*** Stack: launch launch either run while eval-command if either switch either do-command unless case print type? try either = set catch /
15:02default is 1
BeardPower
15:02So what is a high enough value?
9214
15:03depends on how deep you want to go ;)
BeardPower
15:03Back in time, of course ;-)
15:04Maybe I will find @greggirwin 's new blog post :smile:
meijeru
17:20For me, on W10, system/state/trace: 2 gives the same as your 1337.
OneArb
20:42Since I tested the latest build I get strange behaviors even when running the stable release.

I no longer get the console when running a Red executable.

Same when I compile for Windows target.

I get a procedure exec/f_quit unfound when running an exe I managed to compile.

When spaces in the .red file, the .exe output name only include chars till the first space, so .exe file name is truncated.

I get the following unless I compile in release mode:

Target: MSDOS 

Compiling to native code...
*** Compilation Error: attempt to redefine existing function name: red/object/get-values 
*** at line: 1 
*** near: [332x1 
    #import ["libRedRT.dll" stdcall [
            push: "red/object/push" [ctx [pointer! [integer!]] class [integer!] idx-s [integer!] loc-s [integer!] idx-d [integer!] loc-d [integer!] return: [red/red-object!]] 
            duplicate: "red/object/duplicate" [src [pointer! [integer!]] dst [pointer! [integer!]]] 
            transfer: "red/object/transfer" [src [pointer! [integer!]] dst [pointer! [integer!]]] 
            init-push: "red/object/init-push" [node [pointer! [integer!]] class [integer!] return: [red/red-object!]] 
            init-events: "red/object/init-events" [ctx [pointer! [integer!]] idx-s [integer!] loc-s [integer!] idx-d [integer!] loc-d [integer!]] 
            loc-fire-on-set*: "red/object/loc-fire-on-set*" [parent [red/cell!] field [red/red-word!]] 
            fire-on-set*: "red/object/fire-on-set*" [parent [red/red-word!] field [red/red-word!]] 
            get-values: "red/object/get-values" [obj [red/red-object!] return: [red/cell!]] 
            unchanged?: "red/object/unchanged?" [word [red/red-word!] id [integer!] return: [logic!]] 
            unchanged2?: "red/object/unchanged2?" [node [pointer! [integer!]] index [integer!] id [integer!] return: [logic!]] 
            get-word: "red/object/get-word" [obj [pointer! [integer!]] index [integer!] return: [red/cell!]] 
            get-values: "red/object/get-values" [obj [red-object!] return: [cell!]]
        ]]
]
Ungaretti
23:43I would like to make a script delay it's processing for 0,5 seconds. wait doesn't seem to be a good idea, since it doesn't behave well on console. I can' extract milisseconds from now. Create a face with a rate seems like too much for a silly delay. Any suggestions?

snotbubble
01:55getting double backslash in paths with:
asubdfile: to-local-file/full %ffmpeg/bin/ffmpeg.exe
afile: to-local-file/full %test.txt
probe asubdfile
probe afile

{C:\1\test\\ffmpeg\bin\ffmpeg.exe}
"C:\1\test\\test.txt"


it seems like /full is adding the extra backslash,
how to get only one backslash?
PeterWAWood
02:38It looks like a bug to me. Using clean-path instead of the /full refinement should work:
>> to-local-file/full %test.txt
== "E:\Red\red\\test.txt"
>> clean-path %test.txt
== %/E/Red/red/test.txt
>> to-local-file clean-path %test.txt
== "E:\Red\red\test.txt
02:40@snotbubble I pasted the wrong line ^^^ and have now updated it.
snotbubble
02:58@PeterWAWood got it thanks!
03:06also is there a quick way to do something lilke block/-2 ?
03:06to get the 2nd last item
toomasv
04:00@snotbubble
skip tail block -2

snotbubble
04:34@toomasv
b: [1 2 3 4 5]
r: skip tail b -2
probe r

returns [4 5]

b: [1 2 3 4 5]
r: pick b ((length? b) - 1)
probe r

returns 4, but seems like a lot of work
toomasv
04:37Ah, you want to get single item:
b: [1 2 3 4 5]
first skip tail b -2
== 4

Or:
b: [1 2 3 4 5]
b/(-1 + length? b)
== 4

Or:
b: [1 2 3 4 5]
i: -1 + length? b
b/:i
== 4
gltewalt
04:44
>> i: (length? b) - 1
== 4
>> b/:i
== 4
snotbubble
04:44Thanks Toomas, still a lot of typing compared to b/-2
toomasv
04:44True, but I guess negative indexes can't be univocally interpreted. Consider this:
b: skip [1 2 3 4 5] 2
== [3 4 5]

what should b/-2 return? 4 or 1?
OK, you can make them return from tail always. But why not from current location as positive indexes?
gltewalt
04:46
>> reverse b b/2
== 4
snotbubble
04:54@gltewalt nice, but have to deepcopy to use the original block later, or keep reversing ?
gltewalt
04:54Probably safer to copy
04:54Otherwise, yeah you'll have to reverse the block again after you get your value
9214
05:00@snotbubble
>> pick tail [a b c d] -2
== c
>> at tail [a b c d] -2
== [c d]
gltewalt
05:12@BeardPower @rebolek Does stack traces
05:15@snotbubble The reason why b/-2 doesn't work is because the pointer is parked at head with a new block. -2 is outside the bounds of b, so you get none
05:16
>> b: next b
== [2 3 4 5]
>> b/-1
== 1
05:17
>> b: tail b b/-2
== 4
05:21
>> b
== [1 2 3 4 5]
>> bakurds: tail b
== []
>> bakurds/-2
== 4
snotbubble
05:36@gltewalt so pointer can't wrap around, understood.
05:38@9214 can at head be used to grab the 1st two items in the block?
05:49also can rejoin be used to insert a string between items? like "/".join(list) in python.
9214
07:16@snotbubble if you want first two items, you can use copy/part or take/part:
>> block: [a b c d]
== [a b c d]
>> copy/part block 2
== [a b]
>> block
== [a b c d]
>> take/part block 2
== [a b]
>> block
== [c d]
07:16as for rejoin... you mean like inserting comma after each element?
07:16this idea comes up frequently, I guess someone already proposed a mezzanine for that
07:31@snotbubble for now you can use something like
>> rejoin skip collect [foreach item "abcd" [keep [comma space] keep item]] 2
== "a, b, c, d"
snotbubble
07:40@9214 excellent thanks!
07:46when joining using to-path, is this the simplest way to get a path string?
b: ["one" "two" "three"]
p: to-string (to-path b)
9214
07:47@snotbubble
>> form to path! ["one" "two" "three"]
== "one/two/three"
07:52;)
>> replace/all form to path! ["one" "two" "three"] "/" ", "
== "one, two, three"
snotbubble
07:53@9214 nice thanks!
9214
07:56you're welcome :)
snotbubble
08:03one more thing: how to preserve ':' with to-path:
b: ["C:" "test" "one" "two" "three"]
p: form to path! b
d: read (to-red-file p)
probe p

*** Access Error: cannot open: %/C/test/one/two/three
9214
08:05@snotbubble it is preserved in string!, but file! has different format
08:05i.e. %/C/test/one/two/three path is correct, but since you don't have this folders and file, Red can't open it :)
snotbubble
10:42@9214 so no way to keep : in C: ?
9214
10:43@snotbubble ?
>> form to path! ["C:" "test" "one" "two" "three"]
== "C:/test/one/two/three"
PeterWAWood
10:56@snotbubble Red, like Rebol, stores file! in POSIX format. The "volumes:" form is not a valid file! value in Red:
>> %c:/test.bat
*** Syntax Error: invalid value at ":/test.bat"
*** Where: do
*** Stack: load
BeardPower
10:58What do you mean?
PeterWAWood
10:58A valid file! in Red would be /C/test.bat. Red accesses file using these POSIX paths.
9214
10:58@BeardPower does chat traces ;)
DideC
10:58@snotbubble you can handle files path as a string value if its convenient to "see" them like this, but use file! datatype for your program to work with them.
lp: ask "Enter file path ?"      ; Enter things like "c:\test\one\two\three"
rp: to-red-file lp
print ["You said:" lp newline " This path" either exists? rp ["is valid"]["does not exist !"]]
print ["This path is made of:" lpp: mold split lp #"\"]
print ["You can recreate it with:" lp2: collect [keep lp/1 foreach item next lp [keep #"\" keep item]]]
print ["Or work with the red syntax:" newline "This path is made of:" mold next rpp: split rp #"/"]
BeardPower
10:59@gltewalt >@BeardPower @rebolek Does stack traces
rebolek
10:59What do I do?
BeardPower
10:59What do you mean?
PeterWAWood
10:59So to preserve the :, you need to use to-local-file
>> b: ["C:" "test" "one" "two" "three"]
== ["C:" "test" "one" "two" "three"]
>> p: to-local-file form to path! b
== "C:/test/one/two/three"
BeardPower
11:01@9214 😁 That damn mobile gitter app. Is there a way to create a line feed?
11:02@rebolek I don't know what @gltewalt was trying to communicate. 🤔
snotbubble
11:12@9214 ok so red just isn't finding the path...
9214
11:13@snotbubble yes, because I suspect that you don't have test/one/two nesting folders with three file at the end ;)
DideC
11:14Typo in my previous code. Retyped:
Red []
lp: ask "Enter file path ?"      ; Enter things like "c:\test\one\two\three"
rp: to-red-file lp
print ["You said:" lp newline " This path" either exists? rp ["is valid"]["does not exist !"]]
print ["This path is made of:" mold lpp: split lp #"\"]
print ["You can recreate it with:" lp2: collect [keep lpp/1 foreach item next lpp [keep #"\" keep item]]]
print ["Or work with the red syntax:"]
print ["This path is made of:" mold next rpp: split rp #"/"]
rebolek
11:31@BeardPower Ah, ok then :)
snotbubble
11:52@DideC got it thanks, seems that to-red-file is adding a backslash before C: which is stopping read, which is odd as exists? says the path is valid...
Red []
b: ["C:" "one" "two" "three"] 
print["b = " b]
p: to-local-file form to path! b
print["to-local-file form to path! b = " p]
rp: form to path! b
print["form to path! b = " rp]
d: to-red-file rp
print["to-red-file = " d]
isd: exists? d
print["path exists?" isd]
rd: read d
probe rd
9214
12:02
text
>> read %/C/
== [%windows/ %users/ %Program%20Files%20%28x86%29/ %Program%20Files/]
DideC
12:04To be precise:
>> read %/c
*** Access Error: cannot open: %/c
*** Where: read
*** Stack:  

>> read %/c/
== [%$Recycle.Bin/ %Bat/ %program%20Files/]
tsebb
13:03Why is to Integer! "1" == 1 but to Integer! pick "1" 1 == 49
rebolek
13:04@tsebb because pick "1" returns char! and converting character to integer will return its ASCII value
tsebb
13:07Thx! On second thought, i'm ok with this semantics :-)
rebolek
13:08@tsebb ok then :)
tsebb
13:09i expected to have some kind of "ordinal " function for that
BeardPower
13:12Expect the unexpected :)
tsebb
13:18How to get the int value frpm Chat Thema
13:19How to get the int value fr om char
rebolek
13:20for example
>> load form #"1"
== 1
tsebb
13:20Without Cast to String or Substrat 48?
13:20Thx!
rebolek
13:21well this is with casting to string (form)
tsebb
13:29I see, imo sum: sum + form pick "123" 1 does not "s" good
13:29"sound"
rebolek
13:30@tsebb what exactly are you trying to achieve?
tsebb
13:31Sum Up values in a String, If The following Number is the same
rebolek
13:32@tsebb could you show some example of input data and expected output?
tsebb
13:35https://adventofcode.com/2017/day/1 :-)
rebolek
13:35Ah! ok :)
9214
16:42@tsebb we can come up with a solution for first stage together if you want, I think I have AoC snippets somewhere :)
gltewalt
16:46First you have to make a circular buffer
9214
16:47they're not necessary for the first part I think
gltewalt
16:48@rebolek Beardpower was asking how to do stack traces. You include stack traces often when you find an issue. So, “Ask rebolek”
rebolek
18:25@gltewalt oh, do I? It's from from debug version or something that OS prints itself. I'm certainly no expert on that, sorry.
gltewalt
19:13Ah, I see

greggirwin
03:04@snotbubble, et al, on the path! topic, I think there's possible confusion in how best to approach this, or how best to leverage Red types. File! values are a string type. There are some funcs that work on them, e.g. split-path that "know" about path separators, but the datatype itself doesn't. Path! values are block values, where each slot can contain a different type of Red value, though not every value type, and most commonly words. One thing they can't contain is a set-word! value in any slot other than the last value. If there is a set-word! in the *first* slot, they are currently lexed as a url!, which is a different question, but may help explain why you can't treat these types interoperably or convert between them with complete confidence.
03:06So, @snotbubble, my recommendation is that you *not* use path! when trying to make file values. What we need are a few more mezzanines to make what you want to do easy and safe.
03:12@tsebb, here's a trick, and a way of thinking, last one first. In Red, think of how you can make data easier to operate on. Don't take the data as it is and assume you have to do it like other languages do. In this case, you have a bit string of single digits, yes? You could use parse, but that might be a little tricky as you're counting. So how to make it easy to just loop on? Here's the trick. Put a space between each digit and use load on the result. Now you have a block of integers, which is easy to operate on.
03:35@snotbubble would you please open a ticket for the to-local-file/full issue?
tsebb
08:57@greggirwin thx for the input
09:00@9214 will post my solutions here, but not before weekend :-(
9214
09:02@tsebb :+1:
snotbubble
13:14@greggirwin is there a definitive guide to path/file massaging?

something like:

get a path as a string
from s make a block of path components
from either, make a red compatible path
read a block of dir path names
read a block of file path names
read a block of file-names

EG:
string path......... = "C:/one/two/three/"
block path.......... = ["C:" "one" "two" "three"]
red path............ = %/c/one/two/three/
read dir path block. = ["C:/one/two/three/backup/"]
read file path block = ["C:/one/two/three/file.001.ext" "C:/one/two/three/file.002.ext"]
read file name block = ["file.001.ext" "file.002.ext"]

from:
C:\one\two\three\
  backup\
  file.001.ext
  file.002.ext
maximvl
13:40@9214 for whatever reason it's called clean-path:
>> help clean-path
USAGE:
     CLEAN-PATH file

DESCRIPTION: 
     Cleans-up '.' and '..' in path; returns the cleaned path. 
     CLEAN-PATH is a function! value.
13:44it seems like we need a goodies package with "standard" names eg "absolute-path" instead of "clean-path" and others
13:48em the latest Red builds are from 26 February
13:48it seems like something broke there
9214
13:48@snotbubble
>> path: "C:/windows/"
== "C:/windows/"
>> split path #"/"
== ["C:" "windows"]
>> to-red-file path
== %/C/windows/
>> collect [foreach file read to-red-file path [if dir? file [keep clean-path file]]]
== [%/Z/home/isheh/dev/red/logs/ %/Z/home/isheh/dev/red/inf/ %/Z/home/isheh/dev/red/mono/ %/Z/home...
>> collect [foreach file read to-red-file path [unless dir? file [keep clean-path file]]]
== [%/Z/home/isheh/dev/red/twain_32.dll %/Z/home/isheh/dev/red/win.ini %/Z/home/isheh/dev/red/twai...
>> read to-red-file path
== [%logs/ %inf/ %mono/ %winsxs/ %syswow64/ %twain_32.dll %win.ini %Installer/ %Fonts/ %twain.dll ...
>> collect [foreach file read to-red-file path [unless dir? file [keep file]]]
== [%twain_32.dll %win.ini %twain.dll %winhlp32.exe %system.ini %regedit.exe %explorer.exe %notepa...
13:50@maximvl standard by what standards? :D
maximvl
13:50it's just something people in the industry use, I never heard anybody referring to "absolute path" as a "clean path"
9214
13:50you're asking to do that with language which has Mezzanines and facets ;)
13:51we even have our own definition of Purity
13:51"and our views about it are Immutable :^)"
maximvl
13:52that's great until you want more people to use the language ;)
9214
13:55I agree with that, but it's always nice to have local slang :)
maximvl
13:58@9214 let's test it, what do you think dirize does, without checking help? ;)
9214
13:59@maximvl makes a directory out of file
13:59i.e. appends / if needed
BeardPower
14:00Don't dirizeme, bro!
maximvl
14:00@9214 what about ellipsize-at ?
9214
14:00hmmmm
14:01adds ... or something like that?
BeardPower
14:01Bingo!
maximvl
14:01wat, how do you know
BeardPower
14:01Truncate and add, it if string is longer than len.
maximvl
14:02what does this even mean
9214
14:02maybe based on index/length of string
BeardPower
14:02@maximvl What exactly? ... is called an ellipsis.
9214
14:02@maximvl ellipsis is ...
14:03@BeardPower was faster this time :O
14:03even faster than @rebolek :exclamation:
maximvl
14:03I see, didn't know that one
BeardPower
14:03It's a term in type setting.
maximvl
14:03this is probably what is used to truncate long outputs
9214
14:03where's my portion of meldonium?!
BeardPower
14:04Have you ever written LaTeX?
maximvl
14:04I did, but never used ellipsis..
14:04how do you call two dots btw?
9214
14:04but you just used them in your message.. :)
14:04@maximvl ellipsi ? :D
14:04like func and function dichotomy
BeardPower
14:04@9214 Are you into curling? :smile:
9214
14:05nay, I'm more of a board/video game type :neckbeard:
BeardPower
14:05>@BeardPower was faster this time :O
even faster than @rebolek :exclamation:

The apprentice became the master and the master the apprentice ;-)
9214
14:06even the mighty shall fall...
BeardPower
14:07@maximvl >how do you call two dots btw?

Double dot.
maximvl
14:08@9214 what about read-thru ? :D
9214
14:09@maximvl *-thru functions are cache-related IIRC
BeardPower
14:09Reading past the character you specified.
maximvl
14:10@9214 what cache?)
BeardPower
14:10Mmm, cash related... :+1:
9214
14:10@BeardPower :smile:
14:11@maximvl [disk buffer](https://en.wikipedia.org/wiki/Disk_buffer) I suppose
dander
18:35@maximvl *-thru functions are described in the [0.6.3 blog post](http://www.red-lang.org/2017/07/063-macos-gui-backend.html)
maximvl
19:51@dander thanks, looks like I missed that part
TimeSlip
20:00I'm interested in creating a spinning wheel. I've seen at least one JS version which uses a library to do the animation. Since I can't easily see what the library is actually doing behind the scenes, I was wondering what you all think about the best way to spin an object is: 1. Creating a number of images and cycling; or 2: spinning the object programatically? Thanks in advance.
9214
20:02@TimeSlip I'd go with second option, just changing elements of the underlying Draw block
BeardPower
20:13Me too. Use the Draw dialect. It will be faster, have a lower memory footprint and vector graphics.
20:13Not to mention all the fancy animation possibilities and resolution independence.
greggirwin
20:15@maximvl, I fully support the goal of making things accessible. What would help here is concrete suggestions. I like absolute-path myself, and we can alias that easily if people want, but there's a reason Carl didn't use it. There's a reason for every word choice he made. "Clean" is shorter, that's one thing. Another is the goal of verb-noun naming. "Clean" is more verby. :^) Even absolute-path is jargon, yes? Maybe more people know it, but fully-qualified-path is even further down that spectrum, yes?

> let's test it, what do you think dirize does, without checking help?

This is a specious argument. Show me a language where anyone can guess how everything works and I'll use it. The fact is that we have help and we can (and *absolutely* should) write docs that help people find their footing when coming from other languages.
BeardPower
20:18@greggirwin
>Show me a language where anyone can guess how everything works and I'll use it.

Brainfuck? ;-)
9214
20:19J! ;)
greggirwin
20:19Of course, I always forget that one. ;^)
20:20Is there an APL/J version of BF? That would be something to see.
9214
20:20You mean parser?
greggirwin
20:21No, I mean a new language with BF syntax and J semantics.
9214
20:21hmmm, maybe some of multi-dimensional fungeoids
greggirwin
20:22Should make for interesting dreams tonight.
BeardPower
20:22I only know of JSFuck.
20:29@9214 Are you talking about Befunge?
9214
20:29@BeardPower yes, IIRC, there's a class of Befunge-like esolangs
20:30https://esolangs.org/wiki/Fungeoid
BeardPower
20:31People are sometimes just crazy:
Binary lambda calculus

Binary lambda calculus is designed from an algorithmic information theory perspective to allow for the densest possible code with the most minimal means, featuring a 29 byte self interpreter, a 21 byte prime number sieve, and a 112 byte Brainfuck interpreter.
20:32Red needs to get down to <100 kB ;-)
greggirwin
20:43@snotbubble, @9214 answered you in code, but maybe we can take some of these snippets and add to https://github.com/red/red/wiki/File-Dir-Path-related-functions.
TimeSlip
20:44@9214 @BeardPower Thank you!
BeardPower
20:45You're welcome.
greggirwin
20:47@TimeSlip check out the recent draw app from @toomasv. He's doing some pretty neat stuff in there with animations and transforms.
20:47Chat in red/gui-branch room.
BeardPower
20:48Absolutely! You will get your spinning wheel finished in no time.
TimeSlip
20:48@greggirwin Thanks Gregg, I'll need all the examples I can get.
BeardPower
20:50@TimeSlip And please post your results :+1: (if you can and like, of course :))
TimeSlip
20:52@BeardPower It's the "Can" part that would stop me from posting. I had a rough time just drawing piecharts!
BeardPower
20:54@TimeSlip "Can" like in "if you are allowed to". Sometimes someone is not allowed to show stuff, because of some "trade secrets" ;-). Well, let's talk in the red/gui-room about it and your issues you ran into.
TimeSlip
20:59@BeardPower I'll let you know when I make some progress (It will not be for a few days until I get the spare time)
greggirwin
21:06I added some things to https://github.com/red/red/wiki/File-Dir-Path-related-functions. @snotbubble, feel free to clarify, add more, or pose new questions here that lead to additions that will help people.
BeardPower
21:09@TimeSlip Sure. Do you want to mimic the spinning wheel of macOS?
TimeSlip
21:11@BeardPower Actually what I aim to do is take a list of names and place them on slices of the wheel, spin it, and then have it stop at one of the names.
greggirwin
21:13Wheel. Of. Fortune!
BeardPower
21:15Ah, I understand. Definitely use the Draw dialect. Challenge accepted ;-)
greggirwin
21:17Tickety tickety tickety...yeah, we need audio. ;^)
BeardPower
21:19clickety click :)
21:35[![wof.gif](https://files.gitter.im/red/help/fKTm/thumb/wof.gif)](https://files.gitter.im/red/help/fKTm/wof.gif)
21:37Imagine it has slow-down ;-)
22:45Prizes, prizes prizes!
22:47[![wof.gif](https://files.gitter.im/red/help/aGSB/thumb/wof.gif)](https://files.gitter.im/red/help/aGSB/wof.gif)
23:08The "A" is also rotated. Compared to the non rotated other letters.
23:09[![wof.gif](https://files.gitter.im/red/help/37B5/thumb/wof.gif)](https://files.gitter.im/red/help/37B5/wof.gif)

toomasv
04:48@BeardPower :+1: Nice!
greggirwin
06:53Woohoo! Go @BeardPower, Go!
06:53I'm just going to sit and watch those gifs for a while.
planetsizecpu
09:16@BeardPower Is the Mill engine beyond this wheel? ;)
BeardPower
11:35@toomasv @greggirwin Thanks. Maybe I should put a seizure warning before spinning :dizzy_face:
11:36@planetsizecpu Hehe. Unless the wheel stops between to fields 😅
maximvl
14:10@BeardPower wow, nice :D
14:10I encourage you to post under r/redlang ;)
14:12@greggirwin sure, I understand what you are saying, and of course help should be used and stuff, my case is more like you come from other language and you want to get "absolute path", help won't help you to find the clean-path name, nor the Carl's logic (it makes sense if you know about it, ofc)
BeardPower
14:13@maximvl Thanks!
>I encourage you to post under r/redlang ;)

I cannot find this room.
maximvl
14:14it's here :D https://www.reddit.com/r/redlang/
14:15you can use a DEMO tag
BeardPower
14:17Ahh! Will do. I need to clean up some code. I coded it in the Red IDE (live preview script from the eve live demo). Would be a nice show of, why Red is awesome :)
maximvl
14:18ok, it's good anyway you can share a link to a gist and keep updating it as you want :)
BeardPower
14:19Yep, as soon as I have some more spare time. Can take a little.
dander
18:55@maximvl It still falls somewhat in the "you need to know about it" category, but help "path" and help "file!" both find clean-path along with lots of other stuff. So it's a bit less focused, but is my go-to next step for broadening the search
TimeSlip
19:14@BeardPower I am hypnotized by your knowledge. Yes, those are exactly what I wanted to do. I think I need to grow some facial hair.
BeardPower
19:16@TimeSlip :+1: It's the first step to success. I will clean up the code and release it on a gist/reddit. Try to implement it yourself in the meantime :-)

TimeSlip
18:02@BeardPower I managed a spinning circle but how do you add the text?
BeardPower
18:09@TimeSlip I used rotate with a block of text drawing commands.
TimeSlip
18:21@BeardPower So are the text's in their own block?
18:22@BeardPower I mean, separate from the block or arc's
18:24or=of
18:26Actually, the more I think about it, I see the error in my thinking. Thanks.
BeardPower
18:37No, they are in the same rotate block as the arc commands. I will create a gist later.
TimeSlip
19:32OK, block of text now rotating.
BeardPower
19:42:+1:
TimeSlip
19:43@BeardPower But in separate blocks.
19:43(text and arcs)
BeardPower
19:44No need for that, if they are rotated the same. You just have to use fixed positioning or need to push the matrices onto the stack.
19:45So you get relative rotation for the texts.
TimeSlip
20:43@BeardPower I'll have to see that. I wasn't able to get that to work.
BeardPower
20:45I'm currently very busy, but I hope I can complete the gist entry, some wiki entries and other stuff over the weekend.
TimeSlip
20:45@BeardPower No problem. I'm close and the test works.
BeardPower
20:46Are you familiar with OpenGL/DX?
20:46Nice.
TimeSlip
21:35@BeardPower I'm spacially-challenged so everything that involves coordinates is a like a big black box. :smile: I spent quite some time altering numbers to rotate my labels.
BeardPower
21:59:smile: Things like this, will be easier to pull off in the future.

prapro
20:01When compiling https://github.com/red/code/blob/master/Scripts/mandelbrot-fast.redI get an error...
Target: Windows

Compiling to native code...
*** Compilation Error: undefined symbol: red/image/acquire-buffer
9214
20:10@prapro have you tried -r option?
prapro
20:13Of course not! :)
greggirwin
20:16That's what you need to do.
20:17I mean, that solves the problem.
20:20Should we add a note to https://github.com/red/red/wiki/Compiler-Limitations about this issue with libRedRT compilation?
gltewalt
20:23I though I put the windows example in the Readme?
20:24Maybe -r wasn’t covered
greggirwin
20:29The main Red ReadMe? I don't see a note about this, when combining Red and R/S.
20:33@prapro, if that worked for you, would you please add a note about it to the above wiki page? Thanks.
gltewalt
prapro
20:38It worked. Will do Gregg
lepinekong_twitter
21:54I have installed Windows Linux Subsystem (https://docs.microsoft.com/en-us/windows/wsl/install-win10) which is based on Ubuntu 16 and then Red succesfully. There is no GUI though, how can I call Red or at leat a red script and get back result ?
21:55Red console doesn't have (yet) all options that Rebol console had so is it possible ?
22:10@BeardPower is it you who make that wheel of fortune is it in Red :smile:
BeardPower
22:12@lepinekong_twitter Yes and yes.
lepinekong_twitter
22:26@BeardPower :+1:
BeardPower
22:27Everything I post on the channels is done in Red. I just need time to port my stuff to Red :)
Some looks more complicated than it actually is ;-)
lepinekong_twitter
22:29@BeardPower great I like the wheel, I want to tech programming to children it's a good attraction :smile:
BeardPower
22:30Absolutely. Red is great for live coding and you have hot-reloading out of the box.
22:31Instant gratification!
22:31And your code does not look cluttered up like in other languages.
lepinekong_twitter
22:33>And your code does not look cluttered up like in other languages.
Yeah but I remark that a lot of you has "c" coding style with no () grouping things it's hard to read sometimes ;)
BeardPower
22:34I find it easier to read because of this :)
lepinekong_twitter
22:34When it is you who wrote the code ;)
BeardPower
22:35Well, it's just a matter of code style. You can use () as well, and you know the syntax in and out, don't you? ;-)
lepinekong_twitter
22:37I hate syntax I want to invent a new high level Cobol :smile:
BeardPower
22:38Why? There is Red :D
lepinekong_twitter
22:38Yes that's why I come to Rebol/Red in the first place :smile: But I
22:39since it can build DSL I want even higher level of abstraction
BeardPower
22:39And what do you mean by "high level" Cobol? Cobol is high level.
22:39Can you give an example?
22:40loop 3 [print "yo"] -> what wrong with this level of abstraction?
lepinekong_twitter
22:42Well language that a Business user can speak https://twitter.com/lepinekong/status/972116879568498689
BeardPower
22:43I see, you want to make a business language DSL.
lepinekong_twitter
22:44Not just a DSL, I want to create a kind of "HOOS" for "Human Oriented Operation System" ;)
22:44Mystypo: Human Oriented Operating System
22:45Today the poor end user is having a burnout sometimes trying to cope with many different systems he can't automate because he's not a coder.
22:46I even met people fall into depression.
BeardPower
22:47Similar to MU-TH-UR 6000? :smile:
22:48Good luck with your project :)
lepinekong_twitter
22:50No that's more pragmatic, in fact some big sites are surfing upon it like https://zapier.com/ so I want to make integration simpler. In fact even developers will be interested as the java / javascript ecosystems are becoming a nightmare :smile:
22:53My goal is also to help people learn : "training on the job" is one of Deming 14 points http://asq.org/learn-about-quality/total-quality-management/overview/deming-points.html
BeardPower
22:56Well, you get all the quirks and hacks with every app connected. I don't like bloat being cross-connected. I'm more an advocate of the UNIX philosophy, just like Red:
>This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.
greggirwin
22:58> loop 3 [print "yo"] -> what wrong with this level of abstraction?

@BeardPower, only that you used an odd number, so your Yo-Yo stays down. :^\
lepinekong_twitter
22:59@BeardPower no I won't provide every connection to every app, that's why I'm talking about an HOOS: I will provide an infrastructure to do so which is accessible even to non-programmers but also to programmers whatever language it is.
BeardPower
23:07@greggirwin The issue I always have when playing my Yo-Yo :smile:
23:10@lepinekong_twitter It's very time consuming to support every API. Not every app is following a standard, which makes it a nightmare to support.
lepinekong_twitter
23:13As I said it's not about supporting every api, it's about helping people building it by themselves more easily. Programmers may help them by providing plugin (because there will be a plugin architecture like for Wordpress so as to make the ecosystem grow) but I want to ensure that even without plugin even an end user can do it.
23:14So my concept of HOOS is about helping people build their own "ME" system so the domain http://thesystem.me :smile:
BeardPower
23:17Well, even if they are able to code by "clicking and dragging", like with the google programming language for kids, they need to have a basic understanding of control flow and other programming related concepts.
lepinekong_twitter
23:18@BeardPower clicking and dragging is very limited, It's kind of wizard. The idea of DSL is just that: a specific language to a domain.
BeardPower
23:18So how do you connect Wordpress with Ghost?
lepinekong_twitter
23:19And so Console for me is crucial for productivity. But today Console can only be used by Linux user because it's too geeky.
BeardPower
23:19e.g. wordpress in html5 ghost out pdf?
23:20Are you referring to the Red console or a terminal?
lepinekong_twitter
23:20@BeardPower I think some people are going to complain we are chatting too much :smile:
23:21@BeardPower yes Red console, I wait for the next version.
23:21As I understand it will be customizable ?
BeardPower
23:21Well yes, but the help channel is open for suggestions and ideas. Maybe some of this is an interesting idea for Red.
23:22Yes, as I understand it, it's based on the Draw dialect, so it theoretically can output everything from it.
23:23So you could also render html, PDF, whatever in the console, as long as the interpreter is spitting out Draw code.
23:24My widget examples would run in the console.
23:25It would offer similar functionality as the Oberon System.
lepinekong_twitter
23:28@BeardPower It will be great. Splitting html will be a huge task !
23:29@BeardPower for html a more reasonnable solution would be integration with existing chrome component.
23:30@BeardPower or you just mean the screenshot of html, that is more feasible.
23:30@BeardPower for console I also wait for https://gitter.im/red/red?at=5a9ad7ee0a1614b712d97b36
BeardPower
23:37Bringing in a chrome component? No more Electron, please ;-)

If the new console can deliver what's being "advertised", it's very flexible. It's just a matter of coding plugins for it.
prapro
23:37@greggirwin Is there an issue# related to the -r switch?
23:38that is the mixed red+R/S -r requirement?
lepinekong_twitter
23:44@BeardPower I didn't say electron ;) Now electron is good Visual Studio Code is made with electron as well as many others like Gitkrachen https://www.gitkraken.com/ which is rather impressive if you like graphics ;)
BeardPower
23:47@lepinekong_twitter Yes, but chrome is anything but small ;-) Yeah, gitkraken is very nice. You could code something like that for the new console, just like the Zsh stuff I posted, but more impressive ;-)
lepinekong_twitter
23:48@BeardPower if you code something for git like Gitkraken in Red for sure Red will boost to the sky as Git is so popular :smile:
BeardPower
23:50That's the plan :smile:
23:51All developer tools just look so "retro".

lepinekong_twitter
00:00@BeardPower if you can do that I'll be your first user ;)
BeardPower
00:01Anything is possible, right? :+1:
lepinekong_twitter
00:01@BeardPower sure :smile:
greggirwin
07:50@prapro, I don't know of one. The closest thing I found is https://github.com/red/red/issues/2463. It may not be an issue as much as a known and expected limitation.
lepinekong_twitter
09:59:point_up: [March 10, 2018 12:37 AM](https://gitter.im/red/help?at=5aa31abf6fba1a703aeba0ff) the worst about Electron is when you download 60 Mb and decompress for double to realize you can't run it :smile: like this one https://github.com/jasonlong/mater
09:59@BeardPower
18:47Is there another function to distinguish betweenhttp url and c:\ as url? c:\ also returns true (it was like that also under Rebol):

>> url? c:\

== true

>> url? http://google.com

== true

>>

9214
18:48@lepinekong_twitter what..?
lepinekong_twitter
18:48@9214 what what ? :smile:
9214
18:48I don't understand the question.
lepinekong_twitter
18:48You don't understand my question ?
rebolek
18:49I do
lepinekong_twitter
18:49Well c:\ is normally a folder path under windows, not really an url :smile:
rebolek
18:49it is url in Red
9214
18:49syntactically it's url!, if you want to represent file path, use file!
18:50
text
>> to-red-file "C:\"
== %/C/
>> type? to-red-file "C:\"
== file!
lepinekong_twitter
18:53Syntactically yes but from windows user point of view it's not. So ok I'll have to detect http:// to distinguish between one or the other.
gltewalt
20:46http://www.rfc-editor.org/rfc/rfc1738.txt

Search for Specific Schemes
20:49https://imgur.com/a/j4QMb

greggirwin
00:24@lepinekong_twitter, as @9214 says, Red has a datatype specifically for use with files, so use that. Because Red is a cross platform tool, Windows formats (or any OS) don't get special treatment.
sergeantWilson
01:16Hope you can help.
So, I have a blue box in a window. like this: view [ box blue ]
How can I delete or remove the box from the view leaving the view empty ?
Thanks.
rgchris
01:55@sergeantWilson view [box blue [clear face/parent/pane]]
01:55(click the blue box to invoke)
9214
05:08@sergeantWilson I'd rather
view [box blue [face/visible?: off]]

since @rgchris's method removes *all* faces, not just a box, permanently
toomasv
05:38@sergeantWilson This way you can remove any box individually:
view [style bb: box [remove find face/parent/pane face] bb red bb blue bb green]
9214
05:40@toomasv :confused:
toomasv
05:40What?
9214
05:40just a sec
05:41[![Peek 2018-03-11 10-40.gif](https://files.gitter.im/red/help/ta6m/thumb/Peek-2018-03-11-10-40.gif)](https://files.gitter.im/red/help/ta6m/Peek-2018-03-11-10-40.gif)
toomasv
05:41Try to copy again :)
9214
05:41ah, ok, now I trust you ;)
05:42exclude also works fine, just too verbose
05:43@sergeantWilson :point_up: whatever floats your boat
lepinekong_twitter
07:35@greggirwin the context of usage is that an enduser that can pass a folder a file an url and when on windows he will copy and paste from explorer or ide so I need to distinguish between the two. Of course internal implementation uses red datatype.
07:36What is def ? It didn't exist in rebol so cannot find doc and red help is terse:

help def

     default!        typeset!      [datatype! none! logic! block! paren! string! file.

9214
07:37@lepinekong_twitter you may also ask "whait is he" or "what is col", or any other thing without thinking too much
>> help col
     as-color        routine!      [r [integer!] g [integer!] b [integer!]]
     collect         function!     Collect in a new block all the values passed to KEEP function from the bo...

>> help he
     checksum        native!       Computes a checksum, CRC, hash, or HMAC.
     dehex           native!       Converts URL-style hex encoded (%xx) strings.
     either          native!       If conditional expression is true, eval true-block; else eval false-blk.
     fetch-help      function!     Returns information about functions, values, objects, and datatypes.
     head            action!       Returns a series at its first index.
     head?           action!       Returns true if a series is at its first index.
     help            function!     Displays information about functions, values, objects, and datatypes.
     help-ctx        object!       [DOC_SEP DEF_SEP NO_DOC HELP_ARG_COL_SIZE HELP_TYPE_COL_SIZE HELP_COL_1_S...
     help-string     function!     Returns information about functions, values, objects, and datatypes.
     hex-to-rgb      function!     Converts a color in hex format to a tuple value; returns NONE if it fails.
     to-hex          native!       Converts numeric value to a hex issue! datatype (with leading # and 0's).
     wheat           tuple!        245.222.129
lepinekong_twitter
07:40@9214 oh ok I didn't remark help could search on partial name :smile:
9214
07:42@lepinekong_twitter I didn't either, but somehow I managed to figure it out on my own by experimenting in console ;)
lepinekong_twitter
07:43@9214 yeah it's like discovering gems :sparkles:
07:46Found a nice and quick tut/tips on error management with try: http://www.rebol-france.org/documentation/articles/gestiondeserreurs
08:20I have written this function for code markdown to paste on gitter:
to-markdown: func [/wrap /local src out][
    if wrap [] 
    src: read-clipboard 
    out: rejoin [
        newline 
        "```" 
        newline 
        src 
        newline 
        "```" 
        newline
    ] 
    write-clipboard out
]


Seems there's a glitch with write-clipboard it doubles blank lines so that
line1
line2


becomes
line1

line2



08:30What is routine compared to a function, when I look into write-clipboard:
routine [data [string!]][
    logic/box clipboard/write as red-value! data
]
08:31How do you submit after editing on gitter ?
08:32I click on edit but in gitter menu there's only reply ?
9214
08:34There's a timeout for message editing, if that's what you're asking.
lepinekong_twitter
08:36I edited immediately. Edit button works: I can modify.
08:37I retried with what I just typed, same thing.
9214
08:37How about hitting Enter after editing, to apply the changes?
lepinekong_twitter
08:38@9214 yes :smile:
greggirwin
08:57> What is routine compared to a function

Routine is Red/System code, and function is Red code.
lepinekong_twitter
09:22@greggirwin ah ok (can't find "redlang routine" google doesn't index well :smile: )
ne1uno
09:28google has a python bias
09:30red-lang or red/rebol probably work better
lepinekong_twitter
09:34@ne1uno because they use python, that's unfair, we should contact FTC for monopoly :smile:
ne1uno
09:36not google the company, the search team at least.
lepinekong_twitter
09:37@ne1uno happily for them, I'm too kind ;)
ne1uno
09:43we wouldn't have phones that can't update the os if the ftc was awake, don't count on them to help
lepinekong_twitter
10:57I don't understand how to use throw-error found here https://en.wikibooks.org/wiki/Rebol_Programming/throw-error : what kind of arg I should pass :
throw-error: func [
    {Causes an immediate error throw with the provided information.} 
    err-type [word!] 
    err-id [word!] 
    args
][
    parse args: compose [(:args)] [0 3 [args: any-function! (
                change/only args copy/deep third first args
            ) | skip]] 
    args: head args 
    throw make error! reduce [err-type err-id pick args 1 pick args 2 pick args 3]
]
10:58A simple hello world example would be great ;)
9214
11:06@lepinekong_twitter system/catalog/errors
lepinekong_twitter
11:09@9214 I'm trying to copy it to clipboard but failed with syntax :smile:

write-clipboard mold get 'errors in system/catalog

9214
11:12Red has cause-error though, you don't need Rebol's mezzanine.
11:13@lepinekong_twitter for a start, examine signatures of functions you're using
lepinekong_twitter
11:15@9214 ok will use cause-error but still don't understand what I should pass for args [block!]
9214
11:15@lepinekong_twitter http://www.rebol.com/r3/docs/functions/cause-error.html
lepinekong_twitter
11:18Thanks have always used Rebol 2 not Rebol 3 :+1:
12:57is there a simplistic red code editor with syntax highlighting written in red itself ? I download rededit https://github.com/ldci/RedEdit but I can't see any editor just a console.
9214
12:58@lepinekong_twitter there's no such editor, though, @vulnz did a [little IDE experiment](https://github.com/vulnz/redide)
12:59also https://github.com/AlexanderBaggett/RedIDE
lepinekong_twitter
13:02@9214 thanks do you know what is Rededit supposed to be ? @vulnz do you intend to implement syntax highlighting ?
hiiamboris
13:11don't you all think it's kinda wrong that Draw's text command is unaffected by clip, translate or any other matrix transformations?
9214
13:12@hiiamboris some of us do think so https://github.com/red/red/issues/3225
hiiamboris
13:13@9214 thanks, good to know :)
9214
13:14@hiiamboris can you leave a comment on this issue wrt clip and matrix transofrmations, so that team could check them?
hiiamboris
13:15sure
rgchris
14:58@9214 Strictly speaking for *'leaving the view empty'* CLEARing the pane of the parent face is that.
9214
15:00@rgchris let's wait for @sergeantWilson's response :)
rgchris
15:01To clarify the question, you mean?
9214
15:02@rgchris yup
rgchris
15:20Fine, but doesn't make that statement any less true.
rebolek
15:53@lepinekong_twitter you mean something like this? https://i.imgur.com/k4qbgaM.gif
lepinekong_twitter
16:00@rebolek yeah I want it :sparkles:
rebolek
16:06@lepinekong_twitter I'm not sure if it's part of Gritter, or if I have't uploaded it yet. If not, I will.
16:06But don't expect full editor.
BeardPower
16:23@rebolek What is Gritter?
9214
16:24@BeardPower https://github.com/rebolek/gritter
BeardPower
16:37Ah, interesting.
nedzadarek
16:37Is it possible to break from "higher level loop"?
For example I have structure like this:
while [true] [
 print 'loop1 
 while [true ] [
    print 'loop2
      while [true] [
        print 'loop3
      ]
  ]
]

I can control only the most inner loop (loop3). When I put break there (after print 'loop3) it will only break from 'loop3 (so it will be in the 'loop2).
9214
16:38@nedzadarek use catch and throw
nedzadarek
16:42@9214 but what if I cannot (or don't want to) edit other loops?
rebolek
16:43I wrote it just before @qtxie introduced text-box! and then abandoned it, because text-box! is much better approach.
9214
16:45@nedzadarek you need to wrap nested loops in catch block and place throw in the deepest one
16:45
text
>> catch [forever [forever [forever [throw 'something]]]]
== something
nedzadarek
16:49So I need to edit each loop... I don't like this. Well... thank you.
9214
16:50you don't need to edit anything, group of loops is just wrapped in a block, their structure remains the same
16:50such deep nesting is a code smell though, I suggest you to refactor a problem if possible
nedzadarek
16:51It's not my code. I want to insert some code.
16:52I have 1 loop to do my stuff. 2-3 loops are possible in normal code
9214
16:53
text
catch [
    forever [
        print 1
        forever [
            print 2
            forever [
                throw print 3
            ]
        ]
    ]
]
lepinekong_twitter
16:55@rebolek I don't really want full editor in fact I just want to have a simple syntax highliter example ;)
16:58@rebolek I just want a simple text box to edit a single red function quickly (much better with syntax highlight).
16:59@rebolek so I can do this simple editor (loading / saving), I don't know how to do syntax highlight.
nedzadarek
17:00@9214 but it breaks loop nr. 1 and nr.2 What if I want to do something like this:
catch [
    forever [
        print 1
        forever [
            print 2
               foo N
        ]
    ]
]

Where the N is the number of loops to break (e.g. foo 1 = break, foo 2 breaks 2 loops: catch [forever [forever [throw]] etc)
9214
17:01@nedzadarek idk, create external counter and check it in each loop. What are you trying to do, specifically?
17:02you can exploit halt, maybe
nedzadarek
17:04@9214 https://en.wikipedia.org/wiki/Breakpoint
9214
17:07hmm, that's tricky
nedzadarek
17:08Yes. I could only break from 2nd loop.
endo64
17:08What about named catch and throw?
catch/name [
    forever [
        print 1
		catch/name [
			forever [
				print 2
				throw/name 1 'outer
			]
		] 'inner
    ]
] 'outer
9214
17:08@endo64 yes, just thought to mention that :+1:
endo64
17:08This way you can decide whichever loop to break
rebolek
17:10@lepinekong_twitter I will publish the code, probably later today or tomorrow, when I've got some time, but do not expect too much, features like selection are done only partially.
nedzadarek
17:10@endo64 @9214 I'm bit closer. Thank you for help!
lepinekong_twitter
17:18@rebolek thanks a lot. Take your time ;)
17:19@rebolek I don't need any fancy stuff just highlight.
rebolek
17:35@lepinekong_twitter highlighting is actually pretty fancy ;)
17:36https://i.imgur.com/U24nQ1s.gif
lepinekong_twitter
18:17@rebolek I rather mean anything fancy apart from highlight that's why I can't do it :smile:
BeardPower
18:54@rebolek Nice.
lepinekong_twitter
19:07Is there a mechanism to redirect console output temporarily or at least mute it (for example during automated test) and reestablish it (without modifying the function of course) ? Otherwise I'll use a global flag to do so.
9214
19:25@lepinekong_twitter pipes?
hiiamboris
19:30@9214 found your spoon meditation example - very insightful! best doc on bind probably (:
lepinekong_twitter
19:31@9214 I don't know pipes except for Linux or Windows, does it exist inside Red ? Any doc thanks.
9214
19:31@hiiamboris thanks! It's an old one, and IMO a little bit obscure. Feel free to ask any clarifying questions here :)
19:31@lepinekong_twitter I meant OS pipes, yes
lepinekong_twitter
19:32@9214 yes if I call from OS. But I can also call from red console herself.
19:33In fact even from OS that wouldn't be enough as I don't want to pipe all messages only some.
9214
19:33So you want to suppress interpreter's output from the script itself? I don't think that's possible.
19:34... unless you use global flag
19:34and if flag [print "blah"]
gltewalt
19:34Speaking of examples / articles... @9214 style parse article?
9214
19:35or you can redefine output functions themselves
lepinekong_twitter
19:35@9214 yes I'll have to use global flag then.
9214
19:35@gltewalt I derailed :(
19:36mostly hung up with personal studies, though, I have some stuff drafted
gltewalt
19:36Some track has been fixed and the train is back in motion, so might be good timing
9214
19:37indeed, the clock is ticking perfectly
lepinekong_twitter
19:38I have found a flowchart app http://chartmage.com/index.html to try to debug my search script https://gist.github.com/lepinekong/15d78322ecce84cfbcf892ce1cdbda88 but the automatic layout has some difficulty with complex loop :smile: https://user-images.githubusercontent.com/5175342/37257235-aea3e728-2566-11e8-88e3-0642fffbbbf3.png
19:40I really wish someone implemented grafcet it would be much more clean layout ! I'll try to do it in Red when I'll master Red Graphics ;) https://www.developpez.net/forums/attachments/p141127d1395415751/bases-donnees/ms-sql-server/developpement/faire-modelisation-d-grafcet/grafcet.jpg
19:46> or you can redefine output functions themselves
@9214 maybe with pre-processor ;)
hiiamboris
20:33let's do a contest: "crash Red in as few words as possible"
my entry will be this: make face! [bad: self]
lepinekong_twitter
20:50:smile:

*** Script Error: a has no value

*** Where: catch

*** Stack: prin

20:50@hiiamboris did I win ;)
hiiamboris
20:51@lepinekong_twitter nope (: it didn't crash did it?
lepinekong_twitter
20:55@hiiamboris ah ok read-clipboard %/c/a.png
20:56on windows it crashes
hiiamboris
20:57hmm, mine doesn't
@lepinekong_twitter you sure? it seems read-clipboard doesn't accept arguments
20:59@lepinekong_twitter shit, you win! (: if you copy an image and then just type read-clipboard...
20:59can't beat that lol
lepinekong_twitter
20:59@hiiamboris yes you're right so it's just read-clipboard (you must copy an image before)
21:00> @lepinekong_twitter shit, you win! (: if you copy an image and then just type read-clipboard...
First time I would win something at red :smile:
SmackMacDougal_twitter
21:00Given this:

Red [] 

ytlink: define [

    yurl [url!]

][

    ;; strip any list data from the url to get it in this form:
    ;; https://www.youtube.com/watch?v=x6F_S4LbdpE
    if found? find yurl "&" [parse yurl [copy mlink to "&" to end] yurl: mlink]

    ;; get the video id
    parse yurl [thru "watch?V=" copy mid to end]

    ;; define the new end point
    ep: https://www.youtube.com/embed/

    ;; make the new url
    yurl: join ep mid

    ;; define the tag
    itag: <iframe width="560" height="315" src="***" frameborder="0" allow="autoplay; encrypted-media" allow fullscreen></iframe>
    
    ;; embed the url in the source attribute
    change/part find itag "***" yurl 3

    write-clipboard mold itag: head itag
	return itag
]


where define: :function

Why does this happen?

>> x: ytlink https://www.youtube.com/watch?v=dmckigvz7Hg&t=3s
== <iframe width="560" height="315" src="https://www.youtub
>> y: ytlink https://www.youtube.com/watch?v=t9TrUPoevXI&t=437s
*** Script Error: change does not allow none! for its series argument
*** Where: change
*** Stack: ytlink


Since any set-word! should be local to the body of the function, should not itag be re-written with each invocation? On the second call, itag must have the constructed url from the first call and hence find can't find "***".

This isn't expected.



meijeru
21:19Perhaps itag: copy