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

Phryxe
13:20Is this the sandbox thread? Newbies like myself have questiob
rebolek
13:20@Phryxe feel free to ask
Phryxe
13:24Sorry, damned phone editing. Not easy to know if the problem you find is a bug or (most likely) lack of knowledge...
greggirwin
14:03@Rebol2Red (from red/red room), I just ported Ashley's func, which was obviously very simple. If you only need to test loadability, trapping the error may be best right now. Otherwise we need a good, concise, reference for sanitizing UTF-8 (or maybe any UTF). Not sure I have for that right now.
Rebol2Red
14:05Can i get the code somewhere?
greggirwin
14:05All I have is the one you already have.
14:06Ashely's used find. I just showed how to do it with parse to get the actual position of the first invalid char.
Rebol2Red
14:08Aha. But did you get my point at red/red?
I wish i could make it clear that the function is not complete
I just found that the mentioned file has code hex 96 in it which is invalid but not detected by the function.
Am i right? I get very confused with the utf matter.
greggirwin
14:10Yes, the func may have too broad a name, as it may have just been enough for Ashley's needs. Making it complete could be very good, along with a sanitizer that takes rules perhaps. And since Red throws an error, it knows. We can use the source.
Rebol2Red
14:12I programmed a lot in other languages like freebasic and had never any problems reading files.
I think it is essential for a programming language to read files without errors
It may sound a little bit harsh but that's not my intention
greggirwin
14:15I sense your frustration. :^) UTF isn't my area either. Remember that Red is only 0.6.1 old. We can help fix it and make it work how we want.
14:18%runtime/unicode.reds is where this loads, it seems. Look at load-utf8-buffer.
Rebol2Red
14:20Hmmm. I have seen the code. It is way above my head. Try to find a simpler solution. Thanks.

I have a table with valid utf-8 so i can detect which ones are invalid.
Have done only a part of it which came up with the invalid utf byte so it's promising
greggirwin
14:23Keep us posted. You may get advice is you're stuck.
Rebol2Red
14:24I will. Back to programming now. Later...

ralfwenske
04:10Feeling much more comfortable to ask questions here :smile:
04:14I try to access parent of a panel in the on-create event:
l: layout [
	p1: panel "p1" 220.220.220 [
		p2: panel "p2" 180.180.180
		p3: panel "p3" 180.180.180
	] on-create [help p1/pane/1/text help p1/parent]
]
view l

the result is:
p1/pane/1/text is a string! of value: "p2" p1/parent is a none! of value: none
How (when) can I access the parent property?
05:03After some experimenting I found a workaround:
dockimbel
05:04@ralfwenske parent property is only set when the faces are shown on screen, on-create is called just before that.
ralfwenske
05:08on-resize gets called twice before layout is shown.
At the second call parent is set so I can traverse the tree up and down.
l: layout [title "Why no parent at 'on-create' time"
	p1: panel "p1" 220.220.220 [
		p2: panel "p2" 180.180.180
		p3: panel "p3" 180.180.180
	] on-create [help p1/pane/1/text help p1/parent]
	do [
		self/actors: make object! [
			on-resize: function [face [object!] event [event!]][
				print ["In on-resize: help p1"]
				either p1/parent [
					help p1/parent/text
				][
					print ["p1/parent is none"]
				]
			]
		]
	]
]
view/flags l [resize]

this code returns the following:
In on-resize: help p1 p1/parent is none p1/pane/1/text is a string! of value: "p2" p1/parent is a none! of value: none In on-resize: help p1 p1/parent/text is a string! of value: "Why no parent at 'on-create' time"
05:10How do I enforce a linefeed in the 'code' section of markup?
05:12@dockimbel Is there a particular reason for this? The children (pane) are set; couldn't the parent be set at that time also?
dockimbel
05:27@ralfwenske Use triple backquotes instead of single ones.
05:31@ralfwenske on-create is really meant to be called before the system GUI resources are allocated, and parents setting needs to happen after that. What is really missing is a on-appear handler which would be called just after the face is fully created and displayed for the first time.
05:37I'll see if we can add such feature today.
ralfwenske
05:40@dockimbel That's great. Thank you.
Doing it in on-resize works but it is not a very transparent solution.
05:44@dockimbel Will the on-appear happen before the second (initial) on-resize happens? For my purpose (resizing window and automatic panel resizing) it would be desirable.
dockimbel
06:39@ralfwenske Probably not. Those early resize events are unwanted, but Windows does weird things on creating a GUI components, so those events will proably be filtered out in the future.
ralfwenske
06:42@dockimbel I guess in this case I would call 'show' after manipulating offset and/or size values of faces?
06:47btw. Main purpose for me is playing with perceived gaps (eg.resizing) to learn. I guess these will probably become part of Red GUI later on anyway...
I am aware that in a way I am interfering with the workings of the GUI. :sparkles:
dockimbel
07:36@ralfwenske No need, the face will be refreshed automatically by default. Your code above is fine, not interfering. ;-)
greggirwin
12:37@ralfwenske, what is it you're actually trying to achieve?
ralfwenske
23:13@greggirwin Learning is much more effective for me by doing things. When coding I find myself often being sidetracked by searching for and digging through the countless resources (websites / sample codes).
So I thought this is a good challenge to develop an IDE in Red becoming a 'one stop place with integrated help, templates and examples. Allowing myself to add and change features as I go along.
I want the IDE to resize faces when the window is being resized. Templates will be part of the IDE and so now I am developing a simple three column face which also allows to use dragging to hide and unhide the left and right columns.
Next step will be a similiar template with rows.

A six-pane template will contain the columns embedded in the center face of the rows which I want to use as the base for the IDE...

now how do I embed an image here?
!https://github.com/ralfwenske/images/blob/master/RedExplorer.JPG?raw=true

dockimbel
07:24@ralfwenske Nice work!
greggirwin
12:43Very cool. Are you using a base face and building a splitter style on that?

yoffset
03:39Has there been any thought about a console command to clear memory? Interpreting more than one program from the console without restart has assignments carrying forward.
pekr
03:47there is no GC in Red yet, but something like that might come. IIRC, even R3 planned something like that and provided some isolated boot phases, reset of the state of the interpreter, but can't remember, how far it went before it was abandoned by its author
dockimbel
04:01Here is an attempt at a function which would clean the states after running user code. It won't reclaim allocated memory though. It needs to be called once before any user code, as it can't clear past its first invocation.
reset: function [][
	if zero? first ref: [0][ref/1: length? words-of system/words]
	foreach w at words-of system/words ref/1 [unset w]
	system/view/debug?: system/reactivity/debug?: off
	clear-reactions
	system/view/auto-sync?: on
]
04:30Actually, unset can take a block of words, so the foreach loop is not necessary;
yoffset
13:46red>> s: "text"
== "text"
red>> s
== "text"
red>> unset [s]
red>> s
*** Script Error: s has no value
13:47Thank you
greggirwin
20:52@DarioX1973_twitter, here's a very quick hack on your word distance problem.
word-1: "Troia" 
word-2: "Grecia" 
max-distance: 5
sep: charset " ,."

parse s [
    any [
        to word-1 mark-1: word-1 sep
        ;(print index? mark-1)
        [copy text to word-2 word-2 mark-2: (
	        ;(print [tab index? mark-2])
            n: 0
            parse text [space (n: n + 1) | skip]
            if n < max-distance [
                print ["Close words found at offset" index? mark-1 mold copy/part mark-1 mark-2]
            ]
        )  | to end]
    ]
]

Just to give you an idea of one way to do it.
DarioX1973_twitter
22:51Ok, perhaps the next time i'll enter in gitter i will see the help room correctly.
22:52Mmm it seems difficult to me ... i will try tomorrow at office. It's not time to sleep now in italy. Thank you very much, Greg.

DarioX1973_twitter
13:18Hello Greg, i have modified your program in this way, changing the 2 words and creating a little text so it will be more clear to me to understand.
Why i get false after executing the script? i thought to have true because "giornata" and "sole" are distant by only 2 words ...

word-1: "giornata" 
word-2: "sole" 
max-distance: 5
sep: charset " ,."


; this is the text where to find if it contain "giornata" close to "sole"
s: {
	Oggi è una bella giornata
	di gran sole, e me la 
	spasso fuori!
}

parse s [
    any [
        to word-1 mark-1: word-1 sep
        ;(print index? mark-1)
        [copy text to word-2 word-2 mark-2: (
            ;(print [tab index? mark-2])
            n: 0
            parse text [space (n: n + 1) | skip]
            if n < max-distance [
                print ["Close words found at offset" index? mark-1 mold copy/part mark-1 mark-2]
            ]
        )  | to end]
    ]
]

pekr
13:26When I try to extend the n: n + 1 print n, you can see, it will never get there. It will fail sooner ...
13:26Look at what sis: {^/ Oggi è una bella giornata^/ ....
13:27First fix is - fix the separator by: sep: charset " ,.^/" ... and continue playing ....
DarioX1973_twitter
13:33wow, it works now ...
pekr
13:33great! :clap:
DarioX1973_twitter
13:35another thing: in the example i find 2 words, but many times i look for more words, but again the must be close to each others ... how i can modify the greg program? i still yet don't understand well ... i dont' now where put my hands ... but i would like to compare benchmarks with other staff i made in python ...
pekr
13:40we would have to see your examples in Python. Or even better - what is in fact requested.
13:41searching for the distance of a variable amount of word pairs might be more complex ...
DarioX1973_twitter
14:02mmmmm ... i had a project ... when i was young (i am kidding) ... this one:

perhaps you understand me if you see it directly:
http://textre.altervista.org/video.php

please, don't go in the source files ... they are unreadable .... remember that as italian I am entitled to write spaghetti code :-D

So, i want to arrive to have the same program, but in a simple way, because do it in python and freepascal and crossplatfoms has been not simple ...

14:04sorry, it's all in italian language ... but the concept of searching and display the words of own biblioteque, i think is clear
14:08the importat key is that the words you looking for, must be distant in range of words, so you can find the points of the texts you don't remeber where are, buy searching for two or more significant words (or part of them)
pekr
14:22This is a complex stuff and goes beyond the simple help. Would consume much of the time. We can help with some parse or GUI alghoritms, but to close such app would require a significant effort ....
DarioX1973_twitter
14:27Of course, of course. I perfectly understand. i will return with simple examples ... now i learn Red basics. :smile:
greggirwin
15:26Thanks for stepping in @pekr!
DarioX1973_twitter
15:55Eh eh, here is your nighmare Gregg ... if i want a series of words to find ... not only a certain numbers of them, is it too much complicated?
How you modify your script in these case?

;i dont' want only 2 words, but how many words i want to find

;word-1: "giornata" 
;word-2: "sole" 

words-to-find: ["today" "beautiful" "hot"] ; a series of near each other words to find 

max-distance: 8
sep: charset " !,.^/"


; this is the text where to find into
; in this text the matches should be:
;     today is a great beautiful day, with hot
;     today, what beautiful hot

s: {
	Really ... today, i can say that today is
    a great beautiful day, with hot weather, and i go
	out to do something.
	Very hot, yes.
    Hot, this today.
	I like a beautiful day, as today.

	Really ... today, what beautiful hot day!
	out to do something.
	Very hot, yes.
    Hot, this today.
	I like a beautiful day, as today.
}



parse s [
    any [
        to word-1 mark-1: word-1 sep
        ;(print index? mark-1)
        [copy text to word-2 word-2 mark-2: (
            ;(print [tab index? mark-2])
            n: 0
            parse text [space (n: n + 1) | skip]
            if n < max-distance [
                print ["Close words found at offset" index? mark-1 mold copy/part mark-1 mark-2]
            ]
        )  | to end]
    ]
]


greggirwin
15:58It is a bit much right now Dario. I have to jump off and do some paying work. But if you look at http://www.red-lang.org/2013/11/041-introducing-parse.html and maybe some Rebol parse docs, start small, and work your way up, I'm sure parse will make sense to you soon.
DarioX1973_twitter
16:06Thanks, i will not abuse and will study it.

canyonblue77
02:40The following words [ join rejoin combine ] return an error of "word has no value" The guides for rebol mention some of them and there is a hostilefork that mentions them in context of Red, and even references DocKimbel pointing out that "rejoindre" is the French word for join. Were they removed or otherwise purposely excluded from Red, were they determined to be duplicative of other functions or possibly missing due to a bug in the current release? Just generally curious... my original question stemmed from attempting to combine strings without spaces... turn [ "A" "B" "C" "D" ] into "ABCD" I finally settled on code trim/all form ["A" "B" "C" "D"] code is this a good method, is there a better way? Not sure if I did the code tag correctly... hope so!!!
02:40*hostilefork blog
pekr
02:47Hostilefork took R3 open source code and started to clean it, later on to adapt it. He introduced some underlying changes, which some old time rebollers don't agree with. His language is called Ren-C, not Rebol anymore, although those changes might be sometimes subtle. He does not like some Rebol naming, so is renaming some function. Not sure, what does he mean by "rejoindre", but he sometimes reffers to Dockimbel copying wrong design decision of R2. That's his opinion and not an universal truth :-)
PeterWAWood
02:48@canyonblue77 @dockimbel has not yet decided on how best to implement functions such as
join
and
rejoin
so they are yet to be implemented.

Your code tags didn't really work as you wanted. For code, type 3 consecutive ` then the code and then another 3 . If you want a full code block, start a new line after the first 3.
pekr
02:49Apart from that, join/rejoin are not there yet, that's all. As for me, I don't like the automatic addition of spaces too, and I am glad that we did get rid of that with parse for eg. too ... it's my old time gripe with Rebol ... but others will not agree with me ....
canyonblue77
02:50Hey thanks for the replies!!!
attempt to write a code line
02:50
and a code block


PeterWAWood
02:51code :+1:
canyonblue77
02:53That's cool! Look forward to the built-in join function, totally realize what a huge undertaking Red is... thanks for being there to help it happen. For now a join function could be made from trim and form will work just as nice :)
pekr
02:55you can add such function yoursel. Just look into R2 source code:
>> source join
join: func [
    "Concatenates values."
    value "Base value"
    rest "Value or block of values"
][
    value: either series? :value [copy value] [form :value]
    repend value :rest
]

02:55quite short, should work with Red too, but haven't tried ....
02:57In above case, you would have to add repend function too ...
greggirwin
04:30Red does have rejoin now, though the implementation is probably subject to change.
pekr
04:39Was rejoin in 0.6.1, or is that just in recent sources? That could be state too, so that user is not eventually confused :-)
SteeveGit
07:33Personnaly, I prefer **ajoin** from Rebol3. Less overhead than **rejoin**.
http://www.rebol.com/r3/docs/functions/ajoin.html
07:35Though, the name is quite bad.
rebolek
07:36@SteeveGit ajoin is good function, but rejoin can do much more:
>> ajoin [%a %b]
== "ab"
>> rejoin [%a %b]
== %ab
SteeveGit
07:38Yes, rejoin is more versatile. But in the most use cases, coders just want an output string!.
endo64
12:32I agree with @SteeveGit , I mostly need to concat blocks into strings without putting space between values as in FORM and usually don't need the REJOINs behaviour, so I use ajoin mostly.
What could be a better name? So we can have it on Red and make ajoin just an alias for compatibility.
RnBrgn
12:59@canyonblue77 append "" ["A" "B" "C" "D"]
DarioX1973_twitter
13:53@RnBrgn Great, i never see it before .... perhaps is better add a copy (append copy "" ["A" "B" "C" "D"]) or it is not necessary?
greggirwin
14:15@pekr, you're right, it's only in recent sources.
rejoin: func [
    "Reduces and joins a block of values." 
    block [block!] "Values to reduce and join"
][
    if empty? block: reduce block [return block] 
    append either series? first block [copy first block] [
        form first block
    ] next block
]
RnBrgn
14:27@DarioX1973_twitter I guess it depends on where and how you use the append function. If you're running the statement just once, than you wouldn't necessarily need copy.
If it's part of a function or loop, than you'll most likely need to use append copy.
greggirwin
14:35I never liked the name ajoin. My other issue is that we have a number of different functions that are similar but not identical, and all very closely named. And there is nothing in the name ajoin to tell you what's different about its behavior.
This is one I haven't tackled in a unifying way, like I've done with round, split, and my for proposal. I have separate funcs I combine to do things. For example, I have a delimit func that works on any series type, so I can do that, then rejoin, but I also have specialized dlm str funcs for things like building CGI or other dict-style strings with field and rec separators.
We want verbs as function names, to denote action, but we do have object now, which I like. What if we had string (string these things together), which also implies the return type? One concern is confusion by overloading the word string too much. More thought required.
endo64
14:52may be some refinements can be added to FORM, put extra space between values or not, using a delimiter, forming none to empty string etc.
Not having any option/refinement for FORM is making it less useful, and we all write our own string functions similar to each other's.
Better switch to red channel.
x8x
17:26In compiled code, somethimes I get the errors printed, sometimes not, is there a rule? Maybe if it runs interpreted vs native ? thx!

canyonblue77
00:33so rejoin is not in 0.6.1 but is coming soon? And @pekr the append works good when the series values are actual strings... but not so much for when they're variables also the example I came up with has the same issue. I did figure out that if I add reduce to both of them that I get the desired result.
00:34
append "" reduce [ varA varB varC ]
trim/all form reduce [ varA varB varC ]
00:35Both of those work... which I guess is why the rejoin function would be what I'm looking for??? Regardless of the name my understanding of the rejoin function is that itreduces variables before joining them together?
00:41Sorry @RnBrgn, I meant to refer to you about append working good for strings but not vars
00:48@pekr, apologies for wrong reference
greggirwin
07:09Rejoinwill be in 0.6.2, and the automated builds should have it. And, yes, the "re" in the name is for "reduce". Rebol also has remold and reform. The tough design work is finding better names. The old names are important for porting from Rebol.
dsgeyser
10:42Anyone knows whether there is a dialect for Excel, and is it still working? Also, download link, if possible. I need it to learn Red (to port), would be really great. Thanks
PeterWAWood
10:49@dsgeyser The most up-to-date Rebol "Excel" library is [Ashley Trüter's Munge](http://www.dobeash.com/munge.html). Ashley is highly regarded in the Rebol community. I think that he and others use it daily including @endo64.
dockimbel
11:22@dsgeyser Check out @greggirwin's cool [Excel DSL](http://lambda-the-ultimate.org/node/1240) which allows you to remote control an Excel spreadsheet.
dsgeyser
14:04Thank you to the both of you. This is truly a great community. Feels like family .
dockimbel
16:04You're welcome. ;-)
canyonblue77
16:58@greggirwin Really interested in your Excel DSL, link seems to be broken though...
"""Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 113 in /home/ltu/www/includes/database.mysql.inc on line 31
Lost connection to MySQL server at 'reading initial communication packet', system error: 113"""
17:01On a separate note, can anyone provide an example of (or let me know if it's even possible) to define your own infix operator in Red? Thanks!!
dockimbel
17:10@canyonblue77 For creating an infix function, you need to make a prefix function with 2 arguments first:
make-range: function [a [integer!] b [integer!]][
	collect [i: a - 1 until [keep i: i + 1 i = b]]
]
->: make op! :make-range

2 -> 7
== [2 3 4 5 6 7]
17:11I could have use any valid word instead of -> for naming the infix function.
canyonblue77
17:27Thanks @dockimbel ! Red is amazing work and it's happening so fast too!! Every time I check in on Red there are major advances. I definitely concur with the sentiment posted elsewhere that your version ~0.6.1 seems so much closer to a version 1.0 than other languages that are under development.
dockimbel
17:33@canyonblue77 Thanks for the kind words. ;-) About 0.6.1, it's already pretty good, but 0.7.0 will really feel more like a 1.0 with all the I/O implemented and a (simple) GC.
greggirwin
18:28@dsgeyser @canyonblue77 , I think the lambda site just showed some dialect examples. Not sure why it's down. I'll see if I can track down the original. It used the COM interface to Excel, so was version specific.
18:57I found the original, from 2004. There is a DLL written in PowerBASIC, that wrapped the COM calls, so I could write routines in R2 to call them, with a dialect over that. Looks like there were about 25 commands mapped. Robert Muench, of Saphirion, used this to automate a bunch of spreadsheet processing, so it only included what he needed for that.
18:59The dialect looked like this:
excel [
	start
	show
]

foreach file files [
	if %.xls = suffix? file [
		excel compose [
		    open (join path file)

		    goto worksheet 1 goto cell "A1" set value to "Company Name"
		    goto worksheet 4 goto cell "A1" set value to "Destination"

		    goto cell "B2" set value to "=A1"

		    close workbook
		]
	]
]

excel [quit]
19:03You could DO Rebol code within it, of course, and dialect commands like: alerts [on off], cut/copy/paste, cut/copy to , insert new books or sheets, paste [value formula format comment], remove sheets, save/save-as, select/set [cell row col range]
19:05Writing the COM part in Red/System, so it's "deep Red", would be great. I don't have a current Excel here to experiment with, but if someone wants to do that, I'll get them the code.
19:06It also used a routine dialect I wrote, to make it easier to write the FFI part in R2.
dsgeyser
19:20@greggirwin I currently have Excel 2010 and 2000 loaded. Would appreciate the opportunity to play with it. Do you think someone with limited abilities in Redbol like myself would be able to port COM to Red/System? Also, what is your take on Ashleys' 'Munch' script?
greggirwin
19:26Munge is well-loved, and well-supported. Ashley always does outstanding work. It it strictly for manipulating tabular data. That means you have to do the work of getting it in and out of Excel, but also makes it much more general, which is great.
19:30I'll send you the code. My guess is that a simple example or two would be enough to get you going. I'll include the original DLL source as well. I think %red/runtime/simple-io.reds uses a COM interface for HTTP reads.
pekr
19:30I was lately thinking, if somethimg like Munge could be done with Parse?
greggirwin
19:30Anything can be done with parse. ;^)
pekr
19:31I mean, wrappimg parse into parse.exe, giving it piping, grep like functionality, manual and ability to load and switch dialects as modules. Could be a killer app? :-)
greggirwin
19:32A universal data translator, with parse rules as plug-ins? I like it.
pekr
19:32Parse is an underused gem imo ...
greggirwin
19:33Sometimes I wonder if I *over*use it. :^\
pekr
19:33If we can't rulenthe world with Rebol, extracting parse could do it. You see json? Well, it coul output data in REN :-)
greggirwin
19:35I do think that's one way to market Red though. We have LOP, and POLs, Dialects and DSLs, but none of them have been designated as a new paradigm. e.g., everything is an object in OO, everything is a function in functional. Everything is a dialect, from do down, is our paradigm.
19:37I'm with you Petr. My guerilla plan is to use Ren as the wedge. Markdown has opened the door. Create easy-to-consume data, likely including a DLL or static LIB that does the loading.
19:38I think the spreadsheet is a great killer app. If you recall, the old Nano-Sheets project had complete I/O built in.
pekr
19:38well, it was just a wild idea.
greggirwin
19:38And then Cyphre hacked it to make the cells all move around dynamically in the context entry. ;^)
19:39i.e. he wrote spreadsheet data you loaded which then dynamically altered the UI.
pekr
19:41At work, colleagues wanted to parse one file. Told them about Red and Rebol. They dont want to learn new lang. But they agreed, that if they can call some exe with a parameter and get the result, the work is done. Hence it came to my mind, if possibly more audience would find use for targetted parse.exe doing wonders :-)
greggirwin
19:41Agreed.
dsgeyser
19:42@greggirwin I am excited about this chance to do this. And as always I can certainly lean on my fellow community coder friends to make this happen. @pekr You really have a freat
19:45@pekr You really have a great idea there. Maybe we can steer it somewhere useful. This is the reason why I love it here, the constant innovation!
greggirwin
19:46As much as I love the Redbol languages, I love the community more.
pekr
19:46But if at least one is useful, why not mention it ...
greggirwin
19:47Some of my best ideas were probably Petr's. :^)
pekr
19:49Eh, one of my messages went pink and did not appeared here. Trying Android native client ...
19:50I can hardly produce quality code myself, hence most of my suggestions might be just shallow. But I try to believe the parse.exe might get popular ... IIRC, Doc planned a dialect to build dialects ...
19:51Now imagine ti accomoany it with the GUI rules editor ...
19:52Guys, it was 20 years ago, when we built new scope for our ibservatory. We got some weird Czech step motor, Mikrokon, and I asked my brother - who is goimg to code it?
19:53And he showed me his own code, using simple code like start, stop move 100 x, etc
greggirwin
19:54Sandstone Technology used to have a tool called Visual Parse ++ which was pretty cool. It was all shift-reduce style, but I think our ability to create interactive tools is unlimited once we embrace reactivity.
pekr
19:54That was the first dialect I have seen ... And it allowed non programmers to do a useful stuff. So much power there ...
greggirwin
20:01I PM'd you here @dsgeyser .
dsgeyser
20:21@greggirwin Thanks for the PM. I really feel priviledged to be talking to you and @pekr - both old hands
20:24I recently saw someone mention on a forum how great it would be for anyone to be able to convert a spreadsheet to a CRUD app - kind of like an interface to the spreadsheet. Imagine a dynamic and reative GUI. And docs' last demo thrown into the equation. It baffkes me. And perhaps pulling data from all sorts of places, being dynamically updated. I think the amount of need out there is great when it comes to data flow and business logic between mobile and Excel, for instance. They really are making it so complicated. I think it is time to show them how it should be done. This community may be small at the moment, but I think there is enough expertise and good old sense to bring about a lasting legacy to the coding world at large. Make doc proud.
greggirwin
21:37The thing about Redbol is that it's malleable, at a high level. Rebol experts scratched the surface over the years, but because we all wrote for our own needs, and the community stayed small, more general tools didn't emerge.
21:42I'm excited to see what tools people build with Red. Things like template expansion (or Zen Coding / Emmet if you're under 30 :^), are easy.
21:44
process: function [
	input [string! none!]
][
	if attempt [blk: compose [(load input)]][
		res: parse blk [
			collect [
				any [
					set w word! set s string! keep (rejoin ["<" w ">" s "</" w ">"])
					| 'aref keep ({<a href="#"</a>})
				]
			]
		]
		either res [form res][input]
	]
]

view [
	below
	text yellow 300 bold {Try "h1{foo}" or "aref"}
	text "Input:"  input:  area 300x60
	text "Output:" output: area 300x180 react [face/text: process input/text]
]

PeterWAWood
00:04I'm

endo64
07:52> @dsgeyser @canyonblue77 , I think the lambda site just showed some dialect examples. Not sure why it's down. I'll see if I can track down the original. It used the COM interface to Excel, so was version specific.

@greggirwin I have that (Excel dialect) script on my PC, if anyone need I can put somewhere on Internet.
greggirwin
15:44Thanks Endo. I found it and sent it to him. You're now part of my "external memory" list though. ;^)
Rebol2Red
16:52Why is there no word "for" as in rebol2? (There are lots of other evaluating words)
If "for" is not acceptable then how can i use any of the other words as "for"?
I can do "for" with an iterator inside a loop, but this is not what i want.
pekr
16:54I believe, at some point, there's going to be one. Well, depends upon Red authors, but my take is - if ppl are asking for it, they might miss it, although I understand, that it might not feel natural to Red. Maybe it is going to be in the mezzanine library, who knows. I think that Doc is also waiting for the precompiled runtime to be available, and does not add much of a mezzanine code to slow the compilation further down ...
16:54@greggirwin is also proposing much stronger forimplementation, which would be really powerful. Forgot the link to the proposal, maybe Gregg will step-in.
Rebol2Red
16:59Aha, I will wait and see.
I had some adjusted mezzanine code but that worked only interpreted but not compiled.
That's why i returned to using "loop and repeat" code
Thanks for explaining
greggirwin
17:00The for proposal is here: https://github.com/red/red/wiki/REP-FOR-loop-function
17:02I hope for will be included in some form. Doesn't have to be mine. People will expect it, and it does provide features loop and repeat don't. You can do anything with while, but that's not always as clear IMO. I didn't use for often under R2, but when I needed it, I was glad to have it.
Rebol2Red
17:06Can you give me a little example of how you use while as for?
I am always interested in how other people do their coding.
For example:
for a 2 10 2 [ print a ]
greggirwin
17:13
a: 0  while [a < 10][a: a + 2 print a]

would do the same in that case.
Rebol2Red
17:14I just did almost the same:
a: 2
while [a <= 10]
[
	print a
	a: :a + 2
]
greggirwin
Rebol2Red
17:15Not as nice as with a for but i can live with it. Thanks
greggirwin
17:15All you're doing is breaking out the init, test, step pieces and making them explicit.
Rebol2Red
17:16Will the code be slower?
greggirwin
17:16Of course, all the things you have to do manually are places to introduce bugs.
Rebol2Red
17:17I agree to that
pekr
17:17Now you can implement your own for funciton using while
Rebol2Red
17:18But will the code be slower?
greggirwin
17:18Quick test here shows the while version under Red is about the same speed as for under R2.
pekr
17:19Compilation might help?
Rebol2Red
17:20Ah, well as Gregg said about the same speed as R2. I am glad to know. I will use while for now.
pekr
17:20Yes, the same speed, interpreted ...
greggirwin
17:21But you can make a fast version, if your tests work for it. e.g.
a: 0  loop 5 [a: a + 2 print a]

That will be screaming fast, compared to while.
Rebol2Red
17:22It is because of the long compiling time i do not compile very often.
Only when the program is almost finished.
pekr
17:23I felt in love with the Red's GUI console - very nice experience for me :-)
17:23So I don't compile too ...
greggirwin
17:43As far as speed, remember that these things only have an effect when you're talking loops that run millions of times. And if you're doing any significant work in the body, that will likely dwarf the loop construct overhead.
17:45
red>> time-it [a: 0  while [a < 1000][a: a + 1]]
== 0:00:00.001
red>> time-it [a: 0  while [a < 10000][a: a + 1]]
== 0:00:00.01
red>> time-it [a: 0  while [a < 100000][a: a + 1]]
== 0:00:00.051
red>> time-it [a: 0  while [a < 1000000][a: a + 1]]
== 0:00:00.488
pekr
17:50Hey, where's my time-it? :-)
x8x
17:51is there an easy way to convert string! to binary! end back?
pekr
17:51IIRC, R3 had something like delta-time, or dt? I like time-it more!
greggirwin
17:52
time-it: func [block /count ct /local t baseline][
    ct: any [ct 1]
    t: now/time/precise
    loop ct [do []]
    baseline: now/time/precise - t
    t: now/time/precise
    loop ct [do block]
    now/time/precise - t - baseline
]

My cheat for now.
pekr
17:53I like it, could be added to Red, I bet ppl would find it useful for basic tweking/optimisations of their code ...
greggirwin
17:53
red>> s: "ABC123"
== "ABC123"
red>> to binary! s
== #{414243313233}
red>> to string! to binary! s
== "ABC123"
Rebol2Red
17:53@greggirwin It is if you could read my mind. I wanted to ask if my executing timing code was wrong and if i could see your code.
greggirwin
17:54:^) I imagine Doc has better things in mind. We will surely have real profiling in Red, all the way down. Maybe even something cool like DTrace does.
x8x
17:55HAHA not sure how I could miss that.. Thanks Gregg!
Rebol2Red
17:56This was my impementation:
execution-time: func[ blok /local start_ end_
][
	start_: 	now/time/precise
	do blok
	end_: 		now/time/precise
	end_ - start_
]

; fast
print execution-time[a: 2  loop 10000000 [a: a + 2]]

; slow ? (looks if it is faster than above)
print execution-time[a: 2 while [a <= 10000000][a: :a + 2]]
greggirwin
17:56@x8x , I often miss things because they are too easy. :^)
x8x
17:57
timer: func [
	code [block!] "Block of code to execute"
	/local t r
][
	t: now/time/precise
	set/any 'r do code
	t: now/time/precise - t
	print [
		t ">>"
		copy/part t: trim/lines mold code 80
		if 80 < length? t [".."][""]
	]
	unless unset? :r [r]
]
17:59Gregg I like your version with integrated loop. I also think we would benefit from having a timing function in red by default.
My one has the benefit of printing the time taken but still return the result.
greggirwin
18:00@pekr, we don't have a great/easy process for vetting new mezzanines. We can patch and PR, but need to not overload Doc (who has to see the big picture). In the meantime, I've started a gist dump of mezzanines: https://gist.github.com/greggirwin/d0412f0c3d8e1ce4dfe26afc643742f1
x8x
18:01Gregg that's all you had on Altme?
greggirwin
18:01@x8x, mine doesn't print because I use it to collect data in production apps as well.
Rebol2Red
18:02Wow, Thanks Gregg. I can use your functions.
greggirwin
18:03What's in the gist right now are some of the more basic things, and cleaning a bit as I go. Not *nearly* all I have. Note that there's nothing in the series section yet. That's my biggest group.
18:03A lot of them were on Altme from a few years ago though. So I'm also eliminating the things that are standard in Red now.
x8x
18:03Ok, I thought its use is mostly in testing, but make sense 8-)
greggirwin
18:04I have another little set of funcs...need to get to work here, but will get them up real quick.
x8x
18:04Very useful the ones in the series section!
greggirwin
18:07Going to have to port my other little funcs. No use in Red yet.
18:33Here we go. Actually pretty much rewrote it quickly for Red, since we don't have use, but we do have map!, and difference doesn't work on time!. Consider it a draft.
time-marks: object [
	data: #()

	_key: func [key][(any [key #__DEFAULT])]
		
	_get: func [key][data/(_key key)]
	_set: func [key][data/(_key key): now/time/precise]
	_clr: func [key][data/(_key key): none]
	
	set 'get-time-mark   func [/key k] [_get k]
	set 'set-time-mark   func [/key k] [_set k]
	set 'clear-time-mark func [/key k] [_clr k]
	
	set 'time-since-mark func [/key k] [
		if none? _get k [
			print ["##ERROR time-since-mark called for unknown key:" _key k]
			return none
		]
		now/time/precise - _get k
	]
]
;print time-since-mark
;set-time-mark
;print time-since-mark
;wait 1
;set-time-mark/key 'a
;wait 2
;print [time-since-mark  time-since-mark/key 'a]
canyonblue77
23:50This is what is so cool to me about Red... I didn't know how to delete an item in a series at a specific index so I made my own and it just worked.
`
23:50
xarr: [ 5 7 8 1 8 7 5]
del_at_index: function [ mylist [series!] i [integer!]] [
                    x: take at mylist i
                    return mylist  
]
del_at_index xarr 4
greggirwin
23:53remove at xarr 4
canyonblue77
23:53lol, figured it was something overly simple
23:58So my understanding of it is that the series is passed by reference so any changes made inside of the function are permanent... which I guess would mean that "mylist" wouldn't need to be explicitly returned ???
greggirwin
23:59Correct. The last evaluated value is returned. You only *need* to use return when exiting a function early. An important design aspect, though, is that you want to consider how a user may chain calls when deciding what to return.

endo64
07:59I usually use repeat instead of for or while (of course there are times I need to use while as there is a nuance)
repeat i 5 [print i i: i + 2]
meijeru
08:02@endo64 Have you tried the above code? It prints 1 to 5 and results in 7. I have difficulty thinking that this is what you intended. If you wanted to print the first 5 odd numbers, the following might work:
i: 1 loop 5 [print i i: i + 2]
endo64
08:15Sure I just wrote it as an example. Didn't check the output.
greggirwin
13:31But it is a great example of why we need to document loop counter behavior.
Rebol2Red
19:08Is it already possible to write to ftp something like write/binary ftp://xxxx %file.jpg
If so how to provide the password and username. Maybe the same as in rebol2 or rebol3?
pekr
19:19I think not. Red currently has just a so called "simple-io" implementation. Not a full stack protocol support. Maybe piping it via a Curl could be an interim alternative?
19:19Also - ftp is said being a tricky protocol to get right, we will see, which way will we get it supported in terms of Red ....
Rebol2Red
19:25I'll just have to wait for it. Thanks.
21:04
time: now/time
print type? time/second

float ???
Why not integer? Because of precision?
greggirwin
21:28Using float is a temporary solution.

endo64
07:45But it sometimes useful, as in SQL Server DateTime values are like HH:MM:SS.FFF so the seconds is float!
rebolek
08:33@greggirwin Are you sure? It’s decimal! in Rebol, so float! seems appropriate in Red.
ralfwenske
09:38To determine on-down / on-up event offsets relative to 'window one can calculate it by adding up parent offsets.
Simpler would be to use the 'window event: unexpectedly it returns the offset of the face directly under the mouse.
Doesn't seem useful as I cannot determine what face these offsets belong to.
Is that intended behavior?
do-down: func [face [face!] event [event!]][
	print ["down at" face/type event/offset]
]
do-up: func [face [face!] event [event!]][
	print ["up at" face/type event/offset]
]

view [
	panel 100x100 blue on-down [do-down face event] on-up [do-up face event]
	area  100x100      on-down [do-down face event] on-up [do-up face event]
 do [
	self/actors: make object! [
		on-down: func [face [face!] event [event!]] [do-down face event]
		on-up:   func [face [face!] event [event!]] [do-up face event]
		]
	]
]

dragging the mouse from one panel into the other returns this:
down at panel 49x34
down at window 49x34
up at area 37x32
up at window 37x32

dockimbel
09:43@ralfwenske It's a known limitation, there's ticket about it: https://github.com/red/red/issues/1636 We need an improved event! type implementation to unlock that feature (and many others).
ralfwenske
09:47@dockimbel Thank you - will work around until then.
SteeveGit
10:35@ralfwenske , @dockimbel Yes, The event is linked to the most inner face.
The parent face may also receive this event, if the actor does not stop it.
To stop it, use **'done** or **'stop** as return value.
e.g.
do-down: func [face [face!] event [event!]][
    print ["down at" face/type event/offset]
	'done 
]

I feel that the current behavior is convenient. I don't want the event/offset being modified when cascading.
Because it's linked to the event/face, not to the face of the actor as in your sample:
do-down: func [face [face!] event [event!]][
    print ["down at" face/type event/offset] ; <- face and event/face not always the same 
    print ["down at" event/face/type event/offset]
]
10:40Also, changing that, would break my current devs ;-)
pekr
10:40What are you cooking? :-)
dockimbel
10:43@SteeveGit We need to change it, the current behavior is wrong. The event, when processed by parent faces, needs to provide an offset relative to them, not to their child or grandchild.
ralfwenske
10:45@SteeveGit I now understand the logic - however - even if cascaded down: to be useful a relative offset is needed (as @dockimbel says).
10:48@pekr I'm getting to know the Gui better. Attempting to create templates which allow resizing... until such time when the Gui will do it elegantly.
SteeveGit
11:05@dockimbel Well ok but could I suggest to make these modifications (events related) a top priority. More we waiting, more I'm impacted ;-)
greggirwin
17:17@rebolek, what I mean is that I think time! will move to the new decimal! type Red gets eventually.

Rebol2Red
11:12Maybe a stupid question but if i run red [scriptname] in a windows10 shell i get no output while using print. (There is a gui opening and showing the output though). Is output not redirected to stdout?
pekr
11:29I think that the reason might be, that the red executable is in fact R2 (Rebol) interpreter with some bundled stuff. It launches real GUI console here. What you should do is to compile pure Red console, I do it the following way:

- install R2/View
- hit enter on red.r, select Allow all on the security requester
- run: rc %environment/console/console.red .... this will output console.exe into Red root dir
- in shell, run: console your-script.red
dockimbel
11:33@Rebol2Red Just use red --cli to get the output redirected to the shell. By default, Red is using its own GUI console, not the system shell. --cli forces it to use the system shell.
pekr
11:35Good to know :-)
Rebol2Red
11:35Aha, will the compiled executable send the output to stdoud then? And is that the reason about the following error. I made a path to red. When i open a shell in a directory with no red executable in it and do red [script] i get: PROGRAM ERROR: Invalid encapsulated data. It is not nice to put red.exe in all the directories.
pekr
11:36Not sure ... at first run, it seems to compile console in the background, then it should use it ....
Rebol2Red
11:48Thanks. It works with the --cli and also when compiled.
Does anyone get the same error i mentioned? (maybe i did something wrong at setting the path to it in windows. When it is windows related i'll have to fix that)
dockimbel
11:55@Rebol2Red Not your fault, it's a known issue with the Rebol encapper we are using for producing red.exe. See a workaround there: https://github.com/red/red/issues/543 Once we'll rewrite the toolchain in Red (after 1.0), this issue will be gone, as well as the Rebol dependency.
Rebol2Red
11:58Thank you very much. I will look at the issues first before asking.
dockimbel
12:01You're welcome.
dander
20:00@Rebol2Red @dockimbel it looks like Chocolatey also manages to work around that issue with the shim exe it generates (which is in the path)
...by the way, I haven't forgotten about automated build package generation. It shouldn't be too difficult to add. I just need to find a solid block of time to work out the details and do some tests, etc.

canyonblue77
19:26ok.... i'm being dense again.... trying to pull a sub-series from a series. Basically something like pick series index length if there's something built-in I'm totally missing it. Worst case was going to create a function that just did a repeating "pick" of index+1 and return a new series as the sub
pekr
19:39I dont understand what you mean, sorry. Pick returns the element. Have you tried with select, at, etc functions?
19:40Sorry, I am just on the cell phone
Cybarite
20:46@canyonblue77 Rebol series documentation applies 1.4 Extracting a Sub-series at this page http://www.rebol.com/docs/core23/rebolcore-6.html#section-1.4
21:03
world-series: [a b c d e f g h i j k]
national-series: copy/part skip head world-series 2 3
canyonblue77
21:07I came up with
21:08
long: [z r f v t g b y h n u j e d w e r t y]
sub: copy/part (skip long 12) 2
== [e d]
21:08sorry, that r should be "long"
21:10Just found the edit feature :-D
21:12Ahhh! I see the head ensures we are starting from the beginning of the series... is that right?

PeterWAWood
01:44That is correct, head positions the index to the first value in the series.
canyonblue77
02:23Thanks!! @PeterWAWood @Cybarite @pekr
Cybarite
02:23@canyonblue77 yes sorry I checked out a bit on Friday night. The problem that I often walked in to on a series is knowing where you are in the series. I put 'head' in this clip to make sure you don't add a few lines inbetween which might change where you are in the series..
Rebol2Red
13:29How can i make words dynamic?
set 'b4 22
probe b4 ; == 22

How about a loop:
repeat i 3 [set reduce[rejoin['b i]] i] ; thought this might work
print [b1 b2 b3] ; *** Script Error: invalid argument: "b1"
pekr
14:12try to word! rejoin ['b i]
Rebol2Red
14:30
repeat i 3 [to word! rejoin ['b i] i]
print [b1 b2 b3]  ;*** Script Error: b1 has no value

I will try with the latest version

Nope
pekr
14:51
red>> b1: 22
== 22
red>> i: 1
== 1
red>> get to word! rejoin ['b i]
== 22
Rebol2Red
15:08That works, but not with the loop? Maybe it is because of a local assignment. Because the vars outside of the loop has no value?
PeterWAWood
15:16@Rebol2Red You need to set the words that you have dynamically created.
15:18eg set to word! rejoin ['b 1] 1
Rebol2Red
15:20That was it. Thanks.
jouborg_twitter
20:19@jouborg_twitter
hi, I'm trying to write a simple echo server for websocketd
code: https://gist.github.com/joubertnel/43bba914a96f4b2319fec7cae8e4f18e
the code does what I expect when running on the console.
but when I run with websocketd (http://websocketd.com), STDOUT seems to only be triggered once the program exits. Is this because of STDIN/STDOUT buffering?
something else?
Rebol2Red
21:27Try to compile with: red --cli echo.red
I'm not sure if this will help you, but just try it.
21:51> Nenad Rakocevic about a stdout question i had:
@Rebol2Red Just use red --cli <scriptname> to get the output redirected to the shell.
By default, Red is using its own GUI console, not the system shell.
--cli forces it to use the system shell.
jouborg_twitter
22:52@Rebol2Red the --cli argument results in this error: "*** Error: cannot access argument file"
22:52so not sure that that's a valid command line arg
22:52(I'm on OS X, if that matters)
22:56looking at the source for "input" I see it just calls out to "ask", which in turn manipulates the console. Ultimately, I see a function "stdin-deadline" (https://github.com/red/red/blob/23a63d20ac73bd30419791ca58bc696f3aeac7be/environment/console/input.red#L447) being called. It is not available externally, so I'm going to have to experiment to see whether it gives me the right handle on stdin.
Rebol2Red
23:01Bump. I think it matters. I'm on windows10.
But it looks like Red can't find the script. Maybe placing (a copy) of the executable Red in the same directory where the script is?
jouborg_twitter
23:03I still see the same, even after moving the script into the same directory. Does --cli work for you? Or do you also get the same error?
23:05Looking at the docs I see "Note: On Non-Windows platforms, the REPL runs by default in CLI mode. But on Windows, the default is to run as gui-mode. To run it in the command line mode, invoke the red binary with the option --cli"
Rebol2Red
23:08Oops, i thought you were using windows. I only have knowledge of windows and linux not OS X.
No errors when using --cli
(I find it strange though that the output is buffered when the default on OS X is CLI mode. I had a simular problem without using the CLI mode, but could fix it with the --cli command)
jouborg_twitter
23:14I'm not sure that the problem I'm experiencing is due to buffered output.
23:14it was just a guess
23:15I'm now digging in deeper into how input is read from STDIN
23:15it is a tower of stuff, including history management
Rebol2Red
23:22I still find it strange that you get an error 'cannot access argument file' when using --cli.
It does'nt sound logical to me. If it is default in OS X i do'nt expect you to see an error like that.
But i have to admit that i am not a developer, but just a user of Red who is trying to help others.
jouborg_twitter

jouborg_twitter
00:57I've got the simple websocketd echo server working in Rebol. Looks to me like the problem in Red is the way console I/O (and I'm guessing, specifically input) is handled in Red
greggirwin
00:59@qtxie will probably be able to say, as soon as he checks in. My guess, after glancing at things, is that it's probably just buffered in the current implementation. This is a good test.
jouborg_twitter
01:00In Red, when asking for input, e.g. data: input, there's a line printed before the input prompt. In Rebol there isn't.
qtxie
02:49@jouborg_twitter Does your input string end with a linebreak(LF)? if not, the input function won't return, then the print msg will not run.
canyonblue77
06:57
multiply_big "4520345347346508738273465" "2304634563457837852066527845"

I created a "multiply" for extremely large numbers however the numbers have to be entered as strings... is there anyway to allow them to be entered without the quotes but not get treated like "out of bounds" integers ? Not a big deal at all, just curious!
dockimbel
11:28@canyonblue77 You could try modifying the console code, though, you need to do it in the sources, changing the console code at runtime won't have any effect, as it's fully compiled.
canyonblue77
11:53Haha, no that's ok. That 'd be overkill for a silly coding experiment. Thanks much though!!
dockimbel
12:23@canyonblue77 You could also rewrite a custom console, here is a short example to play with:
digit: charset "0123456789"

load-bigints: function [s [string!]][
	parse s [any [p: 10 500 digit e: insert e {"} insert p {"} | skip]]	
	s
]

multiply_big: func [a [string!] b [string!]][rejoin [a b]]

my-console: function [/local res][
	forever [
		code: ask "custom>> "
		if code = "q" [exit]
		set/any 'res try/all [do load/all load-bigints code]
		case [
			error? :res [print form :res]
			not unset? :res [print ["==" :res]]
		]
	]
]
my-console
12:23
lisp
red>> my-console
custom>> 
custom>> multiply_big 123456789123456789  789456789456789456789456
== 123456789123456789789456789456789456789456
12:26Before attempting to load/all the user input, I call load-bigints which will wrap big ints into double quotes, so they can be processed as strings. ;-)
jouborg_twitter
13:55@qtxie yes, it does.
13:56@qtxie I'm going to dig in a little more, but I wonder whether the issue is that in Red, the "input" function results in a line being printed to console before input is read, while in Rebol there's no additional line. I tried the websocketd echo in Rebol and it works perfectly. Same code as Red. Here are the two gists:
13:57https://gist.github.com/joubertnel/43bba914a96f4b2319fec7cae8e4f18e
13:57https://gist.github.com/joubertnel/b75e2300175a7e7cae9a5e226050fe0a
qtxie
14:25Not sure what is wrong in Red. Need to try websocketd to debug it.
14:27Maybe because the stdout is buffered. And also the input function expect UTF-8 encoded string.
jouborg_twitter
14:37My command line for starting websocketd with my script above is: ./websocketd --port=8080 --devconsole ./red echo.r
14:40could be because stdout is buffered; in some websocketd language examples, they flush stdout (e.g. for Swift - https://github.com/joewalnes/websocketd/blob/master/examples/swift/greeter.swift), while in others you don't have to (e.g. C# https://github.com/joewalnes/websocketd/blob/master/examples/c%23/Echo/Program.cs)
14:42good morning :-)
14:48I see print's definition is:
14:48print: make native! [[ "Outputs a value followed by a newline" value [any-type!] ] #get-definition NAT_PRINT ]
14:49Still learning to navigate the code base, but NAT_PRINT is opaque to me. See it "defined" in macros.reds, but nothing elsewhere in the source that seems to back it up
14:49mysterious! :-)
15:24@qtxie I can try flushing output to see whether it solves the issue. Any pointers on how?
18:31@qtxie @PeterWAWood figured it out!
18:33got flushing working for print (stdout) and the websocketd echo now works. Not happy with how/where I'm exposing the flush-file / fflush from so going to experiment. Also need a way to constrain the stream to STDOUT, and not null/all.
greggirwin
20:30:point_up: [July 24, 2016 6:23 AM](https://gitter.im/red/help?at=5794b3291b9de56c0edc3ec1) A custom console in under 20 lines of code. How can you not like that? :^)
pekr
qtxie
22:50@jouborg_twitter :+1:

jouborg_twitter
00:16how can I get a handle on STDOUT as a stream (as per stdio.h - http://linux.die.net/man/3/stdio)?
qtxie
00:25The only way to do it is to write your own routine! for now. We'll be able to handle it in Red when we get complete I/O support in 0.7 .
jouborg_twitter
00:41OK. Is there already a branch that has *some* of the additional I/O functionality? I'd like to conform to the style/location you're thinking for it.
01:08Or perhaps I can contribute
qtxie
01:47Nope. We haven't started it yet. :joy:
01:48There are some functions in simple-io.reds, maybe you can reuse it.
jouborg_twitter
13:23OK, I'll take a look

rpherman
10:16I'd like to create a livecoding program in Red. Can anyone update me on what audio and opengl libs are available? I am playing with Gibber and Mathbox (check out the fm visualizer!) for comparison.
pekr
10:25Sound is not available officialy yet, nor is any opengl bridge. Some parts (fonts) of Windows gui are using Direct 2D. Such special features will come later imo ...
dockimbel
10:28@rpherman You can find on the [contribution](http://www.red-lang.org/p/contributions.html) page, links to SDL, OpenGL and GFLW bindings, though they are low-level, just wrappers over the C API, so they can be used from Red/System only (means you need to write routines to interface those low-level layers with Red language itself).
jouborg_twitter
12:38Ah, that's a great page. I hadn't come across it before. And didn't know there's an OpenGL binding yet. The Trello board lists OpenGL bindings as an (outstanding) item. https://trello.com/c/jdO6Velu/31-simple-opengl-4-x-wrapper
12:45ha, but the code is pretty old; e.g. no OS X support
12:45but would be a good project to take and modernize
dockimbel
13:44@jouborg_twitter As I said above, it's just a low-level wrapper over OpenGL. What we have in mind for Red is a higher abstraction, like we did for the Red/View engine for GUI.
greggirwin
14:10For sound, you can find a non-native solution at http://www.mycode4fun.co.uk/red-sound-engine

jouborg_twitter
14:19@dockimbel sure. Then I'm wondering - how should potential contributors think about the Trello board items? For example, the OpenGL one is titled "Simple OpenGL 4.x Wrapper" and body is "OpenGL 4.X Wrapper providing same funcionatily as OpenGL header for C/C++. It should provide mappings to OpenGL API functions, types and others apadting to make it mor Red-like." I suppose the low-level bindings are still necessary as a building block / dependency for a higher-level abstraction.
14:19Are there any thoughts written down about the shape of the higher level abstraction? That way, if someone starts tackling https://trello.com/c/jdO6Velu/31-simple-opengl-4-x-wrapper they can take that into account
14:24btw, I can take a swag at organizing the trello board a little if there's interest

canyonblue77
02:15@dockimbel Custom console works like a charm! Thanks!! I played with the parse to make sure it only converts long numbers for my functions and added if statement to allow for "submitting" empty lines. I can't believe how easy!!
`
02:15
Red []
digit: charset "0123456789"
longnum: [8 100 digit]
myfunc: ["long_join" | "long_rev_join" | "long_flip_join"]

load-bigints: function [s [string!]][
	parse s [myfunc space insert {"} longnum insert {"} space insert {"} longnum insert {"}]
	s
]

long_join: function [s1 [string!] s2 [string!]] [ 
	trim/all form reduce [s1 s2]
]
long_rev_join: function [s1 [string!] s2 [string!]] [ 
	trim/all form reduce [( reverse s1) (reverse s2)]
]
long_flip_join: function [s1 [string!] s2 [string!]] [ 
	trim/all form reduce [s2 s1]
]

calculator: function [/local res][
    forever [
        code: ask "calculator>> "
        if code = "q" [exit]
	   if code <> "" [
            set/any 'res try/all [do load/all (load-bigints code)]
            case [
                error? :res [print form :res]
			not unset? :res [print ["==" :res]]
        	  ]
	   ]
    ]
]
calculator
dockimbel
05:21@canyonblue77 Glad you have fun with it. ;-)
05:57@jouborg_twitter That entry is part of [Idead for contributors](https://trello.com/b/tCypaglW/ideas-for-red-contributors) which was opened a couple of years ago when we applied to Google Summer of Code. Some entries have been added by contributors since them (like the OpenGL one), but this board has been left unsupervised, as we use only now [this one](https://trello.com/b/FlQ6pzdB/red-tasks-overview). No work so far has been done for defining an OpenGL high-level abstraction, though, using object! values for modelling a 3D world and a DSL on top of that, will probably be the way to go.
Rebol2Red
09:25I want a window to dissapear when clicking ok or pressing enter.
The following code is adapted from rebol2 (which works).
What's the Red'ish way of doing this?
key-event: func [face event] [
	if event/type = 'key [
		if event/key = #"^M" [unview]
	]
	event
]
insert-event-func :key-event
view [
	text "Click ok or press enter"
	button "ok" [unview]
]
remove-event-func :key-event

print "After ok clicked or enter pressed"
dockimbel
09:29@Rebol2Red Same in Red.
Rebol2Red
09:31Maybe with on-key?
dockimbel
09:38@Rebol2Red on-key is a face-local event, it will only work when the face has focus.
Rebol2Red
09:39I get it. Thanks.

canyonblue77
05:27
;; FYI, maybe this is a bug or, cos <> cosine ??
red>> cosine 90
== 0.0
red>> cos 90
*** Script Error: cos does not allow integer! for its angle argument
*** Where: cos
red>> cos 90.0
== -0.44807361612917
red>>
05:30nevermind, got it.... cos N = cosine/radians N
dockimbel
05:31@canyonblue77 See their respective help strings. cos takes radians, cosine takes degrees (by default).
canyonblue77
05:34@dockimbel LOL, yeah I figured it out, my mistake I keep using the "Red by Example" site not the console help which is more up to date. (Not saying anything bad about the RBE site, just that console help is more accurate)

SoleSoul
21:35Hi, a small question. Why does f1/text change only twice when repeatedly clicking on the button in this example? (write something in f1)
21:35
view [
	f1: field
	return
	button "Reverse!" [f2/text: reverse f1/text]
	return
	f2: field
]
greggirwin
22:05It works as expected here. Perhaps a recent fix?
SoleSoul
22:06I downloaded the automatic build an hour ago. I just pasted this code snippet into Red's GUI console. f1 changes twice, f2 changes repeatedly.
greggirwin
22:06But do keep in mind that reverse modifies the series, so you may want to copy.
SoleSoul
22:06Yeah, the initial intention was to copy but I forgot to copy and saw this puzzling behavior
greggirwin
22:07Ah, I see now. I was just looking at 'f2.
22:10It looks like f1/text changes each time, but f1/data does not, so the face doesn't update.
SoleSoul
22:11Why does it change twice then?
greggirwin
22:12If you manually force an update of f1/data it works. Someone on Team Red will have to say what the expected behavior is.
SoleSoul
22:12Also, it's updating the f2 face through its /text and this works.
greggirwin
22:12I don't know.
SoleSoul
22:13Thanks! I hope someone will notice the question and tell me if it's a fruit of my noobness in Red or something real.
greggirwin
22:13The object ownership system doesn't track reverse?
22:15The blog entry says it should though.
SoleSoul
22:16One thing is for sure, I don't suspect we'll find a doc which says that reverse should be tracked up to two times :)
greggirwin
SoleSoul
22:21I'm going to sleep now. Thanks for checking. I'll login again in the morning.
qtxie
23:49@SoleSoul This is caused by when you assign f1/text to f2/text, the **owner** of the string text changed from f1 to f2. When you reverse the text later, the ownership system will notify f2 instead f1, so no update in f1.
23:54To work with the ownership system is a bit tricky. ;-) As for why f1 change twice (should be just once), check [this code](https://github.com/red/red/blob/master/modules/view/view.red#L290) for detail. ;-)

greggirwin
00:33Interesting. If multiple object words refer to a series, the last one set takes ownership? (I think that's what https://github.com/red/red/blob/master/modules/view/view.red#L293 does)
dockimbel
04:17@greggirwin Faces cannot share the same series for fields like /text and be able to auto-update, the current ownership system allows only one owner per series. There's a ticket about that already (posted by Rebolek). We'll see in next releases how to improve that.
greggirwin
16:23It makes sense, and we should be able to do advanced things on our own with object ownership and dynamic reaction linking.

Rebol2Red
11:05Can someone help me to parse this correct?
rule: [any ["every"|"any"|"an"|"a" skip "is" "a|an" skip] to end] 
print parse "every man is a human" rule ; must give true
print parse "every man ist a human" rule ; must give false, because of "ist" (but the result is true)
; The rule must be wrong because i get 2 times true
SteeveGit
11:13@Rebol2Red Use **parse-trace** to debug your code.
11:14Among other misses. **Skip** only skip one character,not a word.
Rebol2Red
11:16How to use parse-trace?
SteeveGit
11:16**to end** will always validate the whole rule. Use **end** instead
11:16replace **parse** by **parse-trace**. That's all.
Rebol2Red
11:19Thanks, Whow, I have to look into the results of parse-trace.
How can i skip words?
SteeveGit
11:21Currently, You are parsing a string! not a block of word!.
Switching to a block of words, makes writing the rules simpler in your case.
Rebol2Red
11:26I am stuck. Must i make blocks of all the strings? Also in the rule? Use literal words?
rule: [any [[every|any|an|a] skip [is] [a|an] skip] end] 
print parse-trace [every man is a human] rule ; must give true
print parse-trace [every man ist a human] rule ; must give false because of "ist"

This does not work
ps: I have looked at a lot of parse examples on the internet but doesn't find anything like what i want do.
SteeveGit
11:34Ok, Instead of a block of words, I converted it to a block of strings with **split**.
rule: [
	["every" | "any" | "an" | "a"] 
	skip 
	"is" ["a" | "an"] 
	skip
 ] 
print parse-trace split "every man is a human" " " rule 
print parse-trace split "every man ist a human" " " rule
Rebol2Red
11:36Phew, Thanks a lot! I am really bad at parsing. The good thing is i have learned a few things.
SteeveGit
11:37**ANY** doesn't do what you think it's doing.
Rebol2Red
11:38What does it do ? (I thought it would give true when everything is parsed, like the case statement)
dockimbel
11:39@Rebol2Red You need to put spaces between words, | is a word, not a delimiter:
red>> first [every|any|an|a]
== every|any|an|a
red>> type? first [every|any|an|a]
== word!
Rebol2Red
11:40I thought the meaning of | is or.
dockimbel
11:41@Rebol2Red In Parse dialect, the word | indicates that an alternative rule is following. Red dialects are using Red syntax, so a word remains a word in all possible dialects.
Rebol2Red
11:47Thanks for making things about parsing much clearer.
12:06Just one last thing about parsing.
In regular expressions you can have this "(.) is (.)" (after the dot is an astrix, which doesn't shows up over here)
How to skip multiple words up to "is" (because i don't know in advance how many to skip)?
dockimbel
12:11@Rebol2Red to "is".
Rebol2Red
12:12Face palms
geekyi
14:19@Rebol2Red I found [wikibooks]( https://en.wikibooks.org/wiki/REBOL_Programming/Language_Features/Parse/Parse_expressions) really helpful to understand parse
14:21Also, checkout [this tutorial](http://www.codeconscious.com/rebol/parse-tutorial-r3.html) there is similar page in the website for the differences between versions
Rebol2Red
14:26I used to look at the tutorial you mentioned. Maybe too difficult to me or the differences are too big between r3 and Red. I will look into the differences. Thanks

dockimbel
09:44@geekyI Good finding, that one is a good Parse doc. Just remember that in Red, splitting is handled by split and not by Parse. All the rest of Parse in Rebol2 should work the same in Red.

planetsizecpu
16:39@dockimbel In my way to learn red, I found no way to print or assign ASCII values
to char, other from the #"^(41)" mode. For example #"^(x)" (where x is
integer!) gives an error. What is the correct mode to do so, there will
ve some function, like chr(x) for example?
canyonblue77
17:21@planetsizecpu would this work for you? dehex rejoin ["%" (to string! 41)] I'm sure there's a better way but being a noob myself this is what I thought of. YAY rejoin !
17:27
make-chr: function [x [integer!]] [
	dehex rejoin ["%" (to string! 41)]
	;; dehex append "%" (to string! 41) ;; would work too
]
make-chr 41
geekyi
17:29@planetsizecpu are you saying #"^(41)" doesn't work for you? Works for me in latest red
17:29
red>> #"^(41)" 
== #"A"
canyonblue77
17:31@geekyI @planetsizecpu Didn't think of trying first LOL, it works for me too. However, it returns with the # tag. Which may be what the OP was looking to avoid ???
geekyi
17:32Oh, ok, programmatically generate characters?
canyonblue77
17:43@planetsizecpu
;;Correction to previous post
make-chr: function [x [integer!]] [
    dehex rejoin ["%" (to string! x)]
    ;; dehex append "%" (to string! x) ;; would work too
]
make-chr 49
== "I"
greggirwin
17:45to-char: func [i [integer!]][#"^(00)" + i]
17:46But it looks like you may want to use hex.
17:47To make it a string, just form the result.
canyonblue77
17:50
red>> form to-char 41
== ")"

How to convert integer 41 to hex ?
greggirwin
17:51
red>> to-char 49h
== #"I"
canyonblue77
18:26@greggirwin LOL, thanks for knowing what I meant.... 41 to decimal

x8x
01:19Best way to go from 20 to #{20} ?
01:21I have:
debase/base form 20 16
;   #{20}
greggirwin
03:18That works.
dockimbel
05:12We should provide better integer/binary converters in the future.
planetsizecpu
09:28Thanks all, what I want is the easyest way to do so with an integer value.
dockimbel
09:43@planetsizecpu Use make char! for converting an integer! to char! (until we get proper to support):
red>> make char! 41
== #")"
planetsizecpu
10:49Thats useful for me, thanks.
10:53As I understand there will be to-char(integer!) and to-integer(char!) , that's the same as old basic's functions chr$(int) and asc(char), all together userful for old timer app developers :smile:
PeterWAWood
11:01Yes in principle but not at the detailed level. A Red
char!
value is a Unicode Code Point so has a value in the range 0 - 10FFFFFh.
planetsizecpu
11:04So, to-char(65) would return "A" and to-integer("A") would return 65?
pekr
planetsizecpu
11:06That's all I expected
PeterWAWood
11:08
to integer! #"A"
will return
65
.
to integer! "A"
will probably raise a script error. ;-)
dockimbel
11:09@planetsizecpu Not the same, Red is Unicode.
planetsizecpu
11:13Ok, I will test to make sure, thanks

planetsizecpu
08:02Today testing I found that seems an issue:
--== Red 0.6.1 ==--
Type HELP for starting information.

red>> about
Red 0.6.1 - 8-Aug-2016/9:25:30+2:00
red>>
red>> a: string!
== string!
red>> append a "A"
*** Script Error: append does not allow datatype! for its series argument
*** Where: append
red>>
red>>
red>> b: "B"
== "B"
red>> type? b
== string!
red>> append b "B"
== "BB"
red>>
08:07As I understand, you cannot append to an empty string! or is there an issue?
dockimbel
08:12@planetsizecpu This is an empty string: "", this is a datatype: string!:
red>> type? string!
== datatype!
red>> type? "A"
== string!
08:12A datatype is not a series (like blocks or strings), so you cannot append to it.
planetsizecpu
08:13Thanks a lot ;)
dockimbel
08:13Types are first class values in Red/Rebol. See [Datatypes of Values](http://www.rebol.com/docs/core23/rebolcore-4.html#section-3.2).
x8x
08:23@planetsizecpu a: string! -> a: make string! 10
radebrecht_twitter
09:09I want to access the github issue api from red. Something like this: curl -u username:token https://api.github.com/user. How can I specify https header infos for read?
dockimbel
09:45Currently the only way to achieve it is using write:
response: write/info url [GET [header1: value1 header2: value2 ...]]
radebrecht_twitter
10:57I get a
*** Internal Error: reserved for future use (or not yet implemented)
*** Where: write
10:58using red-08aug16-c48c359.exe
dockimbel
11:01@radebrecht_twitter Can you show the code you're using?
11:14I can see a regression there, so I've opened a ticket: https://github.com/red/red/issues/2162
radebrecht_twitter
11:17@dockimbel
res: write/info https://api.github.com [ ]
11:18slightly modified version
res: write/info https://api.github.com [ GET ]
crashes the red console
11:20ah yes:
res: write/info https://api.github.com [ GET [ ] ]
produces a response. I'm halfway there, hopefully ;)
dockimbel
11:20@qtxie should have a look at that regression quickly.
radebrecht_twitter
11:21Cool cool. No hurry, I'm having fun.
12:14Here's a bit of example code I use t produce the crash:
user: "your username"
token: "your private access token"
authinfo: rejoin [ "Basic " enbase rejoin [ user ":" token ]]
res: write/info https://api.github.com/user [ GET [ Authorization: authinfo ] ]

qtxie
14:46@radebrecht_twitter Change last line to this:
res: write/info https://api.github.com/user compose/deep [ GET [ Authorization: (authinfo) ] ]
radebrecht_twitter
18:46@qtxie That seems to have worked.

x8x
01:04What's the best way to self relaunch a compiled app? (on *nix platforms)
geekyi
05:16@x8x for iterative development? :smile: do you do i somehow right now or are you trying to figure out a way?
planetsizecpu
06:35[![blob](https://files.gitter.im/red/help/jeTY/thumb/blob.png)](https://files.gitter.im/red/help/jeTY/blob)
06:36Is random working fine?
SteeveGit
06:44@planetsizecpu Why ?
planetsizecpu
07:00what kind of randomness is on that image?
endo64
07:02@planetsizecpu Try to put random/seed form now/time in the beginning of your script.
SteeveGit
07:02Seems legit, what is the problem ?
endo64
07:03That behavior is same on Rebol too. Same seed always generates same numbers in same order.
07:04Normally now/precise will be more useful but it is not yet implemented.
SteeveGit
07:04Not specific to Rebol or Red, Random generators work like this in various languages.
endo64
07:04Sure.
planetsizecpu
07:05what is strange is that I started red-console at different moments and get the same randomness
SteeveGit
07:05now/time/precise is working
07:06@planetsizecpu Again, it's the expected result if you don't provide a new seed yourself
endo64
07:08Ah I didn't know that! Thanks! The only difference between Red and Rebol, Red requires forming the seed value.
random/seed now/time loop 10 [print random 100]
07:08without form it doesn't raise an error but doesn't change the seed value hence generates same numbers.
planetsizecpu
07:08@SteeveGit I understand what you meant, what I say is that it appears the default seed is not been initialized at start time or is to the same value
SteeveGit
07:11@planetsizecpu it's important that the seed is not initialized by default. Some apps need it, especially if you perform tests.
dockimbel
07:14@planetsizecpu The seed in Red's [PRNG](https://en.wikipedia.org/wiki/Pseudorandom_number_generator) is always the same at start, as seeding can potentially take significant time (depending on the source randomness quality) and the user should be the one choosing which source he wants to use. Moreover, as Steeve pointed out, it allows reproductible behavior by default, which can be very useful for debugging purposes.
07:14@endo64 There's a bug when seeding with time! values indeed, we are fixing it.
planetsizecpu
07:19So, for example random/secure by default gives the same result as I tested what is not you expect from secure source.
What other sources are available to get seed?
dockimbel
07:27@planetsizecpu random/secure is not supported yet. For sources of randomness, you can google about that. Current time is the most used one, others can be: capturing random mouse movements or keys pressed, reading /dev/random on Unix machines for higher-quality randomness (relying on various hardware sources), querying a true random generator online, etc...
planetsizecpu
07:47Ok, I would make some research on that, but keep in mind random/secure is returning same predictable values as seed is not provided by user
dockimbel
07:48@planetsizecpu random/secure *is not* implemented yet.
SteeveGit
07:50Dont worry, we will not forget since it's in the desription of the function.
> red>> ? random
USAGE:
random value /seed /secure /only
DESCRIPTION:
Returns a random value of the same datatype; or shuffles series.
random is of type: action!
ARGUMENTS:
value => Maximum value of result (modified when series).
REFINEMENTS:
/seed => Restart or randomize.
/secure => **TBD:** Returns a cryptographically secure random number.
/only => Pick a random value from a series.
planetsizecpu
12:38Hi again. How can I modify font size of a given area field? I did some like "Area1/Font/Size: 12" but nothing occurs.
12:41There is another question related. How can I copy text from this area to clipboard?
endo64
15:22Clipboard support is not ready yet. It will come after port implementation.
15:23Did you try font-size in VID?
15:23[![blob](https://files.gitter.im/red/help/F4G8/thumb/blob.png)](https://files.gitter.im/red/help/F4G8/blob)
SteeveGit
15:29IIRC, Clipboard support is implemented (copy and paste) in the console code ,but is localized. Would be good to externalize it in global routines. Any volunteer?
planetsizecpu
15:30Yes, I have done that: area 410x410 blue font [ name: "Consolas" size: 12 color: white ]
But have to change size dinamically while script is running so: siz: slider react [Area1/Font/Size: (to integer! siz/data * 10)] does not change font size
15:31@endo64 (sorry)
dockimbel
15:39@planetsizecpu Indeed, something is wrong there, it should work fine. I guess some code is missing internally to refresh the font in the area widget.
planetsizecpu
16:16Im testing, there is a shot
16:16[![blob](https://files.gitter.im/red/help/4qFI/thumb/blob.png)](https://files.gitter.im/red/help/4qFI/blob)
16:24[![blob](https://files.gitter.im/red/help/btr7/thumb/blob.png)](https://files.gitter.im/red/help/btr7/blob)
16:27There is an other with data
When you move size slider, area font size should change. Nothing is changed on screen but Area1/Font/Size really change their value to the slider value

Phryxe
08:44Is there a minimal menu example somewhere?
dockimbel
08:45@Phryxe Have a look [here](https://github.com/red/red/blob/master/tests/view-test.red#L128).
Phryxe
08:46@dockimbel Thanks ...
planetsizecpu
08:52@dockimbel Internal font refresh also affects font name, I have tested:

radio "Terminal" on-click [Area1/Font/Name: "Terminal"]

and it does nothing on screen, I have also noticed that radio buttons are not triggering "react"

dockimbel
08:53@planetsizecpu click event only works on buttons, use down event handler for other widgets.
planetsizecpu
09:00@dockimbel that works fine:

radio "Fixedsys" on-down [Area1/Font/Name: "Fixedsys"]

But still does not affect screen, same as size

Thx
dockimbel
09:18@planetsizecpu I've just merged a PR which is fixing that font updating issue (among other font issues).
planetsizecpu
10:04@dockimbel Thx! That is 1st class development, much encouragement!
10:10@dockimbel I have downloaded it but on compile time I get: ** Press enter to quit...
10:11it is red-10aug16-7970b41.exe
dockimbel
10:12@planetsizecpu Thanks for your support, @qtxie has done a good job on that one.
10:15@planetsizecpu Let me check that... A commit was missing, a new build is on the way, give it a new try when it's ready.
planetsizecpu
10:23Ok!
dockimbel
10:24It's available now.
planetsizecpu
11:02@dockimbel now that works, I would like compile to exe, but I get that function included on library file gives:

Compilation Error: undefined word otpGet

I did a try to compile library as -dlib but I get:

*** Compilation Error: missing #export directive for library production

And cannot compile, how I do to compile all togther?

Phryxe
12:02Regarding the list of available facets in View documentation. I first thought the facets where available for all faces, but I now think that might be wrong ...
dockimbel
13:33@planetsizecpu *how I do to compile all togther?* Define all, I don't get what you are trying to do.
13:34@Phryxe Facets are "available" to all faces, it's up to each face type to use it or not.
planetsizecpu
14:34@dockimbel in source file there is a do %otplib.red that loads code as your mysql-protocol.r did, but on compile I get undefined word otpGet
14:35that is in otplib.red
dockimbel
15:45@planetsizecpu Ok, I get it now, thanks. Replace do by #include in order for the compiler to be able to process it. You can use a either system/state/interpreted? [do %... ][ #include ... ] pattern to make it work for both the compiler and interpreter. The work for having a simpler [solution](https://github.com/red/red/issues/1601) is not yet finished.
16:05*...a simpler solution...*
planetsizecpu
17:15Thx, I'll test it tomorrow ;)
geekyi
18:51:point_up: [August 9, 2016 9:16 PM](https://gitter.im/red/help?at=57aa01dbff82b9fc7e6f37fa) @planetsizecpu cool, what are you building?

planetsizecpu
07:41@dockimbel Thx I has compiled as we wanted. Now I don't remeber a clue to hide console while runing the exe script, could you tell me?
@geekyI I just want to learn red, as I did on java in the past, I think one easy way is to learn writing programs that do string management. The script I am building is just a One Time Pad generator to create one time pads, that is not so much useful today :smile:
You can found the old (and some buggy) java version here: https://dl.dropboxusercontent.com/u/35032037/otp.jar

07:43(untranslated sorry)
qtxie
07:52@planetsizecpu Use -t Windows or -t WindowsXP for compiling to hide the console.
planetsizecpu
07:55@qtxie Thx! and good job with development, much encouragement!
08:01@geekyI These is the otp red exe script at this moment:
https://dl.dropboxusercontent.com/u/35032037/otp.exe
08:03With red I saved at least some two or three hours of development only in asynchronous running of generator! ;)
geekyi
10:05@planetsizecpu cool! Next step.. https://xkpasswd.net/s/
planetsizecpu
10:21@geekyI I found it useful :clap: Are you involved in this project?
Rebol2Red
10:36Is wrap supposed to work in an area? If so what is the syntax?
view [area bold "boldtext"]  ; this works
view [area wrap "this is a very long text which does not fit into the area
 of this widget bla.. bla... bla..."]  ; seems to do nothing
dockimbel
11:16@Rebol2Red There is a known issue for that case, see the bugtracker.
planetsizecpu
11:29@dockimbel "rate" & "on-time" what a powerful tool! I used area/actors: "" to stop "on-time" code excution as I could not find other way on docs, I guess there are some planed.
Other question is how to default to down some of radio buttons?
geekyi
11:36@planetsizecpu No,something I use sometimes
dockimbel
11:42@planetsizecpu face/rate: none will stop the timer. For the radio button, are you asking how to do it from VID or from regular Red code?
planetsizecpu
11:56@dockimbel twice
dockimbel
11:58From VID, radio off, from regular code, face/data: off.
planetsizecpu
11:58Thx!

jeffmaner
19:20I'm encountering puzzling errors trying to run Rebol scripts at the Red Console.
*** Access Error: invalid UTF-8 encoding: #{D7323020}
*** Where: read

My script files are Latin-1. I'm not sure how Red Console is finding a UTF-8 encoding.

Digging into the scripts, I finally found a different error I thought I could comprehend.
*** Syntax Error: invalid integer! at "1. * m * m"
*** Where: do

Investigating this error, I discovered that my Rebol decimal! type annotation needed to become float!. I also thought that perhaps Red was confused by mixing integer! and float!, so I appended a decimal to all the integer! literals in the function. But none of my efforts seem to address the error.

Here's the code [file](https://github.com/jeffmaner/RebolProjectEuler/blob/master/prime-factors.r) that raises the latter error.

I'm running this at the Red Console:
red>> do load %prime-factors.r


Ideas?
SteeveGit
19:36> n [integer! ~~decimal!~~ float!] "Natural number to factor."

decimal! does not exist as a type.
> if ~~1. *~~ m * m > n [

Use **1.0** instead of **1.** ,In fact you don't need it at all.
jeffmaner
19:38Wow. That fixed it. Thank you!
19:39Yeah, when you said to remove it, I realized that it's only there to coerce m to float!. So in Rebol it was 1.--is that not the case in Red? It needs to be 1.0?
SteeveGit
19:40Easy to test in the console.
jeffmaner
19:41Nice. Lol. Sorry. I shall carry on. Thanks again!
SteeveGit
19:44As a side note. I think you're right when you expect **1.** to be loaded as a float! You can put a Ticket.
jeffmaner
19:44Interesting. I may do that.
greggirwin
20:55@jeffmaner, I did some Project Euler bits in Rebol almost 10 years ago. Fun stuff.
jeffmaner
20:58@greggirwin It is really fun. And it's a great way to explore new programming languages, paradigms, etc. I need to stick with exploring one language a little longer so I can get past the first 50 or so problems. Lol. I just keep going over the same problems. But it's fun. So it's worth it. I may explore past Problem 24 using Red.
greggirwin
21:03My brain started melting after about 24 I think.
jeffmaner
21:04Lol! I know that feeling. Luckily smarter and more clever programmers in most of the languages I have studied have forged ahead before I tried, and they left good notes to inspire the lesser mortals such as I.
greggirwin
21:05Leave me notes. ;^)
jeffmaner
21:05Haha!
meijeru
jeffmaner
21:56Oh, no! Lol. I did a quick search but obviously missed your ticket. Oh, well. It can just be refused again.
greggirwin
21:56Can you delete the ticket?
jeffmaner
21:57There. @meijeru took care of it.
greggirwin
21:58Great. Thanks. Saves Nenad having to do one more thing. Every little bit helps.
jeffmaner
21:58Definitely.
SteeveGit
21:59@meijeru I could not find the ticket #1642 > 404 File not found
meijeru
22:01Git does not always succeed in suppplying the right link url, so you would have to look for the ticket explicitly among the closed issues, instead of following the link.
greggirwin
22:02https://github.com/red/red/issues/1642
geekyi
22:05@SteeveGit problem with gitter, this room is for red/help, has no associated repo
SteeveGit

bergm
08:20Hi, does anybody know if Kaj de Vos is reading/using one of these chat rooms. I'm trying to use his ZeroMQ bindings, but from the red files one can get from his website are missing at least two includes (#include %../common/common.reds and common.red), which aren't in his fossil repository, but seamingly in another one which is not accessible/seeable. Maybe somebody else has a complete set of his bindings?
Phryxe
10:32[This](http://red.esperconsultancy.nl/Red-common/dir?ci=tip) works for me ...
bergm
10:33Thank you, that's what I was searching for. :-)
10:33Did I miss a link somewhere?
Phryxe
10:34[This](http://www.red-lang.org/p/contributions.html) maybe? :)
bergm
10:37Ups, maybe one of the only pages, I didn't check - even if so obvious. Thanks again. :thumbsup:
greggirwin
21:15At some point I'll do a Red port of my Rebol 0MQ bindings. Glad you got Kaj's working in the meantime.

Rebol2Red
06:41Red seems to behave different from rebol in the way it cannot execute
a script inside other files

for example:

content of test.txt:
<script language="RED">
[
	Red []
	print now/time
]
</script>

When doing:
do %test.txt 
== </script>

No time displayed

The question is:

Will embedded scripting work at a distant time or should it work already?
06:55I just found this "This header is used to locate the beginning of Red code when embedded in text, XML or HTML file. Starting it with a capital reduces the risks of wrongly identifying it." So i think it worked at one time, but is broken now. Can someone acknowledge this?
endo64
08:55It worked when I remove the outer brackets:

<script language="RED">
    Red []
    print now/time
</script>


output
red>> do %file.txt
11:54:28
== </script>
Rebol2Red
09:16You are right, it works without the brackets, but i want to embed it into an html file like this
<!DOCTYPE html>
<html lang="en"><head>
	<script language="RED">
	Red []
	print now/time
	</script>
<html>

To run the script the brackets are needed, but this has nothing to do with Red i suppose?

Ps:
This is an embedded example in R3 which uses the brackets also

If a script is to be followed by other text unrelated to the script itself, the script must be
enclosed with square brackets [ ]:
Here is some text before the script.
[
    REBOL [
        Title:   "Embedded Example"
        Date:    8-Nov-1997
    ]
    print "done"
]
Here is some text after the script.

Only white space is permitted between the initial bracket and the word REBOL.
09:29The example is from http://www.rebol.com/r3/docs/concepts/scripts-embeded.html

PeterWAWood
00:00Can any of Windows 7+ users answer this question on the Mailing List?
"Is there any way to compile the gui console to the same folder as the red exe instead of ProgramData? (I am unable to run executables from that location due to administrative lockdown at work)"
greggirwin
02:11I don't see an easy way. %gui-console.red expects it to be there, and the crush lib builds there as well. It may also be a limitation imposed by MS to be considered a well behaved Windows app. Doesn't mean it can't be done. Just not supported out of the box right now.
jeffmaner
03:52Seriously? I'm just a hobbyist in Red/Rebol. I've not looked at compiling it for myself. But as contemporary as Rebol/Red is, I cannot believe this isn't simple to remedy.
PeterWAWood
04:01@jeffmaner The gui-console can easily be compiled from source which gives full control over where the executable is saved. Though even then, I suspect that there are permissions issues in new versions of Windows.
jeffmaner
04:11@greggirwin @PeterWAWood Ack! I'm so sorry. I did not intend to send that. That was my immediate written reaction, which I left as a draft. I guess when I leave Gitter, it sends my draft message. Again, so sorry. I'm a .Net developer by day, but I profess little to no knowledge of this particular project. I seriously regret that Gitter submitted that message! Lol. Ugh.
PeterWAWood
04:15@jeffmaner It seems a perfectly reasonable thing to write :-)
04:16We hope that you'll soon learn more about Red.
04:19It is possible to compile the gui-console from source using the binary distribution:
PS C:\Users\peter\Red> ./red-061.exe -c -t Windows e:\Red\red\environment\console\gui-console.red

qtxie
08:16Maybe we should use the AppdData instead of ProgramData ?
PeterWAWood
08:24@qtxie I suspect that if the users ProgramData directory is locked down, that others are too.
geekyi
08:44@PeterWAWood ProgramData is per program, but AppdData is per user
08:47[![blob](https://files.gitter.im/red/help/YUK4/thumb/blob.png)](https://files.gitter.im/red/help/YUK4/blob)
09:04[![blob](https://files.gitter.im/red/help/zJWL/thumb/blob.png)](https://files.gitter.im/red/help/zJWL/blob)
PeterWAWood
09:39@geekyI Thanks for the explanation.
09:42@qtxie I don't think it's necessary to change the directory yet. Most Red users at this stage will be responsible for the machine that they are using. Not too many people will be installing on a locked down work-owned machine yet.
greggirwin
17:27There are multiple issues.
- Red should be a good citizen as each OS defines it.
- It should do the best it can by default, with no config
- It should support a config file that lets you control things, as safely as possible
17:30End user Red apps will have slightly different rules. And there is the rise of containerization.

Most of us probably want the simplest setup possible. I know I lose track of the console builds until I go to appdata and see them all, and clean them up.
17:30But this is the cost of being in on the ground floor. :^)
18:12If someone knows what other languages do, that might be a nice little matrix to put in a wiki.
geekyi
20:57@greggirwin (in retrospect, I realize I've only answered one part of your question, or rather, where the *compilation cache* is stored)
**tl;dr**: the approach currently taken by rebol for user configs is probably the best
Most under the user folder in
* Appdata/Roaming,
* some in Appdata/Local
* some directly in the user folder .using_dot_convention (but mostly configs and volatile files in this case)

~~~
I think we can divide the languages into three types:
* interpreted
* compiled
* hybrid (includes jit and anything which generates an IR)

Compiled languages usually come with their own distribution of mingw and llvm

Hybrid ones are probably the ones we are interested in, as interpreted ones don't generate a compilation cache, and compiled ones are usually shipped with the compiled machine code.

Among the hybrid ones that I currently use in some way are java, python and julia:

Java and python, being stable languages, and despite using somewhat different compilation models, use the same approach; they install the compiled files (.dlls and .pyd respectively) into program files, just like the compiled languages

*the only one that comes close to Red's compilation model, julia,* has the core dist files stored in Appdata/Local and packages with their compilation cache in the user profile folder (TODO: check more JIT languages?)
greggirwin
21:27Thanks @geekyI
PeterWAWood
23:21@geekyI I believe this is a temporary problem until Red is self-hosted. Once Red is self-hosted, it will be possible to build a single executable that includes the gui-console and the compiler.

dsgeyser
19:17I've read somewhere that Opa, the programming framework, with is written in Ocaml, being functional with static typing, is very secure and immune to code injections and xss scripting. Code is dynamically compiled to Javascript, and the fact that the compiler verifies the code before execution, makes it extremely safe.
Now my question. Can Red be implimented in a similiar fashion? Would be a great selling point.
19:21I mean statically compiled. But no Javascript exists beforehand. So nowhere to inject code.
geekyi
19:29@dsgeyser I think there was discussion about sandboxes and security, but perhaps it's a bit too early. Red is still too much in alpha. Need to compile to *webassembly* first?
19:35reading about Opa on [wikipedia](https://en.wikipedia.org/wiki/Opa_(programming_language)), it looks like the "strong, static typing" is the reason for preventing sql injections? Not too different from the many functional typed--compile to javascript languages out there.. or even properly doing escaping
dsgeyser
19:35Based on this piece taken from source on web: "
19:36
the pieces of your Web application -- the HTML files, JavaScript source, image
files, CSS files, and so on -- that would ordinarily be placed in separate directories
are bundled by the compiler into a single executable. This makes deployment
simple; you only need copy one executable file to the deployment destination.
It also improves security significantly. Your code thinks that the application's
directories and files are actual directories and files out on a file system
somewhere. But, from the perspective of the outside world, the files and directories
aren't there. Someone who manages to access your Web application's home
directory cannot manipulate the constituent HTML, CSS, or JavaScript files
because they simply don't exist. In addition, the Opa compiler runs a security audit
as it builds your application, minimizing the likelihood that you might have
inadvertently introduced a client-to-client or client-to-server code injection security
weakness. The compiler will not allow foreign code to be inserted into the
execution flow at runtime.>
19:44Dockimbel mentioned Opa as a possible model for web applications. Sure hope so. Imagine blog engine, etc. with restful api build into it. Yes, proper escaping also helps.
geekyi
19:46So it does verification on compile time. Looking at their web page, it does feel a bit familiar. And they've been doing it since ~2011, must have been one of the early birds
19:47@dsgeyser are you familiar with secure in Rebol? It's one of the ways to do sandboxing there
dsgeyser
19:50The compiler automatically escapes XHTML values, which
avoids injection attacks.
19:58@geekyI Not really. The begging question . . How secure is it out there. Tested by anyone? What about injection? Or is it not possible, due to code being on the server.
geekyi
20:02@dsgeyser do you mean secure? It is more relevant to executing arbitrary rebol code. AFAIK compiling to js hasn't been done yet.. but I've read about experimental emscripten builds..
20:03Still too soon for javascript at the moment I think
20:04But I feel Rebol and Red have an advantage here, as it has parse which if used properly..
20:05Opa also seems to use the same PEG parsing concept it seems
dsgeyser
20:14@geekyI Yes "secure". Security is a big issue. I believe you can use Red solely as a functional language with static type checking. Would be more fun to build web apps with it! Kind of a "Wordpress" alternative with better security. Incidently, Wordpress is being used on 1/4 of all websites and is becoming a viable platform for building web apps with. Now with Restful api as well. Theres a market for Red to go after, if security can be guaranteed.
geekyi
20:16Can't disagree with you there on Wordpress, it has one of the biggest ecosystems out there.. has become sort of a CMS of it's own
20:17secure is a native in rebol fyi
greggirwin
20:31Can you guarantee security? If so, at what cost? These are good things to think about, but are a means, not an end. Capabilities are another way to go, right? As is minimizing surface area. And there's the Redbol idea that you can use dialects, which are tightly controlled, instead of strings that require careful escaping and are prime targets for injection attacks.
20:33A couple years ago I gave a talk on Red, where I showed various syntax elements and a small script being cross compiled. Not much really. A guy I know, who is a penetration tester by trade, thought Red was OK overall, but he was *really* excited about having a minimal toolchain and code that was small enough that you could actually audit it with some hope of success.

jeffmaner
15:37 This line of code runs in Rebol, but Red complains that the function (either lowercase or uppercase) is missing its string argument. Is there a new way to accomplish this in Red?

do random/only [ lowercase uppercase ] word
greggirwin
15:56
red>> word: "AbcD"
== "AbcD"
red>> do reduce [random/only [ lowercase uppercase ] word]
== "ABCD"
red>> do reduce [random/only [ lowercase uppercase ] word]
== "abcd"
jeffmaner
16:03Ah! Thank you so much.
dsgeyser
19:40 If I may ask: Why was @PeterWAWood banned?
geekyi
19:41@dsgeyser he banned someone else :D
dsgeyser
19:47Oh sorry. Thought that's the end of our 'test buddy'. Couldn't make out the rest. This would have been earth shuddering! Sigh...
19:57Sorry @PeterWAWood great to know you are still here! Btw. Where to find Unit tests? Maybe it can be a great source for learning Red. Is anyone else sometimes struggling with "writers block', but in a programming kind of way? How about the old timers? ;-)
ifgem
19:57@dsgeyser https://github.com/red/red/tree/master/tests.
19:58if you use Windows you have to use rebol VIEW to run tests.
19:58https://github.com/red/red/issues/2178
geekyi
20:00@dsgeyser "programmer's block"? :smile: I'm full of ideas, but don't understand enough of red/rebol yes to code much
20:02Mainly thinking of source to source transforms, trying to find better ways to understand what makes red 'tick'
20:04@dsgeyser What's your area of expertise? Or put it another way, which programming languages are you familiar with? The most useful "tools" to learn in Red I've found so far are ?, source and reflect
dsgeyser
20:04Thanks @geekyI . What is your background experience programming wise? Kind of looking around to match up with some of the people here. I find learning Red is diffucult when youre feeling isolated, and with little spare time. Looking for ways to shorten the learning experience. Any good suggestions?
ifgem
20:06@dsgeyser
http://rebol.org
http://www.red-lang.org/2013/11/041-introducing-parse.html
http://business-programming.com/business_programming.html
http://www.rebol.com/docs/core23/rebolcore.html
geekyi
20:06@dsgeyser Great minds think alike :tongue:
20:07all good sources there also checkout rebol.info
ifgem
20:08@geekyI disagree
geekyi
20:10@ifgem are you saying when everyone is thinking the same thing, someone is not thinking? :wink: I agree with you there :)
ifgem
20:11@geekyI I'm saying that I think your recommendation is false.
geekyi
20:11@ifgem what's the problem with it?
ifgem
20:12@geekyI no problem - все хорошо:)
dsgeyser
20:19@geekyI I've read - or rather tried to - halfway through some of the Factor, Lisp and Logo material out there to get a hang of what Rebol/Red is all about. What I got from all of that is the realization that Red is the culmination of really powerful concepts. I also have a wandering mind. Studied some Opa also. I knew about Rebol since 2001. Thought it was to simple to be seriousl
20:20Taken seriously. Damn cellphone keyboard!
geekyi
20:21@dsgeyser can't edit chats on phone? *like this*.. but wow, you have *much* more experience with rebol than me!
ifgem
20:28@geekyI AFAIK, it's not possible in mobile version, but if you use Android, gitteroid's pretty good
dsgeyser
20:31I'll take any recommendation. The love for programming is the driving force. And Red is really so addictive! What is tripping me up is the freeform nature. But therein lies the power. Trying to follow code and at the same time keeping intermediate steps/values in one's head. But I'll get there. Need to break chunks of code diwn into smaller pieces and use the console more to start focusing on certain code patterns.
geekyi
20:36@ifgem thanks, should try it out
dsgeyser
20:42@geekyI @ifgem I am from South Africa. I see Red as my future. This is a great community, a bit small, but we will get there. It is really great to kearn from the Gurus out there in Red Paradise. @ifgem can"t use app; Android version too old - not really keen on upgrading .
geekyi
20:44@dsgeyser agree with you on "the culmination of really powerful concepts", it seems to have a bit of everything. I think it's the philosophy that counts, there is no "rules set in stone", nothing that "you should not break", accepting all types of criticisms.
I have used Factor too, and I'm not sure if there is anything I can add to your knowledge.. you might know more than me
20:50What helps me is in thinking in terms of datatypes. In object oriented programming, you grok things when you understand everything is an "object", in functional, everything is a "function", then in haskell for e.g. you think in terms of types, and in Red, you think in terms of data (there is no code, only data). These are not necessarily mutually exclusive, you can mix and match..
20:55I'd learned that simplifying things as much as possible has advantages when I used "J", a very terse languages, but it's hard to read as syntax there is not very clean (there being complexity due to the monad dyad dichotomy), whereas in Red much attention is paid to even designing the syntax as simple as possible
20:59Other things on my todo list is looking at dependently typed languages like "Idris", which I think might interest you in that it does proofs and verification (like opa but more.. completely bug free code? :wink: ) but that adds complexity. But it is interesting that it can write it's own code in a way, assisted by the programmer. Give it types and it writes the code for you
dsgeyser
21:05@geekyI Been reading up on Forth as well. What will really be great is to learn how to break down any Concept into its smallest parts, and build up via the console and at the same time keeping an audit history of states, values, progress etc. Will be more organized and be able to go back and learn from my mistakes. How about a programning environnent that is kind of incorporated into a realtime Federated wiki where you can share experiences on a realtime basis. All for a pleasant learning experience.
geekyi
21:07@dsgeyser like the IDE in Factor? (without the history part) It's one of the best I've seen, really helped me to learn
dsgeyser
21:18@geekyI Yeah the IDE in Factor is really great. Wish we had one for Red. But I think the freeform nature of Red will make developnent of an IDE for Red very difficult.
greggirwin
21:23I think we'll see amazing IDEas for Red in the future. If you look at how some tools build based on ASTs, you could think in those terms, but as progressive evaluations.
geekyi
21:24@dsgeyser on the contrary I think it would be easier.. Factor is not much less free form, both have a common origin in Forth. If anything, I think there is mostly not that much *need*
21:24also it is easier to build gui programs in Red
greggirwin
21:24For learning, a lot of old Rebol material is applicable, including the Core guide. Start small. And trying to do too much in long expressions can make it hard to track. I know some people will say temp vars are bad (pure functionalists), but if you think along Forth lines, temp vars are just part of your vocabulary (rather than using the stack).
21:25What may be trickier is an environment that intelligently tracks context for dialects, but that will be doable too.
geekyi
21:27@greggirwin you should try out Factor, if only for the IDE, has one of the best UX. It is a large download tho
greggirwin
21:28And we can play with a lot of ideas. I started a couple gists (math-lab and trig-lab) to push the idea of "lab" tools for specific areas, like the gradient lab.
geekyi
21:29For example, for the documentation, the main concept is you can include snippets of code, and each word (about the same as word in red) is clickable like a hyper link to get to the source
greggirwin
21:29I did install Factor and fired it up (and Pharo and Racket and Io and Nim, and need to check out Spry). So much to do.
geekyi
21:30Hehe.. sorry for the assumption. Maybe we should have some documentation somewhere collecting the ideas from different languages :). I should do this.. meaning to note them down somewhere
21:34@greggirwin Spry is javascript? (https://en.wikipedia.org/wiki/Spry_framework)?
greggirwin
21:36My approach is to build experimental tools, mezzanine ideas, etc. and see what clicks with people. I do think there's a lot to learn from other languages, but "collecting ideas" (the way it clicks in my head) is tricky. Rebol was designed over a very long period by one great mind. Red is following that vision. I don't think we can build Red by committee or feature matrix. Not that you meant that (text can be hard to get all meaning from), so please don't take offense.

Formal proposals for changes to Red need to be well thought out.

Experimental tools, and building things based on good ideas we've seen...yeah, let's go nuts.
dsgeyser
21:36@greggirwin a little offtopic, but I think Red is capable of producing a way better search engine library than Elasticsearch etc. Especially after 2.0.
greggirwin
21:36http://sprylang.org/
asampal
21:36@geekyl , here's what someone did for Ren-C, a Rebol fork, in terms of a smarter REPL with some IDE-like features (https://www.youtube.com/watch?v=scNIGsLiCgM https://www.youtube.com/watch?v=0exDvv5WEv4). I'm sure that Red will allow for similar prototypes to be created quickly.
dsgeyser
21:38@greggirwin started studying up on your Mezzs functions. Think it will make a great learning resource.
greggirwin
21:38Many years ago I did a simple Intellisense function for R2, and have also built a Smalltalk-like system viewer. We have very few technical limitations in Red.
geekyi
21:39@greggirwin bit unfortunate it is eclipsed by an adobe product with the same name
21:39@asampal thanks
asampal
21:39@geekyI I agree about the Factor environment - pretty sharp implementation.
greggirwin
21:40@dsgeyser, if there are any funcs you think would be good, let me know. I have zillions of them in R2. Trying to be selective, organize, and think about them as a whole.
21:41I love Redbol, because they make it fun to think about things and try different approaches.
dsgeyser
21:47 @greggirwin Don't be shy to put your gazillion mezzs somewhere reachable for us mere mortals, if you have the time. Also expect lots of questions. WE HUNGRY... ;-)
greggirwin
21:50Not shy, but just dumping them won't be useful. Happy to answer "How would I..." questions though.
dsgeyser
21:58@greggirwin Thanks. Will do. I really appreciate your active participation here. Got to get some sleep. Its midnight here, kind of hard to leave this place. ^-)
geekyi
22:10@dsgeyser checkout gregg's gists

PeterWAWood
05:49@dsgeyser You can find the main unit tests here in [Github](https://github.com/red/red/tree/master/tests/source/units).

dsgeyser
07:57@PeterWAWood Thanks. Do you think going through the Unit Tests will help me to grok Red? @greggirwin Can you please show an example using temp vars, as I am trying to get a grip on following long sequences? Perhaps also ways to inspect intermediate values. Hope this makes sense.
greggirwin
17:42Say you're writing a minesweeper game. Your board has a block of cells, each is keyed by its position.
board:  #(
    size: 9x9
    cells: [1x1 [a] 2x1 [b] 1x2 [c] 2x2 [d]] ; ...
)

You need a random list 10% of the cells to put mines in, and to iterate over that.
foreach pos copy/part random extract board/cells 2 to integer! board/size/x * board/size/y * 10% [
    ; place mine
]

Using temp vars, it might look like this.
num-cells: board/size/x * board/size/y
mine-count: to integer! num-cells * 10%
cell-positions: extract board/cells 2
random-mine-cells: copy/part random cell-positions mine-count
foreach pos random-mine-cells [
    ; place mine
]
ifgem
17:46@greggirwin Runtime crash on redefining function!, action! during its call. Is this a good title for a bug:)?
greggirwin
17:48@dsgeyser , reading unit tests can show you edge cases and such, along with expected results, but it will be *very* dry way to learn the language. I suggest picking small programs you want to write, or that you've done before. Use the console and help. Play and have fun experimenting.

What is your background? We might make other suggestions if we know where you're coming from.
17:49@ifgem, it's a little hard to parse. :^) "Redefined function!|action! crashes" ?
ifgem
17:50@greggirwin https://github.com/red/red/issues/2199. I'm not a native speaker, you know:))
17:52@greggirwin it works in Rebol:))))
greggirwin
17:58Remember that not *everything* that works in Rebol will work in Red. Compilation will change some rules, at the very least. In this case, it should at least not crash.
dsgeyser
18:04@greggirwin Thanks. You have been very helpful. Am I correct in saying you are defining new words, which work like vars in other languages?
radebrecht
19:02Hi. How do I load one of the contributions? I want to use the JSON codec. Do I need to clone the git repo?
greggirwin
19:10@dgeyser, yes. We sometimes refer to them as vars in Red as well. They are just words that refer to values. A distinction from other languages being that *values* in Red are strongly typed, but *words* can refer to any value, so as "variables" words are *not* strongly typed.
19:11@radebrecht, for now, yes. I have various Redbol JSON codecs here, and it's on my list to create a reference implementation that will be standard in Red.
radebrecht
19:13@greggirwin Thanks. So I clone the repo and #include %path/to/file.red in my own project. I'll give it a try.
greggirwin
19:14You can use do on the file if you're running in the interpreter.
radebrecht
19:19@greggirwin Thanks again. It worked as in I could load the file. Unfortunately now the load-JSON function throws parse errors. Sigh. I'll learn the parse dialect and extract the data I need myself. Luckily it's the weekend. Cheers
greggirwin
20:15Depending on your needs, you could use R2 in the interim.

geekyi
12:15@radebrecht as a relatively recent newcomer, I second the use of R2, if you aren't using it already
radebrecht
14:41@greggirwin @geekyI Yep, I thought about that. I need to deploy an executable though. Also I like the look of the native UI better. Looking forward to seeing OSX UI released. Also, I made good progress with parse, got my data extracted. Cheers
geekyi
14:46@radebrecht by the way, which load-JSON function? Is it the built in load i.e.
load/as {{ "e" : "e" }} 'json
15:00just checked the source for load, it isn't implemented yet. There are options to deploy in rebol, [like this guy got to recently](https://gitter.im/red/red/welcome?at=57bc19fcb64a3a016f5c1fcf) but if you were able to do it in red, much better..
greggirwin
15:00Glad to hear you got it working @radebrecht !
radebrecht
21:19@geekyI Nope, I was looking at [this](http://red.esperconsultancy.nl/Red-JSON/tree?ci=trunk&expand), as linked from [red-lang contributions](http://www.red-lang.org/p/contributions.html). I don't think I handled it right, there are some references in the code which weren't locally available on my system. The code's quite intelligible though, helped me a lot.
greggirwin
21:25Tinkering now. There are a few different Redbol versions out there, which I'm trying to reconcile and bring up to date with rfc7159.txt.

Rebol2Red
13:04I want to make a thumbgallery
block: copy []
files: read %./

foreach file files [
	append block 'image
	append block 100x100
	append block file
]
view block

*** Script Error: func does not allow file! for its body argument
*** Where: func

Why does the following works and the previous not? (looks like the same thing to me)
view [
		image 100x100 %DirtbikeChampionship.jpg 
		image 100x100 %DominoDraw.jpg 
		image 100x100 %DuckHunt.jpg
]

Ofcourse i want to do it dynamically
geekyi
13:08@Rebol2Red not sure, but maybe because view parses the block as a dialect?
Rebol2Red
13:09Maybe, But is there a way to do this dynamically?
geekyi
13:11@Rebol2Red just a suspicion, need to check if it requires new lines in the original block
Rebol2Red
13:12Nope
geekyi
13:51@Rebol2Red
block: copy []
files: read %./

foreach file files [
	if %.jpg = suffix? file [
	    append block 'image
	    append block 100x100
	    append block file
	]
]

view block
13:51Works for me with that; probably it was also taking as input your .red file
Rebol2Red
13:54Yeeees. That was the problem. Thank you very much!
geekyi
13:58:smile: I think red needs a way to do a stack trace? Just maybe.. that code goes through a dialect which makes things harder to see..
greggirwin
17:05If you probe the block before view gets it, what does it contain in the case where it fails? Examining the data sometimes make things obvious.
endo64
17:22We were talking about digging gitter to pick up useful Red functions, onelines, tips&tricks and put them on a wiki or similar formatted site.
I just saw that SO has a beta Documentation section and it looks like what we plan. Take a look:
http://stackoverflow.com/documentation
greggirwin
17:27I saw that recently as well. Didn't excite me at a glance.
17:30It could be good for examples, linked from reference docs, but one of my first questions was whether you can export from it. I didn't see any info on that.
17:35Knowing we're a small community, we need to leverage tools. But we also have a language that can self-represent its documentation and use it in different ways. My personal concern is putting effort into a system that then owns my data, which I can't get at and use any other way.

It would be great to have someone R&D on it though. My concerns may be unfounded, and there may be a great API. I remember past efforts (my own and others) to do something similar with wikis, where it ended up being more pain than it was worth.

Still, it's early and my opinions are hardly set in stone. :^)
17:43Note that I'm not saying I'm *against* it. With luck Red will get to the point where a lot of people put things out there. I'm thinking more of organized docs. I should also note that I've never been a huge fan of wikis. I *love* that anyone can edit, but they tend not to have a cohesive design. Wikipedia works amazingly well, because you get a link to a specific thing, and then you can follow more links, but I've never been able to use it to start someplace and explore in a linear or hierarchical manner.

endo64
14:07I totally understand @greggirwin , I'm not a fun of wikis for a documentation of a programming language although wikis are great as general.
But I'm not offering to have a Red Wiki, which we already have actually.
But did you check the link I sent? Stackoverflow is providing a documentation tool, which looks useful because we all familiar with using of SO.
14:08For example check this out: http://stackoverflow.com/documentation/r/1157/date-and-time#t=201609051401041082496
14:12It shows usage examples for DataTime functions of R language. It limits the number of examples so it doesn't get too long.
I thought that it might be useful especially for beginners (not people who have Rebol background, people who start with Red).
Because the most useful documents when I start learning Rebol were Cookbook and Oneliners. They directly show what I need AND how to do it in Rebol (and how to think in Rebol way)
geekyi
14:16@endo64 I mentioned this before on /docs [August 19, 2016 12:38 AM](https://gitter.im/red/docs?at=57b60ec7cd00bdff6e5e6b51), while my experience with stackoverflow isn't that great, I do think someone should try and see how that works (maybe that someone should be me and you :wink: )
endo64
14:22There are many useful functions and idioms flowing here, many functions in our rebol.r/user.r files which one can learn very fast and easy, but no one see.
14:25@geekyI I'll try to play on SO, but I don't want to affect negatively on Red, as I'm not a guru and my English isn't that good.
greggirwin
18:07@endo, yes, I did look at it and read the Tour info when @geekyI posted about it before. Don't let me discourage you. We need to try things and see what sticks.

WaBerlin_twitter
15:22I have a question on usage of elements in Red/View. The documentation:
(https://dockimbel.gitbooks.io/red/content/v/v0.6.0/gui/View.html#check)
provides information on usage of a check box.
There is a "data" documented which can be true : checked or false : unchecked. How can I set this value?
The following line : view layout [radio "test" right true] results in a Script Error.
jeffmaner
15:24@WaBerlin_twitter Include data before true.
15:25
view layout [radio "test" right data true]
WaBerlin_twitter
15:29Thank you for the hint. Eventually I do not understand the logic of the documentation. I tried to put align in front of right or text in front of "my_text". However both result in a Script Error. What is different with data?
jeffmaner
15:34@WaBerlin_twitter I don't know the answer to why data is required where align and text are not. I've had a very tough time finding what I need in the documentation, and have just had to rely on the good folk here and lots of trial and error to get my GUI mostly functional. The community here is patient and very helpful.
greggirwin
15:36VID is a dialect, so there is not a strict property value syntax. If you look at the Keywords and Datatypes sections in the doc, that should clear things up. Some keywords are independent, while others take args (e.g. draw, data), and some datatypes can be automatically applied to a face based on their type.
15:39'Align isn't a keyword, it's part of the para facet, which you can apply like so:
red>> view layout [radio "test" para [align: 'right] data on]

The alignment keywords are just handy shortcuts.
15:40Under Datatypes, in the VID doc, you'll see that there is no handling of logic! values, which is why true or on isn't automatically applied to the data facet.
jeffmaner
15:43Thanks, @greggirwin ! As usual, it makes perfect sense once you chime in.
greggirwin
15:46:^) An advantage to this approach is that it greatly reduces redundancy and noise, where things aren't readily ambiguous.
jeffmaner
15:48Once I got moving at a decent pace on the GUI, it was so much simpler and easier than other GUI technologies. I really like it.
geekyi
19:01:point_up: [this](https://gitter.im/red/help?at=57d0309efe284f6c30308ce1) and [this](https://gitter.im/red/help?at=57d0340cfe284f6c303098f4) should probably be on stackoverflow as a question
19:04@WaBerlin_twitter would you care to write there? :smile: In general, I feel we should add questions to stack overflow which don't turn out to be bugs in red
greggirwin
21:35That's a good idea @geekyI

WaBerlin_twitter
10:52If gitter/red/help is not the right forum, I am willing to change to stack overflow.

Which is the correct location there :
(http://stackoverflow.com/questions/tagged/red) or
(http://chat.stackoverflow.com/rooms/291/rebol-and-red) or ???
PeterWAWood
11:01@WaBerlin_twitter This is a good place to ask your questions. Another good place would be the [Red Mailing List/Forum](https://groups.google.com/forum/#!forum/red-lang).

Questions and answers in this forum tend to get lost over time, though not those on the Mailing List which is searchable.
I suspect @geekyI is suggesting adding good questions to stack overflow as then they will be easily available to others. The downside of asking on Stack Overflow is that the people who would answer your questions posted here probably wouldn't see them if they were posted on Stack Overflow.
geekyi
11:06@WaBerlin_twitter oh I'm not saying *not* to ask here, but
> add questions to stack overflow which don't turn out to be bugs in red

so, ask here, and if it isn't a bug, and is useful info in the long term add there, (http://stackoverflow.com/questions/tagged/red)
@PeterWAWood yes exactly
11:09@PeterWAWood I think SO questions can be integrated to the side bar here? I've not looked into how you can do that tho..
11:11I think red/help *is* the appropriate channel to do so, possibly also from the red mailing list/ forums

WaBerlin_twitter
05:16I try to understand aspects of Red VIEW and want to ask about a pointer to any documentation. When looking at various examples I collected the following possible element properties for the GUI element TEXT.
center / right / left
size
bold / italic / underline
font size <xx>
background color <xxx.yyy.zzz>
font-color
hidden

Some of them need the property name, some not.
help text does not work here.
QUESTION: is there a document which describes those details of GUI elements of Red VIEW? Thank you in advance.
rebolek
05:40@WaBerlin_twitter Take a look at [Rebol's VID](http://rebol.com/docs/easy-vid.html). It’s basically the same (Red's VID is more advanced and things like reactors are not covered there, but [Red’s homepage](http://www.red-lang.org/) is full of usefull info).
WaBerlin_twitter
13:04@rebolek : thank you. However the examples in Rebol's VID are not allways compatible with RED view. E.g. the section "Document Text Style" says:
backcolor white                   ; not compatible to RED
text "Normal"
text "Bold" bold
text "Italic" italic
text "Underline" underline
text "Bold italic underline" bold italic underline
text "Big" font-size 32
text "Serif style text" font-name font-serif ; not compatible to RED
text "Spaced text" font [space: 5x0] ; not compatible to RED

I was looking for a more precise description of the possible properties for GUI elements in RED (without trial and error).
If that does not exist at the moment, than this is OK but clarified.
DideC
13:10@WaBerlin_twitter Did you have a look at [Red VID documentation](https://doc.red-lang.org/gui/VID.html) ?
13:12Don't forget that some keywords are irelevant for some styles!
WaBerlin_twitter
13:12The RED VID documentation is very generic and does not cover the details of element properties.
I also looked at (http://www.red-by-example.org/index.html) which states "To do by red-by-example team ...".
DideC
13:14Did you play with Nenad's realtime VID script ? It help test any VID combination.
WaBerlin_twitter
13:18No, where can I download this?
DideC
13:24Not sure you need a download for just that :
Red [
	Title:   "Simple GUI livecoding demo"
	Author:  "Nenad Rakocevic"
	File: 	 %livecode.red
	Needs:	 'View
	Usage:  {
		Type VID code in the right area, you will see the resulting GUI components
		rendered live on the left side and fully functional (events/actors/reactors working live).
	}
]

view [
	title "Red Livecoding"
	output: panel 400x600
	source: area 500x600 wrap font-name "Fixedsys" on-key-up [
		attempt [output/pane: layout/only load source/text]
	]
]
13:33I play with it a lot and found that there was just a limitation to use it : you can't define Red's values to used in the VID code.
So I made my own version to solve that, to be found [here](https://gist.github.com/DideC/85d60c99f97f2e4972a6f7b09a1fe630).
ifgem
greggirwin
19:07The current reference docs are:
- http://doc.red-lang.org/gui/View.html
- http://doc.red-lang.org/gui/VID.html
- http://doc.red-lang.org/gui/Draw.html

There is not yet a per-style reference of supported facets (properties).
geekyi
19:13@WaBerlin_twitter for new features in Red, I found the blogposts on http://red-lang.org most useful. But you are right about the docs being sparse right now..

dockimbel
06:07@DideC Great work on enhancing the livecoding demo. :+1:
Dimonax
21:02How do we go about rebuilding Red since the Rebol SDK isn't available?
geekyi
21:42@Dimonax posting in red/welcome is usually enough for starters, :tongue: problem usually is most people are away :smile:

DideC
11:31@dockimbel thanks. It stays simple but a little bit more usable IMO.

BrianOtto
06:54Is it possible to load a font from a local directory, instead of having to install it first and then reference it by name? I found an old REBOL example here: http://rebol2.blogspot.com/2011/12/using-bitmap-font.html
But doing something similar in Red doesn't appear to work:

displayFont: layout [
txtLine: text 1000x100 "Lorem ipsum dolor sit amet, consectetur" font [ name: "Cabin-Bold.ttf" color: red]
]

It just uses a default font when I do that. I have tried specifying the full path to the file too.
I am running it in Windows if that makes a difference.
rebolek
08:54@BrianOtto AFAIK it is not possible (yet?).
08:54Red uses standard OS libraries to load fonts, so there is no mechanism to load custom ones.
BrianOtto
14:49@rebolek Ahh I see, good to know, thanks!

WaBerlin_twitter
08:43I explore certain features of RED. The following script causes an error.
I wonder why:
red[]
	trigger: ["<title>" "</title>"]
	trigger-start: trigger/1
	
	page: read http://www.rebol.com/
	parse page [thru trigger-start copy text to "</title>"]	; -- works
	parse page [thru trigger/1 copy text to "</title>"]		; -- fails
	; *** Script Error: PARSE - invalid rule or usage of rule: trigger/1
	print text

rebolek
08:46IMO it is a bug.
08:46Parse should allow path! as rule.
PeterWAWood
09:54An easy workaround is to compose the parse rule:
parse page compose [thru (:trigger/1) copy text to "</title>"]

dsgeyser
08:14Is it possible to encrypt/decrypt email or any message in Red, before sending/receiving? A custom solution will be nice.
PeterWAWood
08:52@dsgeyser No. Red is still incomplete and does not yet have any encryption
08:56The current alpha release of Red does not support sending and receiving emails.
08:57Future versions will contain such features.
dsgeyser
10:35can I remotely host the red exe and via a remote process allow scripts to be compiled or interpreted locally, without red being present on the local host?
10:36Initially.
10:37What is initially needed on local host?
10:37I know Red still lacks IO.
pekr
11:10Red has some basic IO, called simple-io, not sure if it could be ready for your needs though ...
greggirwin
15:50@dsgeyser, without networking support, the best you can probably do right now is using the file system as an IPC mechanism. If you're talking batch scripts, that should be fine.
dsgeyser
18:37@greggirwin What will be the absolute minimum requirement on the local system, as a starting point? Want to implement remote services without the user having to download and run the red exe to start with. Is this possible? Can I isolate the interpreter and run it remotely, but have the resulting GUI displayed locally.
greggirwin
18:40Red doesn't run in the browser, so I'm not sure how you could do anything like that with *any* tool. i.e. you need *something* on their system to run things from.
18:41i.e. where would the GUI display?
18:42Unless you have them remote into the machine where Red is, or something like that.
dsgeyser
18:43Like RPC?
greggirwin
18:44No. For that you still need a client making the remote calls, right? I mean like RDP/SSH.
dsgeyser
18:45Can the interpreter be isolated without the compiler? No need for compiled scripts at the moment.
greggirwin
18:46No. You can't separate them today. But what is the benefit of removing the compiler?
dsgeyser
18:48Sorry. You are correct. RDP
18:57People are sometimes reluctant to download an unknown exe. I want to incorporate Red into a messaging system (webapp with encrypted Red scripts), as a collaborative workflow system. This is just an intermediate solution while we are waiting for networking and encryption.
19:41Is it possible to interpret a script without having the interpreter open. (console mode? command line?)
20:13To evaluate a remote script in Rebol: REBOL --do "do http://www.rebol.com/speed.r".
And in Red with GUI output?

PeterWAWood
00:41@dsgeyser Yes. The interpreter can be "isolated" from the compiler. The Red consoles do just that. If you first console, you can then run scripts with it like this:
PS E:\Red\red> ./gui-console tests/hello.red
dsgeyser
06:46@greggirwin @PeterWAWood Thanks. Your help is appreciated.

TimeSeriesLord
00:23Does the Red exec look for user.r like REBOL 2.7.8 or is it something that can be fed at launch time as a command line argument?
01:24I have my answer for Win 10. Thanks though.
06:58At the console, i can do this:

red>>  dash: charset {-—}
== make bitset! #{0000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000```

But when Red tries to evaluate that from a start up script, it chokes. Also, that looks like a bizarro  bitset. 

The error:

*** Access Error: invalid UTF-8 encoding: #{977D0D0A}
*** Where: read
`

Anyone?
rebolek
07:00@TimeSeriesLord what do you mean by startup script?
07:03@TimeSeriesLord check the encoding of your file, if it is really UTF-8.
07:03When I save your example, I can’t find #{977D...} in it.
07:04
red>> to binary! {-—}
== #{2DE28094}
TimeSeriesLord
07:04Start up script = a script loaded at start up (boot up, fire up, launch — whatever word or phrase that you prefer).

Running on Win 10, I have set up a shortcut that runs

C:\Users\redacted\PortableApps\Red\red-061.exe start.red

That %start.red works like a %user.r in REBOL 2.7.8. That is my master file that loads my dictionary of words (functions, aliases and the like) to create my virtual computer environment.
rebolek
07:05I see.
TimeSeriesLord
07:05@rebolek I'll check it out. It's possible that the file has old DOS encoding.
rebolek
07:06@TimeSeriesLord that is my guess, it‘s probably not saved as UTF-8, as I can’t reproduce it.
TimeSeriesLord
07:18@rebolek Yeah, thanks. It looks like a joy to fix. I saved it in UTF-8 w/BOM in Metapad and then opened it in Scite. Scite shows all of the funky chars that must not have translated. After I clean this up, I will let you know if that was the problem.

For my parsesets, I use prefixes, e.g., ¿symbols for [some symbol] rules and ¡symbols for [any symbol] to remind me of either some or any. It looks like Red spit on the ASCII encoding of those.
rebolek
07:20That’s because they are not ASCII symbols.
TimeSeriesLord
07:20> That’s because they are not ASCII symbols.

And not Extended ASCII?
rebolek
07:21Not sure what do you mean by extended ASCII. ASCII is 0-127.
07:21If you mean some codepage like Latin-I or Windows-1250, Red does not support them.
07:22It is possible to write convertor however, but having this in basic Red wouldn’t be practical.
TimeSeriesLord
07:23> Not sure what do you mean by extended ASCII. ASCII is 0-127.

You have never heard of Extended ASCII? You must be new at computing (circa 21st century). ;-)

https://encrypted.google.com/webhp?hl=en#hl=en&q=extended+ascii&tbs=whnv:1

I'll hand clean it. It's only about 50 parsesets. But I can't do my load into blocks any CSV file from anywhere on the Internet magic without them.
rebolek
07:25Oh, this. So different codepages, basically :)
07:27@TimeSeriesLord Take a look at something like http://www.rebol.org/view-script.r?script=utf-8.r&sid=wtldf3tk
TimeSeriesLord
07:28Cool. Will do.
rebolek
07:28That is Rebol script for conversion from different codepages to UTF8. I guess it could be adapted for Red easily.
07:30I was using it for automated conversion of the mess that was Windows Vista localization some 10 years ago.
TimeSeriesLord
07:30Hey I can totally understand your need with that mess.
rebolek
07:31I was hero back then ;) The team was doing it manually before I started using Rebol for this :D
TimeSeriesLord
07:34Yeah, your team must have worshiped you.
rebolek
07:39If they gave me raise, it would be better ;)
TimeSeriesLord
07:41Of course. Well, anyone is only worth their opportunity cost (i.e., what another employer is willing pay to snatch one away).

Did you move to greener fields?
rebolek
07:42Yes, but I think we are getting really off-topic here ;)
TimeSeriesLord
07:42That's too bad. The Red folks need a red/lounge gitter
07:43Many good ideas can come from free form chat. Few can come from heavy-handed censorship.
rebolek
07:43True.
TimeSeriesLord
07:48Well, everytime Red fires up, I am wowed over the start up speed.
greggirwin
16:53@TimeSeriesLord, I add sigils and use naming conventions myself. For parse rules, I often append a char that mimics Kleene notation. i.e. ? for opt, * for any, + for some. Sometimes I'll pluralize the name though, depending on what makes other rules more readable. I've also appended = to names, to mimic ::= in BNF and make rule vars stand out.
TimeSeriesLord
23:13@greggirwin Yeah, I follow you why you do it right down to some words being plural. As you can see (some missing), this is kind of how I do it.

More than one individual thing gets (s) at end. A group as a unit does not.

I put this up here only if it helps a novice.


¿word: [some letter]

¿spaces: [some whitespace]
¿words: [some ¿word] 

¿phrase:  [some [ ¿words | ¿spaces] ]
¿sentence: [some ¿phrase opt endmark]

red>> s: "This is a silly Sentence?"
== "This is a silly Sentence?"

red>> parse s [ ¿sentence]
== true

red>> s: "This is a sillier **$*$*$23 sentence!"
== "This is a sillier **$*$*$23 sentence!"

red>> parse s [ ¿sentence]
== false


Of course, in true parsing, one would need to account for numbers of all kinds, e.g., 1st, 2nd, 3rd, 4th, 33.6, 2**6, 2x10^6, and so on.

Parse was a bit of more of a struggle than it should have been at times until I started doing it this way.

Many of the sparse examples of Parse mixed all kinds of naming, which only added to the poor explanations offered. Too many struggle to explain what they claim to know. Their struggling calls into question always how much do they know, in truth.
23:28It seems though that one can not type Unicode at the Red console under Windows 10, which is a huge bummer. Does anyone know why?

Red 0.6.1 - 8-Aug-2016/9:32:11-7:00
Windows 10 1607




greggirwin
01:39We don't yet have a *parse style guide*. :^) @qtxie or @PeterWAWood can probably give details on the Unicode issue.
qtxie
02:23@TimeSeriesLord I can type Chinese in the Red gui console under Windows 10. Would you please provide more information about it? Like how to reproduce the issue?
TimeSeriesLord
02:39@qtxie Sure. Do you know Win 10 Alt+ with the right registry key set?

If so, try typing ALT+00A1. It should produce this: ¡
qtxie
02:48Ok. I see the problem now. Try to fix it...
04:04@TimeSeriesLord Should be fixed now in master branch.
TimeSeriesLord
06:15@qtxie Thank you! Thank you! Xièxiè dàjiā!

dsgeyser
10:50Whats the minimum Red version for Android (phone)? Want to play with 'Core' while on the move?
rebolek
10:51@dsgeyser there’s no minimum version, you can use the latest. GUI is not finished though.
10:53If it does compile for your CPU, there are no limitations, AFAIK.
dsgeyser
10:54@rebolek Android phone?
rebolek
10:56@dsgeyser Compile console with -t Android and it should work (I haven’ tried it in a while but it worked last time I checked it)
dsgeyser
11:05@rebolek Thanks

Rebol2Red
15:28Is it possible to clear the console inside your script like cls or clearscreen in other programming languages?
( maybe with some ansi code )
rebolek
16:00@Rebol2Red Do you mean GUI console, or standard console?
Rebol2Red
16:02Maybe stupid, but i think i don't know the difference
rebolek
16:03Ah, GUI console is written in Red/View, standard is using standard system terminal.
Rebol2Red
16:03Then it is standard
rebolek
16:05Ten you should be able to use ANSI codes. Let me try...
16:12@Rebol2Red Tried this under OSX and it works:
print "^(1B)[2J"
16:14Not under Windows.
16:16It Windows, it apparently needs to be enabled first: https://support.microsoft.com/en-us/kb/101875
Rebol2Red
17:23I am using windows 10 and there is no config.nt to enable ansi.sys. I do'nt know another way.
rebolek
18:03Hm, please check https://www.wikiwand.com/en/ANSI_escape_code#/Windows_and_DOS for more info, there should be some support in W10 (I have only W7 in Virtual Box, so I can’ t test it). Anyway, for Windows I guess it would be good idea to add (at least partial) support for ANSI sequences to GUI console. It should be doable I guess.
greggirwin
18:11Ctrl+L clears the Red GUI console, just FYI.
Rebol2Red
18:14But how to do it within a script? Just send keystrokes? Which ones?
greggirwin
18:15I don't think that's possible yet.
Rebol2Red
18:19Should i post an wish issue for it?
greggirwin
18:19Maybe someone from Team Red can say what their plan is. If system/console can be modded, or if we need to do it at the lower levels.
18:20Wish: Sure.
Rebol2Red
18:23Done, Thanks.
greggirwin
19:08If you have source installed, %red/environment/console/terminal.reds has the key handling. Basics are obvious, but also shows that Ctrl+<key> options for nav are supported, and Ctrl+K to delete to end of line. Ctrl+L should work in both consoles it seems, so there's likely a bit of lower level work to do.

Mufferaw
14:48Hi everyone, I'm new to Red and trying to get my bearings. I'm trying to make a 2d 'array' and fill it with random bools but I'm not having much luck. Is there a way to iterate through all the elements in my array ( which is basically a block of blocks) ?
rebolek
14:54Welcome @Mufferaw
14:56Here's one way how to do it:
collect [repeat i 10 [keep/only collect [repeat j 10 [keep random true]]]]
Mufferaw
15:08@rebolek Thank you very much! I didn't even see/notice the collect function when I was reading through all the docs. I have a long way to go!
rebolek
15:10@Mufferaw You’re welcome. If you have other questions, feel free to ask, I'll be happy to help.
Mufferaw
15:13@rebolek Much appreciated, I have a feeling I'll have a lot of questions.
rebolek
15:20That’s the best way how to learn something ;)
geekyi
15:35@Mufferaw collect is new in Red (if you are used to Rebol), so it is mainly documented in the blogposts of http://redlang.org website
greggirwin
15:38@Mufferaw, if you need to do this kind of thing a lot, here's Red version of Rebol's array function:
array: function [
	"Makes and initializes a block of of values (NONE by default)"
	size [integer! block!] "Size or block of sizes for each dimension"
	/initial "Specify an initial value for elements"
		value "For each item: called if a func, deep copied if a series"
][
	if block? size [
		if tail? more-sizes: next size [more-sizes: none]
		size: first size
		if not integer? size [
			cause-error 'script 'expect-arg reduce ['array 'size type? get/any 'size]
		]
	]
	result: make block! size
	case [
		block? more-sizes [
			loop size [append/only result array/initial more-sizes :value]
		]
		series? :value [
			loop size [append/only result copy/deep value]
		]
		any-function? :value [
			loop size [append/only result value]
		]
		'else [
			append/dup result value size
		]
	]
	result
]

a: array/initial [10 10] does [random true]
Mufferaw
15:50@geekyi I've never used Rebol but I did find some info about collect in the Rebol R3 docs. @greggirwin Thanks. That's super useful. 10 minutes on gitter feels like more progress than a week of reading docs and tinkering on my own!
geekyi
15:52@Mufferaw Which docs, can you post me a link? I thought it was only in Red
15:53Whoa, it is in Rebol2!! (2.7.8.3.1) How did I miss that? I suppose collect is unique in Red's parse
rebolek
15:58True, it’s not in Rebol’s parse.
Mufferaw
16:04http://www.rebol.com/r3/docs/functions/collect.html
geekyi
16:26From that page:
>Can also be used with the parse function:
collect [
    parse [a b c d e] [
        any ['c | 'e | set w word! (keep w)]
    ]
]
[a b d]


I wonder what's the advantage of having a collect for parse in red? Simpler syntax? I'd thought there was a technical reason..
rebolek
16:27It’s syntax IMO. You can use both variants in Red.
geekyi
17:06:point_up: [September 23, 2016 3:56 PM](https://gitter.im/red/help?at=57e50a55a8fff5ac2d919304) so I'm trying this out
red-26sep16-5ec74dc.exe -c -t Android-x86 environment/console/console.red

got the binary into my phone.. I wonder what next..
17:11@dsgeyser had success with running on phone?
dockimbel
17:16@geekyi collect/keep in Parse is faster, more flexible (keep can be applied to matched input by rules) and it supports recursion.
geekyi
17:18@dockimbel thanks
17:19So can't run on android-x86 because Red has a dependency on libcurl
17:23
u0_a264@ASUS_T00F:/ $ ./Removable/MicroSD/console
CANNOT LINK EXECUTABLE: could not load library "libcurl.so.4" needed by "./Removable/MicroSD/console"; caused by library "libcurl.so.4" not found
1|u0_a264@ASUS_T00F:/ $

for anyone curious
17:25Info: Android: 4.4.2
Model: ASUS_T00F
Manufacturer: asus
greggirwin
18:38@Mufferaw, it can take a little while to ramp up on Red, and a little longer before things click about how different it really is, but it's worth it. As Bolek said, fell free to ask questions here.
Mufferaw
19:33@greggirwin Thanks for the encouragement, the comments here have been very helpful. I'll definitely have more questions.

dockimbel
04:56@geekyi Libcurl is not part of Android, you would need to compile it in order to use Red from command-line. Once we have full I/O, we'll drop the libcurl dependency.
TimeSeriesLord
18:36@greggirwin Hey Gregg. You are invited to read the latest revision of [The RVC, Red and REBOL](https://timeserieslord.github.io/red/). You know, awhile back, I read an article you wrote long ago for O'Reilly's Onlamp. In their bio of you, they called you "eccentric!"

Well, I much like the learning flow of The RVC, Red and REBOL. I wrote it for everyday 21st century people who need to leverage Internet computing to do stuff. It's not really meant for pedantic comp sci majors, though I bet many would be schooled on matters.

I still have a few "articles" to flesh out. Certainly, an eccentric fellow like you might have something to add to it. You seem always to bang out good quicky code examples.

The brilliant Nenad is simply too busy for us to bother him about teaching tools. We need him to keep focused to get to 1.0.
greggirwin
20:02Thanks for posting. Lots of material there. It's good to have different explanations for things, since we don't all think the same. Some terms will vary as well. For example, I have never viewed Redbol as a virtual computer, though it can be argued that any language describes a set of virtual machine instructions in some way.
I'm sure it will find an audience, and you'll refine things over time. Keep up the good work!
TimeSeriesLord
21:19True enough, everyone sees differently. That said, no interpreter ever made in the history of mankind is a language. Interpreters are compiled executables that support the interpreting of a language.

And what makes REBOL and now Nenad's Red a VC is simply that both abstracted layers of an OS — from the graphics to Internet protocols (TCP/IP stack).

It's laughable to call Red a language in the same way that is laughable for anyone to say that REBOL or Red have variables. The languages of those VMs do not variables and never have.

The underlying C code likely uses C variables to let the VCs of REBOL or Red support indirection in the langs that control those VCs, but those langs don't have variables.

I could go on and on. One of the main reasons why REBOL didn't fly in the larger world Carl's own confusion of what he had. Even he foolishly and wrongly talked about variables. Carl simply couldn't properly explain that he created a layer between data and a worker.

I intend to root out all of the stupidity I have seen over the years about REBOL and likely will see with Red. Even Nenad thinks he's writing a language. He isn't. He is writing a VM that supports a language in the same way a good Game Engine can support a scripting language.

Cheers, you eccentric nerd!

rebolek
21:22As one great mind mentioned once: "Yeah, well, that's just, like, your opinion, man."
TimeSeriesLord
21:23... as you express your mere opinion. What I've written is fact, end of story.
rebolek
21:23By your interpretation, every interpreter is VM.
TimeSeriesLord
21:24By your deficient reading comprehension, you have misled yourself. Good luck!
rebolek
21:25I am just trying to understand you. I am not native speaker, so my comprehension is of course deficient.
21:26I want to understand your concept of VM.
21:26To me, it sounds like an interpreter.
21:26But as I said, I may have understand you wrong.
TimeSeriesLord
21:26I've seen the foreigner lot of the REBOL pull the same b.s. in argument. Perhaps you should refrain from using the Internet to discuss matters until you improve your English comprehension skills.

Good luck
21:28Clearly, interpreters are not languages for someone with suitable time and effort could write an interpreter to interpret more than one language at the same time.
rebolek
21:29Ok, thanks for your wisdom, master. I will refrain me from using the web, that was invited in Switzerland, until I improve my English. That makes sense.
TimeSeriesLord
21:30The Internet was invented by Americans in the USA. The WWW is one bit of it.
rebolek
21:31I do not have time for this, Redbol was always friendly place. Hodně štěstí, lásko!
TimeSeriesLord
21:31You never see such stupidity in the Ruby or Python world. Only in the REBOL /Red world are guys a-holes. The common thread is that most of them in the REBOL/Red world are Europeans.
21:32I don't have time for it as well. The REBOL/Red Europeans always make this "place" and places like it "Rebol.org" unfriendly.
rebolek
21:33It’s possible, I don’t know. I never bothered where everyone is from.
TimeSeriesLord
21:34Reality isn't possibility.
21:34Just drop it already or do you have Asperger's or something?
21:36Oh and you were quick to play the foreigner card — "I am not native speaker".
rebolek
21:36@TimeSeriesLord This is red/help. Do you need some help with Red? For other questions, you can PM me.
TimeSeriesLord
21:40@rebolek So why don't you be quiet. You stepped into something you have not done so. You're the problem here dude. I'm not.

rebolek
21:41As you say. Please, move other discussion to private channel. Thanks.
TimeSeriesLord
21:43Let it go
greggirwin
22:12@TimeSeriesLord, please refrain from:
- Telling people to get off the internet
- Calling people stupid or a-holes
- Insulting their mental state, nationality, or foreign language skills
- Looking for loopholes in what is considered civil behavior

If you can't do that, please leave.
TimeSeriesLord
22:14Why don't you worry about yourself? Had you not piped up with your comment and then that other guy piling on, this wouldn't happen.

After the fact, you look like girls who are whining about phony injustice, which never happened.

I here to help and be helped. Stick to language talk. I have been.
22:15You REBOL cum Reddies are exactly why the REBOL never took off. If one is not part of the clique but shows up those of the clique with superior thought, the clique goes apeshit like you have and that other one.
22:16So you need to let it go now, Greggie.

I will be back, even if under yet another GMAIL. LOL.
greggirwin
22:17On a personal note, I've been part of the Redbol community for 15+ years, and it is a wonderful place, filled with generous, knowledgeable people from all over the world. I'm proud to be a part of it.
TimeSeriesLord
22:17Who cares braggart.
22:18I've been part of it too on and off since 1999 or so. REBOL dorks are such nerds. They scare people from the lang. That is likely the biggest block to adoption of it.
dahu
22:18No, @TimeSeriesLord , you haven't been "just sticking to language talk". You have been childishly attacking people and their traits. Every time you join the discussions here it quickly degenerates to name-calling and arrogant dismissals. Your behaviour and attitude ruins whatever positive contribution you seem to want to make to the Redbol language and community. Check yourself.

ifgem
03:14The best troll I've ever seen:))))
jeffmaner
03:42I, for one, value what @TimeSeriesLord has to say--some of it, anyway. S/he has valuable insight to offer to many who need it, including myself. H[is|er] delivery method wonts... Tact, perhaps? @TimeSeriesLord, I am sorry, but you're stuck with mere mortals, such as I. Please, tone down your a-hole attitude. Offer us your hard-earned wisdom and perspective, and let us mere mortals do what we will with it--for better, or for worse. And, truth be told, your posts can't boast a mastery of English language or grammar, either. Yes, most of us aren't as blessed as you with your intelligence and acumen. News flash: you're not an island. Help us who aren't as divine as thee to row this ship forward against the tide. We can do without the name-calling. We can do without the prickly provocation. What we cannot do without, however, is insight. Positive or negative, that insight counts. Your insight matters. Your arrogance, not so much. And to everyone else: stop provoking @TimeSeriesLord. S/he's obviously sensitive. Take the insight offered, and ignore the bully attitude.
DideC
11:22@TimeSeriesLord Back to the point. When you consider Red or Rebol interpreter as a VM, do you mean to compare it to the [JVM](https://en.wikipedia.org/wiki/Java_virtual_machine)? I think the misunderstanding is that nowodays, VM is used by most people in the sense of [Virtual Machine](https://en.wikipedia.org/wiki/Virtual_machine), that abstract full computer hardware. But different products tends to make the frontier not so clear between the two kinds (Interpreter and virtual machine).
Rebol2Red

Mufferaw
11:49Hi everyone, I'm trying to draw some things but I don't know how to convert a block of strings into a block.
rebolek
11:51Do you have some example of your input and expected output?
Mufferaw
11:51'''
keep rejoin['circle " " coord " " 5 " "]]]
'''
which gives me the block of strings but how can I change that so it can be used with VID

'''
view [
size 800x600
base 780x580
draw drawblock
]
'''
rebolek
11:52@Mufferaw
red>> coord: 0x0
== 0x0
red>> reduce ['circle coord 5]
== [circle 0x0 5]
11:53Or
red>> compose [circle (coord) 5]
== [circle 0x0 5]
Mufferaw
11:54Thanks, that's so simple
rebolek
11:54Yes :) You do not need to use strings at all.
11:55Remember, code is data.
geekyi
12:19@Mufferaw why not also post your question on stack overflow? So others will also learn. "how to convert a block of strings into a block" :wink:
Mufferaw
12:36@geekyi I have posted the question
http://stackoverflow.com/questions/39770518/convert-a-block-of-strings-to-a-block-in-red
geekyi
12:38@rebolek you going to answer that, or should I? :tongue:
rebolek
12:38It’s bit different question though, but yes :)
geekyi
12:40It is..
rebolek
12:41Done.
Mufferaw
12:41I will change it!
15:06Now I've got my circles drawn but I want update them, I tried
view [
        size 800x600
        canvas: base 780x580 draw drawblock rate 30 
        on-time [
           do iterate
           do refresh
           do sync-grids  
           show canvas   
        ]     
    ]

the 'do refresh' function changes the drawblock but sadly it doesn't redraw it. How can I updat the view?
geekyi
15:10Are you looking at https://github.com/red/code/blob/master/Scripts/bubbles.red ?
Mufferaw
15:11@geekyi yes
15:13should I just draw a box over everything?
geekyi
15:13@Mufferaw would be helpful if you can post all your code as a [gist](https://gist.github.c)
15:14I'm not exactly sure what you are trying out now
Mufferaw
15:15@geekyi https://gist.github.com/Mufferaw/cbb9862a8b0df3021125042e64c61678
geekyi
15:20@Mufferaw ah, game of life :smile: you can also use an image and manipulate the pixels if you want.. right now, what I'd do is put a probe to see if it updates properly
Mufferaw
15:21It seemed like a good exercise to learn about Red :smile:
15:23I put probe in the on-time block and all the circles are white
15:24all the circles in the drawblock block are white
geekyi
15:30I wonder if you are actually changing anything in the drawblock @Mufferaw
15:31The code inside drawblock gets executed alright
Mufferaw
15:32Hmm! You're right, it's not changing.
geekyi
15:40@geekyi is multitasking
Mufferaw
15:40no, it seems it is changing
geekyi
15:44@Mufferaw
scratchgrid is a block! of value: [[false .. ]]

All false there, is that's what is supposed to be?
15:46Better define scratchgrid: on the outside (oh wait, you have! hmm..)
15:47Btw, is this based on some rebol code?
Mufferaw
15:52scratchgrid is the temporary block for the updated values, after I check the neighboring cells.
This is one is not based on rebol code, I was trying to go through the documentation and get it working myself as way to learn Red.
15:53:smile: I think I got a bit too excited and didn't really dig through the VID documentation enough
geekyi
15:56@Mufferaw I don't think it's a problem with your view code, unless I'm reading it wrong
15:56Your code can be simplified tho..
Mufferaw
15:59yeah, it looks a lot like C code, I don't really understand Red yet.
dockimbel
16:00@Mufferaw It seems you are creating a new Draw block for displaying each time, but that block is not the one you passed to draw command (that one does not seem to be modified), so your display will not change. What you need to do is re-use the block of Draw commands (by clearing it, and filling it again), and not create new ones each time.
Mufferaw
16:21Thanks for the help! It's past my bedtime, I'll have to try again tomorrow.
geekyi
16:24@Mufferaw :smile: it was good.. :smile: next time use an image! ya?
dockimbel
16:32@Mufferaw [This version](https://gist.github.com/dockimbel/422ad7631661abbc1afa511b6e981761) has a working display, though, not sure why it stops after a few seconds.
geekyi
16:33@dockimbel it looks like everything "dies", doesn't seem to be designed to wrap. I think it works as intended
greggirwin
16:40It may just hit a static state. There are patterns that will never change once they exist.
geekyi
16:43@greggirwin yeah, that is what's happening
TimeSlip
16:46Can anyone tell me what the Red equivalent is to #"^a" ? I'm trying to add a keypress to a button and Red doesn't seem to like the Rebol notation. Thank you!
dockimbel
16:48@TimeSlip Use #"^A". I wonder if we should support ^ escaping with lowercase letters.
TimeSlip
16:48oh, thanks Doc.
16:49That was easy.
16:50Personally I like the choice but I'm sure there are things I am not considering.
17:23view [button #"^A" "DO" [print "hello"] ]
17:24No errors but pressing "A" does nothing.
geekyi
17:46@TimeSlip works for me. Windows, red build red-26sep16-5ec74dc
17:48[![blob](https://files.gitter.im/red/help/GvHO/thumb/blob.png)](https://files.gitter.im/red/help/GvHO/blob)
TimeSlip
18:33I'm using 28sep16 build.
18:34Windows as well.
geekyi
19:30@TimeSlip sorry, I don't know what could be the problem, both the builds seem to be based on latest git master
19:30prints "hello" for me
19:30
view [button #"^A" "DO" [print "hello"] ]
TimeSlip
19:34When you press the "A" key, it prints "hello"?
geekyi
19:35@TimeSlip Ah ok, I think I misunderstood, no it doesn't
19:36Sorry
19:36I should probably get to sleep. Goodnight
TimeSlip
19:36@geekyi Thank you. At least it doesn't produce an error. Good night.
greggirwin
20:02Red VID doesn't handle shortcut keys like REBOL VID at this time. You can add an on-key actor to do it though. e.g.
20:03
cmd-do: does [print "hello"]
handle-key: func [face event][
    if event/ctrl? [
        switch event/key [
            #"A" [cmd-do]
        ]
    ]
]
view [
    button "DO" [cmd-do] on-key [handle-key face event]
]
20:06You could also do it more inline:
cmd-do: does [print "hello"]
view [
    button "DO" [cmd-do] on-key [if all [event/ctrl? #"A" = event/key][cmd-do]]
]
20:08I don't know what the plan is for something like do-face yet, to trigger its default actor.
20:09http://doc.red-lang.org/gui/View.html contains details on face and event elements.

dockimbel
03:56@greggirwin See help do-actor.
03:56@TimeSlip Keyboard shortcuts using char! values are not yet implemented in VID.
greggirwin
04:27Thanks Doc!
Mufferaw
04:42@dockimbel I also want to thank you for taking the time to fix my 'game of life'
04:44https://gist.github.com/Mufferaw/b418dfb71c0f4c82053551e57dbdf3b5
04:44I cleaned up the window size and increased the grid size, so it is a bit more 'exciting' now
TimeSlip
05:05@dockimbel No problem! Thank you.
greggirwin
05:51@Mufferaw, nice!
Mufferaw
05:59@greggirwin It turned out ok and I learned a lot in the process, thanks to all the help I received here!
qtxie
07:42@Mufferaw There is an issue in the code.
When insert this line of code (fill-pen circle 5) into the draw block, the canvas face! will be refreshed immediately (Realtime updating mode). But the draw block is not completely constructed, it will case the following draw error:
*** Script Error: invalid Draw dialect input at: [<color> circle <coord> 5]
*** Where: ???
07:43The solution is use Deferred updating mode, I updated the here:
https://gist.github.com/qtxie/5318c5dc61f9584846d7f230fb7a07b9
Mufferaw
07:59ohhh, I was wondering about that, when the canvas would update. So if system/view/auto-sync? is 'no' then 'show canvas is needed?
DideC
08:00Exactly
08:04In my [livecode](https://gist.github.com/DideC/85d60c99f97f2e4972a6f7b09a1fe630) version with splitters, I had to disable auto-refresh when the splitter is dragged and do the show manually after all faces coords are changed. Else, refresh is done for each XX/size or XX/offset changes and its too heavy to be responsive. You can test it by changing the on-drag-start last value from no to yes.
Mufferaw
08:15@DideC I didn't notice any difference
DideC
08:24Arf, you are right. In a previous version there was a big one, but many things have changed since, and it seems to not be as relevant as before.
dockimbel
09:29@Mufferaw You're welcome. @qtxie My mistake, I forgot to turn off the auto-refreshing mode.
TimeSlip
17:39@greggirwin Thanks Gregg for the tip.

this-gavagai
02:32Hello, I'm having a lot of fun learning Red. Is there as yet a way to mark object fields as private? (Or, alternately, is there another way that I should be thinking about object interfaces more in line with Red/Rebol's design principles?)
PeterWAWood
06:44@this-gavagai There is a technique using
use
to create "private" words in a context (object). It is explained in this Rebol mailing list [thread](http://www.rebol.org/ml-display-thread.r?m=rmlRJCC).
use
is not yet implemented in the current alpha release of Red.
06:46There are other techniques that can be used and @dockimbel may have something better planned.
06:58This may be a [better thread](http://www.rebol.org/ml-display-thread.r?m=rmlRYTS) to read.
greggirwin
19:07Welcome @this-gavagai! This question comes up from time to time (in Rebol's history), and it's a good one. Technically, we can do it a number of ways (I can post a simple use mezzanine if you want to play with that). I haven't seen anyone pursue it and doc their experiences though. I did the same thing when I found Rebol. I implemented a few things, ended up using a naming convention after that, but often don't even do that. I would hazard a guess that most long time Redbol users are the same, based on code I've seen.

That said, Red goes beyond Rebol. As it adds features to aid PitL, Reducers (Red Users :^) may revisit this technique. Until we have a module system, and object design (for things like accessors or schemas) is fleshed out, we don't know what Red will provide, and where the line is that says "tooling starts here."

I'm glad you asked if there's another way you should think about it, to align with Red's principles. With that mindset, you'll make a great Reducer. And, yes, there are principles. Briefly (I know this is getting long already), Red gives you enormous freedom, and safety comes in different forms than other languages. e.g. values are strongly typed but "variables" are not. For now, think of objects more like structs or dicts. Red also has a map! type. A little doc on the structured types and their strengths/weaknesses is a great idea.

Think in terms of composition, prototype-based, rather than inheritance and classes. Though people have built entire class systems as well.

I'll stop now.

this-gavagai
03:56@PeterWAWood Thank you for finding these threads! It's very helpful to see some of the history here. I also came across the Rebol 3 function protect/hide, which seems conceptually similar in at least some respects. In any case, I'm glad to hear that wasn't just missing something obvious, and I look forward to seeing how Red moves forward with these questions.
03:56@greggirwin Thank you, this was very orienting. The problem I'm trying to solve is not so much safety as just plain old conceptual complexity. I work in the social sciences, and there's real interest right now in better approaches to modeling and simulation. I'm still new to the spirit of Red, but from what I've gathered so far it seems to be *exactly* what everyone's looking for. The problem is that a lot of these projects are maintained over long periods of time by loose networks of sloppy programmers, people like me who are able enough to slap some code together but who generally possess very little sense of best practices. For example, in a simulation of the agricultural sector, you might have one researcher modeling weather, another modeling consumer demand, and someone else doing finance markets. Each component would generally evolve independently over time, so the less we all have to know about the inner workings of each others code, the better.

I'm fully on board with a compositional approach to objects, but it would still be very useful to be able to define the public interface of objects clearly and explicitly somehow. I really like, for example, the way that function uses optional strings to self-document in a way that's accessible at runtime. Maybe something like that is the most elegant solution here? I assume I could accomplish something similar by using a mezzanine function to create my objects rather than invoking make object! directly. That wouldn't stop people from altering internal values directly from the console, of course, but it could perhaps allow a higher level interface of some sort to maintain control over access. Is this totally the wrong way to be thinking about it? I appreciate your time here. It is tremendously valuable to have so much access to people with so much experience.
greggirwin
04:26It's late here, so I'll sleep on it and write more tomorrow. A couple quick thoughts though. Red is data. Sometimes that data is evaluated as code, but think about everything being data which you can process in different ways (and where parse comes in). In that light, don't think about sharing code and making the code last. Think about structuring and sharing data so *it* can last and is amenable to processing and understanding.

Thought #2, it has been said that reuse in the small is a solved problem, but reuse in the large is still an unsolved problem.
dockimbel
09:35@greggirwin "Reducers " :+1: We strive to be *complexity reducers*! ;-)
09:38@this-gavagai You should consider creating dialects (DSL) as the high-level interface for each of your domains, instead of using classic OOP approach, which is not the best use of Red/Rebol features. They will provide much better domain-oriented abstractions, while hiding away the implementation details.
geekyi
11:43@this-gavagai what is your goal? Is to design andwrite simple interfaces? Or write modules? If so writing functions and using spec-of have been helpful for me.
11:46>function uses optional strings to self-document in a way that's accessible at runtime. Maybe something like that is the most elegant solution here?

I believe so. Advantage of self documenting :smile:
If you want even simpler api/interface you can go with dialecting as Doc says. (then you don't have the self documenting advantage tho) In all these cases, parse is useful
11:58Does anyone have an implementation of the github or gitter apis?
12:00I need to learn more about the redbol network stack and how to design http apis in red
12:01New goal: post a stackoverflow question daily
this-gavagai
15:20@greggirwin I think I follow where you're going, but I'm not really looking to share or reuse code, I don't think. The question I'm trying to ask is how to best conceptualize the structure of data (some of which is evaluated as code) in order to make it clear which parts are "outward facing" and which parts aren't.
15:20@dockimbel Very interesting. So the idea here would be to make objects, variables, and functions as usual and then define a grammar to poll and prod those things in a specifically constrained way?

For example, rather than access weather_module/temperature directly, I might define a function called request that (in tandem with parse, presumably) can return the appropriate value to request temperature from weather_component but also reject request private_variable from weather_component?

I've read about dialecting a bit, but I've always felt like I was missing something fundamental. Now that you've explained it as a way of abstracting away from an underlying implementation, the power of it all seems so obvious. I can't believe I didn't think of it in those terms before. I'm a linguist by training, and this is actually far more intuitive to me than all those headers and modifiers used in OOP. Very cool :)
15:20@geekyi Most immediately, my goal is to allow those I work with to rewrite their components without having to worry about whether doing so will break other people's code. More abstractly, I'm trying to think about how components in a simulation might communicate and interact with each other in an elegant, semantically-oriented way. This is what I find so intriguing about the work you guys are doing. Red's highly reflective nature has certainly been handy to me as I try to learn it, but it's also potentially very interesting to the extent that it allows objects in a context to ask questions about each other.
15:21Also, thanks everyone. This has been a very warm welcome to a new community.
greggirwin
17:23@this-gavagai my comment about reuse was based on
> The problem is that a lot of these projects are maintained over long periods of time by loose networks of sloppy programmers

I think Doc, and your further posts, have cleared up my confusion.
17:29As to your parse example, yes, that's exactly the idea. It puts a new onus and emphasis on the designer, because now you're a language designer. That doesn't necessarily mean more work, but different work. What it does, very clearly, is force you to explicitly design and declare the public interface to your data. And if your data is all Red as well, it's easy to parse at the block level, which means you can write different dialects for different purposes (e.g. data gathering and admin, reporting, statistics).

dockimbel
07:18@this-gavagai That's one way to approach it, yes. Think about the usage patterns of the public API(s) you want to expose and capture them into an appropriate grammar. The larger the API and the usage patterns, the more gains you'll get from a wrapping DSL.
wolframkriesing_twitter
15:33a rather simple question, playing with the date type, I was wondering, why a subtraction always returns days, how can I make it return minutes, which could be possible in the second example
>> 24-dec-2016 - now
== 82
>> 24-dec-2016/0:00 - now
== 82

is that just arbitrary or can I influence it? I tried around a bit with refinements, but would appreciate a push in a direction, the rebol/red way. thx
geekyi
15:52@wolframkriesing_twitter why not ask on stackoverflow.com?
wolframkriesing_twitter
15:52good point, will do
15:52so its re-readable for others, thx
15:53now I have to find my credentials again :) I knew the day would come
geekyi
15:54@wolframkriesing_twitter difference seems to get you half-way there:
difference 24-dec-2016 now
== 1952:06:01
wolframkriesing_twitter
15:56i see, the other meaning of difference, hadn't even thought it would do that
DideC
16:07Hour result is bound to the internal representation. So with two spaced dates, result will be truncated, ence false.
geekyi
16:08@wolframkriesing_twitter I just realized something else (about how that will literally look like) let me know when you have posted the question :wink:
wolframkriesing_twitter
16:09@geekyi done
DideC
16:09link ?
wolframkriesing_twitter
16:09@geekyi http://stackoverflow.com/questions/39835881/red-rebol-subtracting-dates-returns-days-how-can-i-change-that
geekyi
16:10The thing is, how do you expect your result to be?
16:10The literal representation
wolframkriesing_twitter
16:10@geekyi i had no expectation, was just playing around and then I had the idea to get minutes, instead of days ... without doing the ugly math :)
geekyi
16:11Or maybe you don't want that.. that is enough :point_up: [October 3, 2016 8:54 PM](https://gitter.im/red/help?at=57f27f4e3c59573f6f05355f)
DideC
16:11The uggly math :
in-minutes: func [d1 [date!] d2 [date!] /local d t] [d: d2 - d1 d1/date: d2/date t: difference d2 d1 d * 1440 + t/hour * 60 + t/minute]
wolframkriesing_twitter
16:12yep :)
16:13I actually thought there was something like (not-working syntax ahead): (24-dec-2016 - now)/minutes ... but since the subtraction returns an integer the refinement I tried can not even work (besides being invalid syntax, right?)
geekyi
16:16@wolframkriesing_twitter yeah,
>> time-diff: difference 24-dec-2016 now
== 1951:42:11
>> time-diff/2
== 42
greggirwin
16:18You can certainly make a wish request, but it needs to be well thought out. Red doesn't have date! yet, so we have a better chance of changing it now. It will break rebol compatibility though.
wolframkriesing_twitter
16:19tbh I didn't think that far either, I just thought: the people behind red/rebol are smarter than me, so let's see what they did to date-math :)
greggirwin
16:21If we had a relative-date! type, it could return full info. A date-diff would be easy to write, and let you control your result. The rebol behavior makes some things easy, and others a bit more work. Another one of those darn subjective design decisions. :^)
geekyi
16:24@greggirwin :+1: or something in general in the language that dealt with relative vs absoulte values
wolframkriesing_twitter
16:25definitely interesting
greggirwin
16:25I have a lot of date! mezzanines, but no date-diff. I suppose rel-date! would be like timespan in some other langs.
wolframkriesing_twitter
16:26would be heck awesome if something like that comes out of the box, now the question might be where would the line to be drawn then. because there are lots of things that would be awesome ... that's something I guess you, core guys, have already made up your mind about
greggirwin
16:27Just had a quick look, and the date! subtraction behavior may have been aligned with DATEDIFF in SQL.
geekyi
16:28@DideC why not add that to the answer :point_up: [October 3, 2016 9:11 PM](https://gitter.im/red/help?at=57f2834a29403a416fc1c77d) (If you think it is a good idea)
16:28@geekyi hadn't realized before that you could look at the rebol source! :O
wolframkriesing_twitter
16:29@greggirwin in sql you also have select timediff("2016-12-24 10:00", Now())
16:29which is the result of difference, it seems
greggirwin
16:32Right. Date-diff will take some thought, as would a supporting relative date data model. I've seen it as [months days time] and [days time].
16:33Need to explore how you get useful results which allow you to go from abs to rel and back to a correct abs.
geekyi
16:33@greggirwin I particularly like the way it is dealt with in [Frink](https://frinklang.org/#DateTimeHandling)
16:36The representation is not that nice, but the actual handling is pretty awesome
16:36In general, the way quantities are handled is awesome
greggirwin
16:39I'll check out Frink again. I do recall that I liked it being like Wolfram, with unit support.
wolframkriesing_twitter
16:40nice, https://frinklang.org/#DateTimeArithmetic easy solution would be to return correct amount of days, including fractions
>> 2016-12-24/10:00 - 2016-10-01/11:00  
== 84.976

(the .976 is random)
instead of just 84 as rebol does
geekyi
16:45@wolframkriesing_twitter Maybe that is the right way :smile:
16:46Note tho, Frink may have different design goals: https://frinklang.org/LL4.html#slide7
>When in doubt, be pedantic
wolframkriesing_twitter
16:47applying occam's razor that would be the thing to do :)
16:48@geekyi how does the pedantic part collide with red goals?
geekyi
16:48It works really well for Frink IMHO, but I don't know if .. maybe it would be the best thing for Red
greggirwin
16:49@wolframkriesing_twitter, sounds easy, but is it a good long term choice. Using a decimal to represent days+time in whole/frac part seems very un-Red. Now it's just a number with no type information.
wolframkriesing_twitter
16:49@greggirwin +1, absolutely true. if the red-way is to do it right, which is more complex, I think it makes sense. I am just the messenger, watching where this is heading :)
geekyi
16:51@wolframkriesing_twitter It may or may not.. Red strives to be simple at everything, so you have to balance convenience, performance, etc..
16:51The "right" way is not always obvious
16:52> "Simple Made Easy"

-Rich Hickey
16:55wrong quote :p
16:56Definition of Simple by carl http://www.rebol.com/article/0509.html

Rebol2Red
11:44Will someone test this? (Will not work while copying and pasting in the console)
Red []
;-----------------------------------------------------------------------
; Fetch date and time from internet 
; (hack until date functions are implemented)
;-----------------------------------------------------------------------
datetime: context [
	mid:   		func [s start len][copy/part at s start len] ; as in Basic
	format2:	func[num[integer!]]
	[
		num: form num
		if tail? next num [insert num "0"]
		return num	
	]
	page: read http://time.is/

	; maybe this have to be adjusted for other countries!
	; investigate the source of the page in a browser
	parse page [
					thru {<div id="twd">} copy time to {</div>}
					thru {title="Click for calendar">} copy date to { (}
	]
	
	hour: mid time 1 2 	minute: mid time 4 2 	second: mid time 7 2

	months: [
		"january" "february" "march" "april" "may" "june" 
		"july" "august" "september" "october" "november" "december"
	]

	date: 			split date " "
	dayname: 		date/1
	day: 			date/2 2
	;day:			format2 to integer! date/2 2 ; 2 digits
	month:      	date/3
	year:			date/4
	month:			index? find months date/3
	;month:         format2 to integer! index? find months date/3 2 ; 2 digits
]

; usage:
print [datetime/hour datetime/minute datetime/second]
print [datetime/dayname datetime/day datetime/month datetime/year]
dockimbel
11:52@Rebol2Red Please do not put line breaks between function spec and body blocks, it makes your code not paste-able in console.
Rebol2Red
11:56Thanks i will pay attention to that, but the program will not run over here.
I have a working version of it, but this is in dutch. I get the page loaded in dutch.
Now i ca'nt edit the posted code?!
Because i can't run this code it has no point of posting again with possible other errors.
Wright/Wrong?
12:13Maybe someone can paste the right code so i can delete mine (the only thing i can do)?
rebolek
12:46@Rebol2Red Hm, doesn’t work here, because I get the result page in Czech.
12:50@Rebol2Red you should use this: page: read http://time.is/?lang=en
Rebol2Red
12:58@rebolek Thanks, so nothing wrong with the code?
rebolek
12:58@Rebol2Red here’s working version:
Red []
;-----------------------------------------------------------------------
; Fetch date and time from internet 
; (hack until date functions are implemented)
;-----------------------------------------------------------------------
datetime: context [
	mid: func [s start len][copy/part at s start len] ; as in Basic
	format2: func [
		num[integer!]
		] [
		num: form num
		if tail? next num [insert num "0"]
		return num    
	]
	page: read http://time.is/?lang=en

	; maybe this have to be adjusted for other countries!
	; investigate the source of the page in a browser
	parse page [
		thru <div id="twd"> copy time to </div>
		thru {title="Click for calendar">} copy date to </div>
	]

	hour: mid time 1 2     
	minute: mid time 4 2     
	second: mid time 7 2

	months: [
	    "january" "february" "march" "april" "may" "june" 
	    "july" "august" "september" "october" "november" "december"
	]

	date: split date " "
	dayname: head remove back tail date/1
	day: head remove back tail date/3

	month: date/2
	year: head remove back tail date/4
	month: index? find months date/2
]

; usage:
print [datetime/hour datetime/minute datetime/second]
print [datetime/dayname datetime/day datetime/month datetime/year]
12:59Actually, let me improve it a bit...
Rebol2Red
12:59Thanks
rebolek
13:05So, it’s not ideal:
datetime: context [
	page: read http://time.is/?lang=en

	months: [
		"january" "february" "march" "april" "may" "june" 
		"july" "august" "september" "october" "november" "december"
	]

	hour: minute: second:
	dayname: day: month: year: none

	parse page [
		thru <div id="twd"> 
		copy time 
		to </div>
		thru {title="Click for calendar">} 
		copy dayname 
		to #","
		2 skip
		copy month
		to #" "
		skip
		copy day
		to #","
		2 skip
		copy year
		to #","
	]

	set [hour minute second] split time #":"

	month: index? find months month
]

; usage:
print [datetime/hour datetime/minute datetime/second]
print [datetime/dayname datetime/day datetime/month datetime/year]
13:05The thing is that you are defining an object.
13:05So page is read once.
13:06Try datetime/second, it does not change.
13:06It should be rewritten as function where /hour etc. are refinements.
13:12Something like this:
datetime: function [
	/hour
	/minute
	/second
	/dayname
	/month
	/day
	/year
] [
	export: none
	foreach word [hour minute second dayname month day year] [
		if get word [export: word break]
	]

	page: read http://time.is/?lang=en

	months: [
		"january" "february" "march" "april" "may" "june" 
		"july" "august" "september" "october" "november" "december"
	]

	hour: minute: second:
	dayname: day: month: year: none

	parse page [
		thru <div id="twd"> 
		copy time 
		to </div>
		thru {title="Click for calendar">} 
		copy dayname 
		to #","
		2 skip
		copy month
		to #" "
		skip
		copy day
		to #","
		2 skip
		copy year
		to #","
	]

	set [hour minute second] split time #":"
	month: index? find months month

	get word
]

; usage:
print [datetime/hour datetime/minute datetime/second]
print [datetime/dayname datetime/day datetime/month datetime/year]
13:16Of course, it can be improved further :)
Rebol2Red
13:19I get the most of it, but export???
rebolek
13:21export checks which refinement you want, otherwise the code would be more complicated
13:22When you specify refinement, it’s value is true. So export stores name of first refinement that is true.
13:22All refinements are then rewritten with values parsed from the page.
13:23And at the end, it gets value of word stored in export and returns it.
13:23So you can reuse refinements (which are normal values inside function) to store parsed values.
13:32Of course, it can be called something else, export was just first word that came to my mind :)
Rebol2Red
13:47@rebolek I get it. Learned a lot, Thanks.
The purpose of my program was to 'think out of the box' and hoping to get a reaction from which i could learn.
rebolek
13:48@Rebol2Red You’re welcome. I’m glad I helped you a bit.
DideC
13:52@rebolek last line of your func is get word, I would expect get export as you explain ?!
rebolek
13:54@DideC You're right :) It’s a bug.
13:54But because in Red, word in foreach is not local to foreach, it works.
13:55So theoretically, the loop could be just if get word [break]
DideC
13:57I will not rely on this trick for futureproof code :smirk:
rebolek
13:58That makes sense ;) I'll fix the code.
13:58Hm, I won’t. Too late :/
DideC
14:08Next time: use a Gist !
14:09Anyway: nice clean code.
rebolek
14:11Nice clean and buggy ;) But yes, I should used Gist.
this-gavagai
15:47I appreciate all the insights to my last question. This one should be much simpler: is it possible to use one object as a prototype for another while ensuring that map! or object! type fields get cloned (rather than just passed as reference)? I've tried using copy/deep, but the prototype and subsequent objects still both end up referencing the same thing.
rebolek
15:53Not directly, AFAIK.
15:59IMO copy/deep should do exactly this.
meijeru
15:59Anyway, if you look up the docstring for copy, there is a refinement called typeswhich ensures only certain types of (non-scalar) fields are copied but the argument to that is [datatype!] whereas I would have thought it should be [typeset!] given the plural *types*. I will make that a wish.
16:03This is of course additional to the issue @this-gavagai signalled.
greggirwin
17:17@this-gavagai, @SteeveGit and I have slightly different versions of a clone func, and others may as well.
clone: function [
	"Deep make an object"
	object [object!]
	/with
		spec [block!] "Extra spec to apply"
][
	cloners!: union series! make typeset! [object! map! bitset!]
	new: make object any [spec clear []]
	foreach word words-of new [
		val: get in new word
		if find cloners! type? :val [
			new/:word: either object? val [ clone val ][ copy/deep val ]
		]
	]
	new
]

this-gavagai
04:53Thanks everyone. Out of curiosity, is this the intended behavior or just something that hasn't been fully clarified yet in the current alpha? Is it only object!, map!, and bitset!datatypes that pass through prototyping as references in this way?
wolframkriesing_twitter
07:28seeing the clone function (triggered by the earlier datetime example) I am curious what is the opinion/state in regards to immutability in Red-world? Or is that just not a low-level concern?
dockimbel
08:50@wolframkriesing_twitter Red, like Rebol allows side-effects on purpose, in order to keep both implementation and usage simple. copy function is there to allow you to avoid mutation when you need it. See a longer explanation here: http://www.rebol.com/article/0206.html
wolframkriesing_twitter
08:50thanks for helping me to get into the Red/rebol mindset of things
dockimbel
08:51@wolframkriesing_twitter My pleasure. ;-)
greggirwin
15:12@this-gavagai, Rebol didn't document detailed datatype behavior, but because we have access to the source, we can do that for Red. How each type behaves, and whether that changes over time, is up to the design team.
this-gavagai
16:12@greggirwin Indeed. I don't have the knowledge to understand the big-picture implications behind these kinds of choices (especially wrt practical considerations like performance). My question was motivated purely by a desire to understand the design principles at play.
wolframkriesing_twitter
16:25@greggirwin speaking of design decision for types, what intrigued me first about rebol was types like time, tuple or pair ... those are amazing. Now that I am using it a bit more I could come up with many more types, where does Red draw the line here? Is there an active discussion about types, which to add and if to add any at all? or is this described somewhere what the process/thoughts behind it are?
greggirwin
16:32The link Doc posted above says things well. Red doesn't copy by default. The only thing we need to know is what types *can* be copied, or need to be constructed (e.g. object).
16:38@wolframkriesing_twitter, the main thing to consider is what we can represent lexically, without creating ambiguities (or ugliness :^). Then look at what is useful. Reduce the lexicon to the base elements that we use to construct bigger pieces. Ren (see ren-data.org) is intended to be the JSON equivalent for Redbol languages. There aren't too many extensions in there, and even those that are there, or TBD, generated a lot of discussion.
wolframkriesing_twitter
16:40i see
greggirwin
16:40One new type that has come up is ref! which would be an @name value.
dockimbel
16:42@wolframkriesing_twitter More types are welcome, but finding new good (and possibly natural) syntaxes is hard, as the available symbols on common keyboards are limited, and most of them already used. Though, if you have ideas for new datatypes, please propose them by all means in red/red channel. We have already a few more in mind, like ipv6!, matrix! or unit! (quantities with units).
greggirwin
16:42When we can create user defined types more easily, I imagine we'll see an explosion of non-lexed types. That is, types that require make to construct them. That may or may not be a good thing.
wolframkriesing_twitter
16:43i was asking, because issue! seems quite exotic too, doesnt it?
16:43i like unit!
dockimbel
16:44@wolframkriesing_twitter What if we renamed issue! to hashtag!? ;-)
wolframkriesing_twitter
16:44@dockimbel +1 i was confused and thought exactly that
greggirwin
16:45Not at all. Phone numbers, serial numbers, record IDs, even before hashtags became a thing.
dockimbel
16:45@greggirwin I think it's a US-centric syntax, I was confused by it too at the beginning. "Hashtag" might be more meaningful world-wide.
wolframkriesing_twitter
16:46creating types is of course the way to go, so any topic-specific type can be created ... what is the state of that, you @greggirwin are saying "When we can create user defined types more easily" what is missing?
greggirwin
16:46Could be. # denoting a numeric string is common here (order #, confirmation #, etc.).
wolframkriesing_twitter
16:47re issue! I first thought for a second "how cool, i can directly create github-issues in the language"
dockimbel
16:47@greggirwin Remember we still have the issue-as-string vs issue-as-word duality to solve, so we'll need to reconsider how we define issue! type.
greggirwin
16:47Right. :^\
dockimbel
16:48@greggirwin Never seen that syntax used in France (we use for that, as abbreviation for numero (== number), don't know for other EU countries.
greggirwin
16:48@wolframkriesing_twitter , you can create objects today, but defining a new type has to be done in Red/System, and datatypes are not like complex UDT/ADT/struct types.
16:49No. can be used here, but the octothorp is the most common symbol.
16:52Should change rooms to continue this chat.
dockimbel
16:52Let's move this discussion to red/red.
this-gavagai
17:32> The link Doc posted above says things well. Red doesn't copy by default.

Unless I'm completely misunderstanding, in the case of make, Red does copy string! and other series!by default, though, doesn't it? (Not to mention integer! and float!, but perhaps that's a different question)
dockimbel
17:34@this-gavagai The purpose of make is precisely to create a new instance of a given datatype. ;-)
this-gavagai
17:50@dockimbel Indeed. That's why I was surprised that make doesn't clone object! or map! fields, as well. I'm sure there's a good reason for treating block! and map! differently in this regard; my reason for asking is just to try to understand Red's design.
greggirwin
18:12Look at copy. It has a /deep refinement, so you can control whether you want it to copy nested non-scalars. Make with objects works similarly, except there's no /deep option and we just have to write a clone func to do it.
dockimbel
18:32@this-gavagai make does clone referenced series (block! is a series) in an object, because this behavior covers the best the common use-cases. Objects or maps are heavy datatypes, in the common cases, you want to keep a reference to the same ones, not clone them (though, you can clone them manually using copy when you really need it). Trees of objects or maps that you need to clone deeply is not a case I remember seeing often in Rebol (except in code from OOP guys, trying to bend the language to work in a purely OOP way), usually you would rather model such tree using blocks.
wolframkriesing_twitter
22:18I am trying to figure out how to get the cookies out of an HTTP response, which means reading the headers, all I found (e.g. http://rebol.net/cookbook/recipes/0059.html) doesn't look straight-forward, is it like that in Red too?
geekyi
22:40@wolframkriesing_twitter cookies actually are simple http headers afterall😛 you can write an abstraction, or maybe there is something already
22:41@wolframkriesing_twitter I think there was a stackoverflow question on that, can you check? I'm on mobile, so a bit hard right now..
greggirwin
23:24Red, even with only simple-IO in place, makes it easy to get at the headers:
red>> res: read/info http://red-lang.org
== [200 #(
    Cache-Control: "private, max-age=0"
    Date: "Wed, 05 Oct 2016 23:20:41 GMT"
    Transfer-Encoding: "chunked"
    Content-Type: "text/html; char...

/info isn't documented yet, so may change in the future, but it very nicely returns you 3 values: [result-code [integer!] headers [map!] content [string! binary!]]

TimeSlip
00:10Where are the various colors stored at?
qtxie
00:14This one? https://github.com/red/red/blob/master/environment/colors.red
TimeSlip
00:16Thank you.
this-gavagai
03:22@dockimbel Great, so I think that's the answer to my original question: "Red chooses to pass object! and map! by reference but copy series! because, most of the time, nested objects and instance-specific maps are out of step with Red's approach to prototyping. Deep structure is usually better accomplished through blocks." If that's accurate, it makes sense, and it helps me see the differences from mainstream OOP a bit more clearly. Thanks!
dockimbel
05:21@this-gavagai *nested objects and instance-specific maps are out of step with Red's approach to prototyping* They are fine. What I meant is the need to clone them when you clone the outer object or map referencing them, is a rare need. Sharing them is most of the time, the best option. BTW, "nesting" is a relative concept in Red/Rebol, you only have a "reference" to other series/objects/maps, they are not really "nested" (there is no scoping in Red/Rebol, only an apparence of scoping, called [definitional scoping](http://stackoverflow.com/questions/21964110/is-there-a-overall-explanation-about-definitional-scoping-in-rebol-and-red#)).
wolframkriesing_twitter
05:33@greggirwin thx a lot for answering so quickly, actually I was looking into https://github.com/red/red/blob/3058bfe311e0dbdfd102509119388d06a86946af/runtime/simple-io.reds#L1844 but couldn't find /info, did I look in the wrong place?
DideC
09:00This is the Red/System low level func. As you see, there is an info? parameter that must be map to the /info refinment of the read handler.
Port! are not implemented, so the maping between read and HTTP might be elsewhere.
dockimbel
09:35That mapping is done in the url! [datatype](https://github.com/red/red/blob/master/runtime/datatypes/url.reds#L168).
dahu
10:49Brodie's "Thinking Forth" was recommended on a Rebol forum somewhere so I decided to read it; very enjoyable.
One of the examples in the book was about Roman numerals. Out of curiosity, I decided to emulate the Forth approach in Rebol. It isn't as "clean" as the original Forth due to the need to explicitly pass function parameters. Still... it's pretty ugly, imho. I am sure the idiomatic Rebol (Red) version would be much better. As a comparison, I also converted the version from one of my old Vim plugins (Nexus); I can't remember from where I stole that version of the solution. The two solutions are here:
https://gist.github.com/dahu/e69aa11ee46c24e140ca201ac8669b7e
dockimbel
11:00@dahu Any link to the original Forth version?
dahu
11:12The original forth version:
\ Roman numerals

Create romans      ( ones) char I c, char V c,
                   ( tens) char X c, char L c,
               ( hundreds) char C c, char D c,
              ( thousands) char M c,
Variable column# ( current_offset)
: ones      0 column# ! ;
: tens      2 column# ! ;
: hundreds  4 column# ! ;
: thousands 6 column# ! ;

: column ( -- address-of-column ) romans column# @ + ;

: .symbol ( offset -- ) column + c@ emit ;
: oner  0 .symbol ;
: fiver 1 .symbol ;
: tener 2 .symbol ;

: oners ( #-of-oners -- )
   ?dup IF 0 DO oner LOOP THEN ;
: almost ( quotient-of-5/ -- )
   oner IF tener ELSE fiver THEN ;
: digit ( digit -- )
   5 /mod over 4 = IF almost drop ELSE IF fiver THEN
   oners THEN ;

: roman ( number -- ) 1000 /mod thousands digit
                       100 /mod  hundreds digit
                        10 /mod      tens digit
                                     ones digit ;
DideC
12:00VIM solution is simpler and shorter !
dahu
12:08I guess Brodie's point is that the Forth way is to build a "lexicon" of commands, each doing one thing and intuitively (or deducibly) so from its name. He stresses that approach to better handle spec changes. The Vim solution is all balled up in one function, which _might_ be harder to modify for certain types of spec changes. This design concern is pretty much lost in this example, given how small the Vim solution is though.
dockimbel
12:25@dahu Forth is best written in Forth. I have in my plans to add a stack-oriented small dialect in Red at some point in time, some algorithms can be implemented more easily and efficiently using such language (I have extensive experience in [RPL](https://en.wikipedia.org/wiki/RPL_(programming_language) and some with PostScript). For the converter itself, here is my take to implement it in Red, using what Red is best at (metaprogramming). ;-)
https://gist.github.com/dockimbel/1abde8f2dfaf75816384609edf59098f
dahu
12:33mind hurting...
programatically generated table with recursive calls back into a2r, starting from the first match in case...
dockimbel
12:42Also I think it should be possible to come up with an elegant Parse-based solution (see the ANTLR entry [here](https://www.rosettacode.org/wiki/Roman_numerals/Decode#ANTLR)).
meijeru
13:47The above solution breaks down for 9 => VIV instead of IX owing to the missing case. But that is easily repaired.
dockimbel
15:14@meijeru Indeed, let me fix it. Done.
15:33I updated the code for a more "integrated", and maybe more readable approach.
DideC
16:56@dockimbel I pick yous last solution and add [Roman-to-arabic with parse](https://gist.github.com/DideC/0ca3da92927c42b069454dc2994873b2#file-roman-to-from-arabic-red). For fun.
greggirwin
18:29:point_up: [October 5, 2016 11:33 PM](https://gitter.im/red/help?at=57f5e21b0ec6f9457da6a88e) @wolframkriesing_twitter, I just did help read in the console.

7hi4g0
02:03What is the best way to format strings? form?
I noticed that form doesn't allow me to strip the spaces between different values nor does it allow me to prepend zeros.
dahu
03:24@dockimbel ANTLR version in Rebol (my Red-fu sucks too much to do a Red version :-( )
https://gist.github.com/dahu/8a49ccde20acd53ff4a0631f66a7baf1
03:26I'm sure the idiomatic Redbol way to do this would be cleaner -- I was aiming to stay as close to the ANTLR version as possible, both for comparison and more importantly because I don't know the Redbolly better way to express this yet.
this-gavagai
04:56>> most of the time, nested objects and instance-specific maps are out of step with Red's approach to prototyping

>They are fine. What I meant is the need to clone them when you clone the outer object or map referencing them, is a rare need.

It's exactly that rareness that I'm trying to understand.

Coming from OOP, my first instinct with complex modeling is to define a hierarchical pile of objects, all of which get instantiated anew when a root object gets instantiated. The very fact that this is a rare use case in Rebol/Red makes me think that that whole approach must be bending the language in an unnatural way. What first caught my attention about Red is the fact that it doesn't make a hard distinction between data and code, but to exactly that end I'm still struggling to wrap my head around a more native design pattern for describing the state and behaviors of relatively complex and heavily instanced "things". I'm wondering if there's a more Red-like way of achieving these ends (parallel perhaps to the previous discussion about dialecting as a better alternative to public/private fields). But, maybe there's not a simple answer here.

Thanks for link on how scope works. It's very orienting of some of the underlying mechanics at play.
greggirwin
06:11@7hi4g0, we'll have a full-blown format function in the future (lots of design ideas in the works). For now, if you specific needs, we can provide examples of little helpers that give you more control than form.
06:45@this-gavagai, I don't know that there's a universal "Red way", and my common cases won't be yours, but if you have concrete examples some folks here might offer ideas of how they would model them in Red.
DideC
09:04@dahu Interesting solution... but a verbose one. Nice exercise anyway.
I updated my gist with the more optimized an shorter one I can make.
https://gist.github.com/DideC/0ca3da92927c42b069454dc2994873b2#file-roman-to-from-arabic-red
this-gavagai
09:17




Thanks, @greggirwin. I appreciate the suggestion. Here's an example:

Imagine you wanted to simulate economic dynamics in a third world village. You might begin with 30-50 households, each with 2-12 people. Most of these people would own a couple of different kinds of fields, and some of them might also own cows. Cows produce milk, which is a good source of cash, but this production is dependent on a number of factors including an animal's general health and well being. Any model of animal health would almost certainly be influenced by (among other things) what its owners choose to feed it, which in turn is going to be influenced by both the costs of fodder in the village generally and specific agricultural outputs of the household that owns it.

In other words, what I need to describe are templates for entities that can be instantiated in relatively large numbers to behave quasi-autonomously in a time-series simulation. The goal would be able to "experiment", testing for example how the arrival of a veterinary clinic in town (or a new breed of cow with different health functions, or a drop in fertilizer prices, or a sudden decrease in rain) would influence the system's overall dynamics.

In an OOP paradigm, I would start by defining classes and their public interfaces, and then I would arrange them into hierarchical graphs. Some of these classes would be relatively self-contained (i.e., weather), some would depend on a parent many-to-one (i.e., people in a household), and still others would exist one-to-one as an extension of a parent (i.e., a particular cow's health, which might be complex enough to benefit from encapsulation as an object in its own right). That all works fine enough, but I'm not sure classic OOP is actually the right model for any of it. The hard distinction most languages expect between code and data, for example, is very limiting, and Rebol/Red's approach seems to promise a much more elegant way of thinking about entities in a simulation. The possibility that a vet might show up and re-write a particular cow's food consumption behaviors at runtime, for example, is just way too cool to ignore. It opens the door for unprecedented new kinds of elegance and expressiveness in this kind of scientific modeling.

Right now, what I'm trying to figure out as I get more familiar with Red is just general principles. For example, as in my past few posts, how should I think about the choice between hierarchies of objects and complex blocks? I get how both syntaxes work, but without a deeper intuition of why red programmers do things the way they do I know I'm just going to fall back on whatever I do in python.>
09:17(And apologies for the length!)
dahu
09:32Cool, @DideC . I'll have to have a look at that tomorrow.
DideC
09:54@this-gavagai Hard to tell. It will completely depends of how you code it. One way to do will have pros and cons, and another solution will have different ones.
View is an example of complex object! hierarchy conception and behaviour in Red (screen is your village, windows are houses, faces are people ;-) ). + VID is a dialect to define the initial state.
I see no better and functionnal example to give at this time !
dockimbel
10:09@DideC @dahu I've added a Red entry for the Roman encoding task on Rosettacode.org: https://www.rosettacode.org/wiki/Roman_numerals/Encode#Red
dahu
10:14Cool. Should probably add Decode solutions too if they don't already exist on Rosetta.
rebolek
10:15@dockimbel @qtxie Should I expect that Red would be able to load ~22MB file without Memory allocation error, or is it something that must wait for GC?
dockimbel
10:17@dahu I have a few candidates for the Decoding too, but no more time to play with it, so be my guest. Also, they are tons of other tasks on RosettaCode to fulfill, so feel free to contribute (you can use the community wisdom here to improve some code submissions if required).
dahu
10:20@dockimbel That sounds like a good plan because I definitely need to sharpen my Redbol skills. @all Expect harassment :-D
dockimbel
10:21@dahu Puzzle solving and code optimization is the favorite hobby of Rebolers (and now Reducers) for years. ;-)
dahu
10:23For too long I used Vim and Tcl for my puzzle playground... It's good to have a hobby. :-p
qtxie
10:39@rebolek Cannot load 22MB file? Sounds like a bug...
rebolek
10:39@qtxie I just checked it again and it happens only under OSX, under W7 it works.
10:40I put the file somewhere and make an issue.
dockimbel
10:41@rebolek "Out of memory" error? It shouldn't happen, unless you have a huge number of small series and not much GB of RAM? If it's only on one platform, then it is worth adding to the bugtracker.
rebolek
10:4116GB should be enough for everyone I guess ;)
10:41Actually it’s Runtime error: Access violation.
10:42Thanks guys, I am going to open an issue.
10:50https://github.com/red/red/issues/2260
dahu
12:45https://rosettacode.org/wiki/100_doors#Red
12:46And I pushed @DideC 's https://rosettacode.org/wiki/Roman_numerals/Decode#Red
13:06I had two off-by-one mistakes in the 100 doors code; fixed. And it's pretty ugly, certainly compared to the Rebol version.
7hi4g0
13:12@greggirwin I would like see to some examples of how I can format strings :+1:
13:13I'll also need to format strings in Red/System, but I don't think there's an easy way to do that, or is there?
qtxie
14:33@7hi4g0 You can use sprintf to format strings in Red/System if it's a c-string!.
7hi4g0
14:39I didn't know Red/System had sprintf. Thanks @qtxie
I will need to allocate the space for the c-string!, won't I? How should I do this?
14:41I saw allocation in some file on the sources, but can't remember where.
qtxie
14:45Yes. Something like this:
#define BUF_SIZE 1024
buf: allocate BUF_SIZE
sprintf [buf "number %d" 123]
7hi4g0
14:47@qtxie Great. Thanks again.
I had just found the allocate function :smile:
greggirwin
17:40@this-gavagai, *FANtastic* example! Thanks for taking the time to do that. As Nenad said, puzzles are beloved by Reducers. For me, they're more of a curse. How am I supposed to get any real work done when there are puzzles to be solved! ;^) Let me think on your example a bit, while I try to get some real work done.
18:00An initial thought, which ties to Red's approach of using references, relates to hierarchies and "free agency". In your example, you say people own fields, but the field is a separate entity. If you have a person object, should it *contain* field? If so, is there also a global list of fields that has a separate copy of that field's data? Or is it better to think in terms of relationships between objects? Not the is-a/has-a inheritance/composition choice but as data relations. Object containership defines implicit, fixed relationships. But cows are not a property (in OO terms) of a person object. Except in this case: http://i.ebayimg.com/images/i/401128929397-0-1/s-l1000.jpg

When I think of simulations, I often come back to NetLogo as a model. There is a "world" that has patches and turtles, each with localized behaviors and knowledge. The observer is the all-seeing eye.
18:04In your simulation, how does the observer see all the cows if they're inside people? And if you want to have groups of cows, with different health, feed, etc. grouped differently, how do you do that? e.g., can cows owned by different people share a trough or bale? Does a veterinarian have to go to each person to see their cows, or can he inspect all the cows in one place?
18:15Another way to look at it (see how I'm getting real work done now) is *how you want to describe* things. How do you say
[
    [Bob buys 2 cows [bessie and flossie]  from Carol]
    [Alice moves to house #5]
    [Dan buys field #37N...] ; (It's a UTM coordinate system, right? ;^)
]

and how those operations are performed.
rebolek
18:16@greggirwin ho ho ho, please stop here. Everyone knows that comma is forbidden in Redbol ;)
greggirwin
18:17Ack!
18:18 Better?
18:19I could lose the inner blocks as well, but...
rebolek
18:20@greggirwin It is better, but I think that parse does not need brackets to distinguish sequences ;)
greggirwin
18:22But then do we want statement terminators? ;^)
[
    Bob buys 2 cows [bessie and flossie]  from Carol .
    Alice moves to house #5 .
    Dan buys field #37N... .
]
rebolek
18:22Do we?
greggirwin
18:22Not for parse, but for humans.
rebolek
18:22But for humans, newlines are enough, IMO.
greggirwin
18:22They can ease some things in dialects, but aren't strictly needed of course.
18:23Agreed, but then do we enforce newlines as the statement terminator? Maybe a bit OT for the question at hand.
rebolek
18:23I still think that comma should be added as whitespace, unless it’s not.
18:24@greggirwin not enforce. It’s just for humans.
greggirwin
18:24Ah, I see what you mean.
18:25A good reason, too, for keeping dialects simple.
rebolek
18:26Anyway, my comma idea is that 3,14 is 3.14 but 3, 14 or 3 ,14 is [3 14].
greggirwin
18:28It's a big topic. Worth writing up a REP, though, to discuss it.
rebolek
18:29Yep, I don’t want to pollute this channel with it. It’s something that was heavily discussed in Rebol but never resolved.
18:30Punctuation is very interesting topic, indeed. ;)
greggirwin
18:33My current feeling (having leaned both ways at times) is that if you need to support it, we now have the ability to pre-process data when loading and it can be handled there. I often come back to the idea of "if you aren't sure whether you need it or not, you don't."
18:34And all the past discussion on it hasn't yielded a strong "we need it" conclusion.
rebolek
18:35Agreed. I really do not wanted to start discussion about comma. I just wanted to make you to clean up that dialect ;)
greggirwin
18:35LOL! And I did. :^)
18:36Though the commas were *between* marked up dialect text, that wasn't clear in gitter.
rebolek
18:36Almost ;)
18:37
[
    Bob buys 2 cows [bessie and flossie] from Carol
    Alice moves to house #5 
    Dan buys field #37N...
]
greggirwin
18:37Iterative dialect design we do here.
rebolek
18:38Also, why are cows in block?
18:38
Bob buys 2 cows bessie and flossie from Carol
18:39And if we want to be really hard to parse:
Bob buys bessie and flossie from Carol
greggirwin
18:39Even 2 cows is not needed, but I thought of the sub-block more like a parenthetical comment.
rebolek
18:40Yes.
18:40Parse is so powerful that we sometimes need to be careful and not use all that power.
greggirwin
18:40And whether we require unique names in the world or by type. e.g. could you have a field called flossie?
18:41With great power... Yup.
rebolek
18:41You have and. You do not care about flossie.
greggirwin
18:42Huh?
rebolek
18:42word! ahead 'and for infix rules
greggirwin
18:44Still not getting you. How do you disambiguate what you're buying, if your world looks like this?
world [
    cows [
        bessie []
        flossie []
    ]
    fields [
        flanders []
        flossie []
    ]
]

i.e. how do you know bessie and flossie (without a sub block), means two cows, rather than a cow and a field?
18:45Given that Carol might own Bessie the cow, but *not* Flossie the cow, but she *does* own Flossie Field.
rebolek
18:46I see.
18:46I guess that requires generator for the rules.
18:47Dialect, that creates a dialect.
greggirwin
18:47Or just keep the dialect simple and limited.
18:48We're talking cows here. I don't know if they're ready for meta DSLs. ;^)
rebolek
18:48That depends on the user case, I guess.
18:48Yeah :D
greggirwin
18:48I mean, they don't even have thumbs to type with.
18:48So we have to keep things *really* simple. ;^)
rebolek
18:49OTOH, if you are in the cow business, you want things really simple and then, meta DSL may be useful for you, as the user ;)
greggirwin
18:53But, per the current question (which we've strayed from, into cow dialects), maybe we start with a meta DSL for creating simulations.
rebolek
18:55Yes.
dander
19:10I thought the original question was about how to model the data, and create relationships between different parts. Do you guys think it's a better approach to define the dialect for interacting with the model first, and then derive a data model from that?
greggirwin
19:29I go both ways. A mix of top-down and bottom-up. I think what happened here is that we started with a problem and just got into a little flow discussing it. Now we know a little more about how to think about it, and that will drive the modeling. If you look at the above world block, just add people and houses and you have the basics. Then we have to define relationships between those things. What might that look like?
dander
19:46I'm curious how you pick between using blocks vs object!s. Would you start with blocks for simplicity and maybe move certain parts to objects if the need arises? I guess a block looks a lot like an object from the outside if you structure it like that world example.
greggirwin
19:48I think it's good to focus on data first, when designing systems. What are you talking about, and how do those things relate to one another. That may not always be records in a database, so it's maybe more data *discovery* than modeling. And it's part of the Forth approach to defining a vocabulary. If you think in terms of "write the language you want to write your program in", data is a big part of that. The language you create is not just verbs, but also nouns. And it's not just action verbs that are important, but the "little" verbs, sometimes called *linking* or *helping* verbs in the U.S., e.g. [is am are was were be being been has have had do does did shall will should would may might must can could].

Think about where you've see those words used in programming. Ever see MUST or SHOULD in RFCs? We talk about is-a and has-a relationships. If you created a log, or undo stack, could you use those to replay history or determine temporal state change clearly? Capabilities? Design by Contract? How do we express things, and how do our tools help us?
19:53For me there's no hard line. Red makes it almost transparent if you need to change. Not completely of course, but the universal path notation goes a long way. Sometimes it's pure convenience. I want to give users files that are basically spec-block formats for objects [name: value], and those are easy to construct into objects. Red solves a lot of the pain in Rebol that came from using set-words as keys in blocks, and we have maps too. It's a very fluid mix for me.
rebolek
19:54@dander If you have anonymous data, use block!, for named data use object!. Or map!. That is the real question. Or hash! instead of block!? Damned, so many datatypes ;)
greggirwin
19:57Blocks are more flexible as well, if you have sparse data, or want to extend them.
dander
20:08So the way I am understanding this is that the process of designing the dialect forces you to think about both the data you are working with and also the way you will interface with it (including how you link different parts together). This seems like a really natural way of leading you to building the "thin vertical slices" of a project.
20:10I'll be interested to see how @this-gavagai responds to this discussion. I really appreciate how well he articulates his questions, and I've been learning a lot from this.
20:30Would it be feasible to use reactor! relationships between things? For example, each cow's health is a function of rainfall + a number of other conditions, so if you update the weather object, that change propagates throughout the entire data model (including things that depend on the cows).
I don't think I understand reactor!s well enough to know if that would be a good fit for their use... perhaps it depends on whether the use is read-heavy or write-heavy - in which case maybe lazy evaluation would be more appropriate?

greggirwin
01:27@dander, on dialect design, I think that's a good analysis. On reactive programming, yes. Reactivity in Red is really more like dataflow programming than the ReactiveX stuff that's popular today. Regarding lazy evaluation, that's also possible. I believe Maxim Adloch's old liquid system for Rebol could be either push or pull, and is also a dataflow model. I haven't built anything where I needed lazy evaluation, aside from the nice notion of infinite series.
TimeSlip
02:05Hello, is "focus" event (in Vid) supported? If not, is there any way to distinguish and entering/exiting with "over" ? Thanks.
qtxie
04:14Yes. We have focus and unfocus event.
TimeSlip
05:05@qtxie Thank you. Is there a hover off ? I need to distinguish when my mouse is going over a base and when it is leaving. I thought that focus and unfocus would work but I think it is not sending those events with the base objects I am using.
qtxie
06:34In over event, you can check event/flag.
TimeSlip
06:34@qtxie Never mind. I see that there is an 'away flag which works fine. What was happening was I created some "bases" that I needed to behave like toggle buttons. When the mouse moved over them, they change colors to visually show hovering. The problem was that when the app first started and the mouse was over a "base" it would set the color based on the initial "over" event which was actually an "away". Now that I can see the 'away events I can check for that.
06:47One thing, however, is puzzling for me. When I add an actor, I use (in this case) on-over :myfunction. How does Red know what parameters to send? In myfunction I have "face" and "evt" . Is there some common list of parameters Red sends? In other words, I am telling red to use myfunction but I don't have to include any parameters defined in the function. It simply sends the face and event. I'm curious about that and if there are other parameters I could include. I hope my question makes sense.
rebolek
06:48@TimeSlip Red "doesn’t know" what parameters to send. It simply sends the same parameters again and again and your function must respect it.
TimeSlip
06:49Bo, I mean does it send face and event automatically?
rebolek
06:50@TimeSlip Exactly.
06:50It doesn’t matter if you are calling them face and event in your function, or foo and bar. It’s just first and second argument.
TimeSlip
06:51OK, so it always sends face and event , in that order, and there are no other parameters sent?
06:52That's just the way it works then.
rebolek
06:52Yes.
TimeSlip
06:53Cool. Lucky guess for me then :smile:
06:55I just looked at the docs again and see that it has that notation. It just never dawned on me that it worked that way. Now it makes sense.
rebolek
TimeSlip
06:56Thanks brother.
rebolek
06:56You’re welcome.
TimeSlip
06:58That's my problem. Unless it is so blatantly explained I miss it. Fortunately, I'm just that close to finishing my first R2 to Red project. So far I am loving Red despite these little troubles.
06:58Goodnight
rebolek
06:59It’s great you have these questions. They can be answered and added to documentation for other people to help them.
TimeSlip
07:00Yes, I am taking notes so that I can create some docs.
07:03Bo, I just thought of something. I'll send you an email tomorrow.
rebolek
RiVeND
13:09Like @dander I am finding the whole Cows/Fields/People discussion fascinating. I'd love to see how this translates into fully working Red code/data as I still have to get my thinking fully into Red mode (my "normal" work is OOP).

greggirwin
21:17@this-gavagai, be careful what you wish for: https://gist.github.com/greggirwin/e8b2b3c9310df477d31529297292c2de
geekyi
23:09@geekyi realizes he has missed an interesting discussion
greggirwin

dander
17:17cool, @greggirwin ! This will keep me occupied for a couple of my evenings :wink:
TimeSlip
18:12I have this png file that is saved in a text format (forgive me if I don't recall the specific name for it) but to use it I "load" it. It looks like "load 64#{iVBORw0KGg..." The problem is that when I try to "do" it in Red I get a "*** Access Error: invalid UTF-8 encoding: #{89504E47}"
18:12What can I do to load it?
18:20OK, I went back to R2, loaded it, saved the molded results and use that instead. Probably not as elegant but it works.
19:19New question. How can I center faces in a panel?
greggirwin
20:15
view/no-wait [p: panel 400x400 [btn: button "OK" [unview]]] 
center-face/with btn p  
do-events
TimeSlip
22:42@greggirwin Thank you. I ended up using a panel within a panel and it worked perfectly.

dockimbel
02:14@TimeSlip load/as 64#{...} 'png should work. We need to improve the image codec automatic detection, so it will work as in Rebol.
TimeSlip
02:43Ah, I wondered about that /as . I'll try it.
03:10Works great Doc!
03:10Thank you.
04:01OK, another question. I'd like to create a loop that presents a series of strings one right after another with a pause in between. There seems to be a problem doing a view/no-wait and a do-events and then changing the /text and showing the face. I also tried placing the code inside the layout and using a "do [ ]" but I don't know, it's not working as I would expect.
05:21I ended up just creating a button that manually cycles through the strings. Cheesy but it works and has the advantage to user control.
05:30I also implemented my on-key "hot keys". One thing I noticed is that I have to manually use a button the first time then the on-key starts to work.
rebolek
05:46@TimeSlip You can use rate in VID. See the eve clock demo.
TimeSlip
05:47@rebolek Thanks Bo. I will check it out
05:50@rebolek how does rate work?
05:52Well, let me experience. I think I see what it's doing.
rebolek
05:53@TimeSlip see this line:
base 200x200 transparent rate 1 now
You specify rate 1 - that means 1 fps.
05:53Then you use on-time actor that is run every second.
TimeSlip
05:57Bo, works like a charm. Thanks. That's yet another thing I wouldn't have figured out.
rebolek
05:59You’re welcome.

TimeSlip
02:08Here's a good one. I was all happy testing my app but now it's time to compile it and I'm getting some errors that don't show up when I use the interpreter. Right now I'm stuck because I'm getting "compiler internal error" as opposed to a compilation error. Well, here's to finding what's causing it.
02:12It's in something called comp-call
03:01I narrowed it down to using chars ( ex. #"1") in a switch.
03:02Ah, perhaps the # has to be escaped?
04:27I'm able to compile a test app with code using #"1" with the latest version. Must be something in the larger app.
04:27Getting farther... Now this show up: Compiling to native code...
*** Red/System Compiler Internal Error: Script Error : decorate-fun expected name argument of type: word
*** Where: comp-expression
*** Near: [decorate-fun expr/1]
rebolek
05:12@TimeSlip Compiler InternalError is bug. You should report it.
TimeSlip
05:13The killer thing is I managed to get one version to compile but now I can't figure out what I did to make that happen. Me thinks it's in my code though.
rebolek
05:15Compiler Internal Error is not problem with your code. If it is in your code, compiler should throw specific error.
TimeSlip
05:15OK, the next question is how to report it.
greggirwin
05:16The compiler may not yet handle dialects. If you're writing VID code, try setting any words you set *inside* the layout spec *outside* of it first.
rebolek
05:16go to https://github.com/red/red/issues and press "New Issue"
greggirwin
05:17Though the error you're seeing is likely not what I said, so nevermind. It would report an error correctly in that case.
TimeSlip
05:18 @greggirwin Yes, I noticed that I had to do that for several words. @rebolek Thanks for the instructions.
rebolek
05:19@TimeSlip Do not forget to add some example code how to reproduce the error.
TimeSlip
05:20This particular app creates Vid code on the fly so it's a bit funky. And if I knew what was causing it that would sure help. I got thrown off because the program was working flawlessly in the interpreter.
this-gavagai
08:52@greggirwin Wow! This is incredible. My apologies for the slow response. I live in a remote area and the internet sometimes goes out unexpectedly for up to a week at a time. I'm going to read through this all this evening and get back here.
greggirwin
15:49@this-gavagai, I live in a rural area with the occasional blip, and slow access at times. I was on dial-up longer than any of my modern peers. People would sometimes mention how efficient my code was, and light on the wire. I would tell them that it had to be. My net connection was the slow test case. :^)
TimeSlip
19:01Where can I find more info on the Red command line switches
dander
20:11@TimeSlip do you mean beyond the output of red --help? Or is that what you are looking for?
greggirwin
20:52%red.r contains the handler. I thought there was a doc page listing them, but can't find it right now. In the meantime:
any [
		  ["-c"	| "--compile"]		(type: 'exe)
		| ["-r" | "--release"]		(opts/dev-mode?: no)
		| ["-d" | "--debug" | "--debug-stabs"]	(opts/debug?: yes)
		| ["-o" | "--output"]  		set output skip
		| ["-t" | "--target"]  		set target skip (target?: yes)
		| ["-v" | "--verbose"] 		set verbose skip	;-- 1-3: Red, >3: Red/System
		| ["-h" | "--help"]			(mode: 'help)
		| ["-V" | "--version"]		(mode: 'version)
		| ["-u"	| "--update-libRedRT"] (opts/libRedRT-update?: yes)
		| "--red-only"				(opts/red-only?: yes)
		| "--dev"					(opts/dev-mode?: yes)
		| "--no-runtime"			(opts/runtime?: no)		;@@ overridable by config!
		| "--cli"					(gui?: no)
		| "--catch"								;-- just pass-thru
		| ["-dlib" | "--dynamic-lib"] (type: 'dll)
		;| ["-slib" | "--static-lib"] (type 'lib)
	]
20:53Doh! https://github.com/red/red

TimeSlip
00:51@dander @greggirwin Thank you. That's what I was looking for.
dockimbel
05:16@TimeSlip https://github.com/red/red/blob/master/usage.txt
TimeSlip
05:25Thanks doc. I'm still stuck with the compiler error. It seems when I add my mp3 system code red doesn't like it. I was wondering if there is a way to "CALL" a program with red. I was thinking I could create a player and have it launched.
dander
23:54@TimeSlip , I haven't tried it yet, but I've heard it can be done. I don't know if it's built into the red exe yet though. I think these are good places to start:
https://github.com/red/red/blob/master/tests/source/library/call-test.red
or maybe
https://github.com/red/red/blob/master/tests/console-call.red

TimeSlip
00:36@dander Thank you so much. Bo also posted some information a few days back that I managed to find.
geekyi
05:45@wolframkriesing sorry, I can't test anything right now as my antivirus (avira) has become overzealous and keeps quarantining crush.dll :worried:
I've tried disabling everything from disabling the antivirus but cannot even manually create a %crush.dll in the respective folders (Program data\red and red git source) :(
wolframkriesing
06:16@geekyi just to do a read/info?
geekyi
06:19@wolframkriesing can only use the current version as I had it running before. It has deleted all the other versions of red, can't use the builds or compile from source. Will check other ways later
wolframkriesing
06:19No worries, any hints how I can investigate more?
geekyi
06:21@wolframkriesing I'm not sure, as you seem to be on MAC
06:21do you have wireshark?
06:25For anyone curious, when I try to compile from source; pretty sure it's caused by the antivirus:
-=== Red Compiler 0.6.1 ===-

Compiling C:\Users\XXX\Documents\GitHub\red\red\tests\hello.red ...
Compiling compression library...
Script: "Red/System PE/COFF format emitter" (none)
*** Linker Error: locked or unreachable file: .\..\crush.dll
dockimbel
06:37@geekyi If you have an opened Rebol console where you did a Red compilation before, it can lock the crush DLL file.

geekyi
14:33@rcqls can you post some code that can't avoid parentheses? I want to understand what you are saying
rcqls
14:39@geekyi I think you do not understand me. Just check the red development. tests/quick-test.r and this line in particular to char! ((shift code 6) and #"^(1F)" or #"^(C0) »). It is like mathematics, at some point it is just impossible to avoid parentheses to change priority rules in evaluation. The good point in Redbol is to try to avoid it when not necessary as a literal language. Sorry! You posted the same message or I receive an old message...
geekyi
14:47@rcqls https://github.com/red/red/blob/master/quick-test/quick-test.r#L716 right
14:49@rcqls You are right, I didn't know of words! that behaved like ops! like and, I'd thought it was more uniform. I'm a redbol newbie too :wink:
rcqls
14:52@geekyi I am really loving red (more than rebol) because of the foundation expressed by @dockimbel. One day, I am pretty sure that Red would be my master language.

TimeSlip
00:36Hello. Is there a way to elegantly destroy a view? I have this layout face that uses the "rate...on-timer" function to update the text. After is runs its course, I'd like to get rid of it since after an unview, it keeps running in the background (which could be a useful thing but not in this instance because I am done with the face.)
greggirwin
01:38Are you holding a reference to the view elsewhere? Have you tried setting the rate to none before unviewing?
TimeSlip
02:25@greggirwin I set the rate to none as suggested. Thank you! I was dreading removing that feature from my app.
geekyi
10:49@maximvl thru or to might help in your case I think
10:58I don't know if there is a way to not make parse greedy, I changed my code to not work against it
maximvl
12:14is it possible to get last matched value in parse?
12:14or what is the general way to collect data?
dockimbel
12:17@maximvl collect/keep combo, or just copy or set, depends on your needs.
parse [1 2 a 3] [any [integer! | copy w word! (?? w)]]

list: []
parse [1 2 a 3 b 4] [any [integer! | set w word! (append list w)]]

parse [1 2 a 3 b 4] [collect any [integer! | keep word!]]
TimeSlip
12:40Getting so close now. I have a handler used with a button that responds to key events. The trouble is that it only works after I press the button once. After that it is fine.
maximvl
12:51@dockimbel collect works, it reverses the order in the end, but this is fine
13:04wait, should it revert result or not?
dockimbel
13:09No, it should not.
maximvl
13:13let me make a small reproducible example
13:16@dockimbel ok, it's only for collect into
13:16
z: copy []
print mold parse [a b c] [any [collect into z [keep word!]]]
print mold z ; => [c b a]
geekyi
13:48@maximvl (also) check the red blogpost for parse
maximvl
13:50@geekyi this one? http://www.red-lang.org/2013/11/041-introducing-parse.html
geekyi
13:51collect is a red feature, with rebol you use set
maximvl
13:51it says
>keep (expr) : append the last value from the Red expression to the collecting block
13:51but with into it prepends, not appends :)
geekyi
13:53@maximvl /into has insert semantics, there was a conversation about it..
13:53I was wondering if it shouldn't be parse/collect, it's the only case where parse returns a block! instead of logic! @dockimbel
maximvl
13:54makes sense, especially when you are not in control of which rules will come to parse
13:55you dont know if it will return logic! or block!
rebolek
13:57IMO you know, because you set the rules
13:59PARSE in Rebol could also return block! when used as Split function
maximvl
14:01@rebolek what do you mean you set the rules
14:01rules can be easily passed though the system from one place to another
14:02writing something general becomes more complex
dockimbel
14:05@maximvl It should not reverse the order, there might be a ticket for that already, if not, please open one.
14:06@maximvl BTW, print mold == probe. ;-)
Rebol2Red
14:06How can i set a focus on a face? How can i read the mouseposition on a window or a face?
maximvl
14:08@dockimbel there is, indeed, I forgot about probe, thanks)
geekyi
14:15:point_up: [October 17, 2016 6:57 PM](https://gitter.im/red/help?at=5804d8e51cc4cda4565acd08) @rebolek and the functionality was split out into split :smile: in rebol3 and red
maximvl
14:19ok, here is the question about parse
14:19I want to parse a block and extract data
14:21to store the data I'm hard coding names of variables into rules
14:22the question is how can I make this reusable?
14:32
red
*** Driver Internal Error: Script Error : Out of range or past end 
*** Where: parse-options 
*** Near:  [if cmd: select [
"clear" do-clear
] first]
14:33
red --cli 
--== Red 0.6.1 ==-- 
Type HELP for starting information. 

red>> x: 5
== 5
red>> b: context [
[    x: x
[    ]
*** Script Error: x has no value
*** Where: x
14:33so, basically one can't use a variable as initial value if field with same name exists in context
Mufferaw
14:34I've run into a strange issue, using Red/System. Inside a nested loop, I call a function which calls another function (ex: myfunc arg1 arg2) The problem is that the 2nd argument has somehow replaced the 1st argument, so the function executes like myfunc arg2 arg2. Here's the code
https://gist.github.com/Mufferaw/523a91d7c979a79bd6ce7509db283c21
From the Color function I call the vec3-add function with arguments v3 and v4 but in the vec3-add function they are the same. Also, when I 'probe' v3 and v4 I get the same result
rebolek
14:57@geekyi parse/collect (or parse/into) may be a good idea, I was just playing devil's advocate ;) it's not that unusual that function returns different types
14:59@maximvl in Rebol 3, I had function that let you make PARSE rules with local variables
maximvl
15:06@rebolek I suppose this can be done with bind technique, but I'm not sure if it is ported to Red
rebolek
15:13I tried it yesterday, but it crashes Red. I have to look at it and write an issue (I'm on phone now).
15:14Anyway, for your x: x example: try using compose and x: (x)
maximvl
15:46@rebolek indeed, thanks!
dockimbel
15:50@maximvl Another way to achieve it:
red>> x: 5
== 5
red>> b: context [x: system/words/x]
== make object! [
    x: 5
]
maximvl
15:52@dockimbel does system/words/x return value binded to x in current scope?
dockimbel
15:53It just ensures that x value is fetched from global context and not local one.
15:55@Mufferaw Could you pinpoint in your code where is that issue happening precisely? Remember that declare is a static allocation, not a dynamic one (use allocate and free for that).
maximvl
15:58@dockimbel ok, then this is not what I want, I'm returning object from function
dockimbel
16:03@maximvl Then compose is the right option.
maximvl
Mufferaw
16:26@dockimbel on line 88, vec3-add v3 v4, the two arguments have different values but when they 'arrive' at the vec3-add function, they are the same.
16:27
Color - v3/x: 0.1479379273840342 y 0.2071130983376479 z 0.2958758547680684
Color - v4/x: 0.7041241452319316 y 0.7041241452319316 z 0.7041241452319316
ADD-A x 0.7041241452319316 y 0.7041241452319316 z 0.7041241452319316
ADD-B x 0.7041241452319316 y 0.7041241452319316 z 0.7041241452319316
dsgeyser
17:16@greggirwin
wolframkriesing
20:38noob question ahead :)
what’s the difference between
a: [ b 1 ]
; and
a: [ b: 1 ]

on both I can do a/1 and a/b, the second is a set, what is the first?
geekyi
20:43@wolframkriesing
collect [foreach thing a [keep type? thing]]

first case a: [ b 1 ]:
[word! integer!]

2nd case a: [ b: 1 ]:
[set-word! integer!]
wolframkriesing
20:45@geekyi is the collect line pseudo code? I understand nothing of that line :)
geekyi
20:46@wolframkriesing nope, you should try it out, useful for series
20:46I actually didn't know rebol2 had it, thought it was a red, rebol3 feature
wolframkriesing
20:47ah, the generic version of
red>> type? a/1
== word!

thx
20:47what is the block [b 1]? its not a set, right? an object neither
geekyi
20:51@wolframkriesing a block? :P I think what you are trying to say, when would you use one, and when the other?
wolframkriesing
20:52probably :)
geekyi
20:52Just a usecase that came into my mind.. if you use reduce a, they would work different
20:55@wolframkriesing maybe also ask on stackoverflow? "difference between set-word! and word! in a block"
wolframkriesing
20:55makes sense. just wondering why does a/b return 1 for a: [b 1], for a: [b: 1] I would understand it
geekyi
20:56overloaded conventions I think
wolframkriesing
20:56interesting
red>> a: [b: 1]
== [b: 1]
red>> a/1
== b:
geekyi
20:57basically working like select
wolframkriesing
20:58thx @geekyi
geekyi
20:58
>> d: [e f g h i]
== [e f g h i]
>> d/e
== f
>> d/h
== i
wolframkriesing
20:58i throw it out on stackoverflow #survives_longer :)
geekyi
20:59SO #needs_questions
greggirwin
21:48One difference is how they are evaluated.
red>> a: reduce [ b 1 ]
*** Script Error: b has no value
*** Where: reduce
red>> a: reduce [ b: 1 ]
== [1]
maximvl
21:50@wolframkriesing b: is a set-word, while b is just a word
21:52it is a different datatype, others are get-word (as :a), lit-word - 'a
greggirwin
21:53The change from Rebol allows set-words to be used as selectors, as was said. This is *very* nice, because the way you had to do it under R2 was a pain, forcing you to choose your block format much more carefully, if you wanted to use spec-block format.
21:53
>> a: [ b: 1 ]
== [b: 1]
>> a/b
** Script Error: Invalid path value: b
** Near: a/b
>> select a to set-word! 'b
== 1

Mufferaw
05:54@dockimbel I've made another gist that demonstrates the problem I'm having.
Is my ignorance causing this problem? Am I doing something wrong?
https://gist.github.com/Mufferaw/84ada8d399b70ae4dcc5f16d7e70e475
wolframkriesing
06:17Thanks @greggirwin and @maximvl ... looks like it's time to dive deeper into the types set-word and get-* and lit-*
06:23Though one question remains, using a: [b 1] I can still access a/b, so what is in that block? It's not a set, right?
dockimbel
06:39a/b is just syntactic sugar for select a 'b. Similarly, a/:b is sugar for pick a b.
wolframkriesing
06:48ok, I need to let that sink in
DideC
08:59@Mufferaw I don't program in R/S so it's far from my knowledge.
But playing with your code, it behave like if a local variable is statically create for the function : its adress is the same at each call. So testu and testv point to the same address after calling the function: they are the same.
Of course, it's not the behaviour that you want (I suppose it's the correct R/S one), but don't know how to change it.
PeterWAWood
11:12@Mufferaw When you pass a structure as an argument to or return a structure from a function, the structure is not physically passed but a pointer to it. You will notice that the second set of probes in your gist always return an identical value (which is the address of
a
).
11:14The normal way around this is to pass the address of the structure you wish to update as an argument to the function rather than returning a new structure. (The alternative is to copy the values from the returned structure before calling the function again).
11:17Here is an outline for a revised version of your vec3-Mfloat function:

vec3-Mfloat: func [
    vec [vector3!]
    f [float!]
    new-vec [vector3!]
    ][  
        new-vec/x: vec/x * f
        new-vec/y: vec/y * f
        new-vec/z: vec/z * f
]


Here are the revised calls of the function:
vec3-Mfloat direction testf testu
vec3-Mfloat origin testf testv
Mufferaw
11:37@PeterWAWood Thank you
DideC
13:03@PeterWAWood So it means that it's not possible to "create" a new structure inside a function and return it to the caller ?
maximvl
13:33I just realized one can't use loops over object's fields
13:34
red>> forall x/z [print first x/z]
*** Script Error: forall does not allow path! for its 'word argument
*** Where: forall
rebolek
13:40You can, but not directly:
red>> o: object [a: 1 b: 2]
== make object! [
    a: 1
    b: 2
]
red>> foreach w words-of o [print [w get w]]
a 1
b 2
maximvl
13:51@rebolek ah, I meant another thing - to iterate over the block which is object's field
13:51like o: object [a: [1 2 3]]
rebolek
13:54@maximvl I see. That is forall limitation, see the help: *'word [word!] => Word referring to series to iterate over.* - it does not accept path!
TimeSlip
13:59I thought I would recompile my app this morning and I am getting "*** Runtime Error 1: access violation
*** at: 730E2182h"
14:01I have made any changes and it was compiling just fine yesterday. This is happening on two computers (@home, @work)
maximvl
14:04how do I convert get-word to just word?
TimeSlip
14:05Also, I noticed that on windows 10, when I have a backdrop image and then a base set to some level of transparency (alpha value), the transparency affects the backdrop image as well and makes a see-thru window. What I thought it would do is keep the backdrop at full opacity and just alter the base.
maximvl
14:06
red>> to get-word! "foo"
*** Script Error: TO cannot convert get-word! from: foo
*** Where: to
red>> to set-word! "foo"
== foo:
red>> to word! "foo"
== foo
TimeSlip
14:14@maximvl Yes, it doesn't seem to work. I know this is not elegant but
type? load ":foo"
== get-word!
14:15...until it's fixed.
maximvl
14:16@TimeSlip I have word and a get-word, I need to convert one to another
TimeSlip
14:16Ahhh
maximvl
14:19this is weird, I don't see any workaround here
TimeSlip
14:21@maximvl Can you post it as a bug?
maximvl
14:21sure
14:44https://github.com/red/red/issues/2275
geekyi
15:24@TimeSlip :point_up: [October 18, 2016 6:59 PM](https://gitter.im/red/help?at=58062ad3482925776134a449) does your code use view and is on windows 10?
15:27[October 17, 2016 5:21 AM](https://gitter.im/red/red?at=5804198c671ea7ae6c4673cf) same issue? (try to see if you can compile tests/vid.red), red was recently refactored to prepare for mac
greggirwin
16:15@maximvl load append copy ":" 'a (until it's fixed).
meijeru
16:22@maximvl Re #2275: If I remember well, several issues related to to have been dismissed by Doc because the implementation of to is not finalized.
maximvl
16:23@meijeru okey, but it makes little sense that to can convert to lit-word! and can't to get-word!
16:24@greggirwin thanks!
16:26does Red support closures?
16:27
red>> afun: func [x] [ func [y] [x]]
== func [x][func [y] [x]]
red>> a: afun 1
== func [y][x]
red>> a 3
*** Script Error: x is not in the specified context
*** Where: a
16:27and if not - what is the replacement?
dockimbel
16:28@maximvl to is only partially implemented for now, we need to rework and complete it. Closures are not yet available in Red.
greggirwin
16:35@maximvl , to is an action in each datatype so there is a logical reason why it might work for one but not another.
maximvl
16:48@dockimbel my little experiment with lambda lists / keyword arguments: https://gist.github.com/maximvl/e2c0c2b7695164bef30582ffc7eba931
greggirwin
17:33Nice Maxim! Fun stuff.
TimeSlip
18:14@geekyi Yes, it uses view but I am using a previous version of Red that compiled the same code before. 0.6.1 - 28-Sep-2016/11:09:27-7:00
PeterWAWood
23:56@DideC Whilst you can return a new structure from a function in Red/System, you can create a new structure and return a pointer to it. You would need to use
allocate
to reserve memory for the new structure and then assign the address of that memory to the structure. You can then return the pointer from the function. One issue with that approach is knowing when to release the memory allocated to the structure.

I think it is better practice to supply the address of the structure for the return values as an argument to the function.

TimeSlip
00:26OK, the following was being caused by not using the "stable" version (on both my computers). Whew! Thought I was going crazy.
*** Runtime Error 1: access violation
*** at: 10002182h
PeterWAWood
03:13@DideC I meant to write "Whilst you can't return a new structure ..."
Mufferaw
05:01Another Red/System question, I'm trying to make a 'list' with a struct and I wonder if there is a way to iterate through the members of the struct
list: declare struct![
	item1 [sphere!]	
	item2 [sphere!]
	item3 [sphere!]
]

and I want to do something like -
list/1 or list/x
PeterWAWood
06:20@Mufferaw It is possible to iterate over such a structure but you have to take care of all the details yourself so it is a bit tricky. Here is your example with a very simple sphere! structure:
Red/System []

sphere!: alias struct! [
    radius [integer!]
]

list: declare struct![
    item1 [sphere!]    
    item2 [sphere!]
    item3 [sphere!]
]

list/item1: declare sphere!
list/item2: declare sphere!
list/item3: declare sphere!
list/item1/radius: 1
list/item2/radius: 2
list/item3/radius: 3

print [as integer! list/item1/radius " " list/item2/radius " " list/item3/radius lf]

sphere-len: 4
item: declare sphere!
list-as-array: as byte-ptr! list/item1
i: 1
until [
    item: as sphere! list-as-array 
    print [i " " item/radius lf]
    list-as-array: list-as-array + sphere-len
    i: i + 1
    i > 3
]
06:28The "arithmetic" will get tricky if the length of the structure is not a multiple of four bytes. (The compiler probably will pad the structure so that the fields are aligned in memory. I'm not sure of the details.)
Mufferaw
06:40@PeterWAWood Wow, thanks!
PeterWAWood
07:09I'm not sure that is the best way to do what you want.It may be better to have an array of sphere!s could be a better choice ... but then you 'll need to manage memory allocation yourself.
dockimbel
07:45@Mufferaw This is how:
spheres: declare struct![
    item1 [sphere!]    
    item2 [sphere!]
    item3 [sphere!]
]
list: as sphere! spheres


then you can use list/1 or list/x.
07:46Though, it would be probably better to allocate the spheres array dynamically:
spheres: as sphere! allocate 3 * size sphere!
Mufferaw
08:47@dockimbel I can't get that to work
Red/System []

sphere!: alias struct! [
    radius [integer!]
]

spheres: declare struct![
    item1 [sphere!]    
    item2 [sphere!]
    item3 [sphere!]
]

s1: declare sphere!
s1/radius: 45
spheres/item1: s1

list: as sphere! spheres
print [list/1/radius]

gives me invalid path
dockimbel
09:06Deep paths are not supported in Red/System for now, you need to decompose it into two instructions.
PeterWAWood
09:32@dockimbel I found that the
item1
in the above structure is offset from the start of the structure:

address of spheres        00003060
address of spheres/item1  0000307C


I needed to set
list
to the address of `spheres/item1 to get the code to work.
09:34Also I got a compile error when I tried to access
list/1
:
*** Compilation Error: invalid struct member 1 
*** in file: %/Users/peter/VMShare/Code/Red-System/test.reds 
*** at line: 25 
*** near: [list/1 lf]
DideC
12:14Seems logical : spheres is a set of 3 pointers of 4 bytes each, so 12 bytes. So spheres/item1 is the address of s1 struct in memory: its a pointer.
dockimbel
12:49@PeterWAWood @Mufferaw My bad, I forgot that we didn't implement indexed path notation support for arrays of structs yet, so you have to do an extra step. Here is a working example, setting up a dynamic array of 3 sphere! structs, initializing the radius with values from a literal array of integers:
sphere!: alias struct! [
    radius [integer!]
]

spheres: as sphere! allocate 3 * size? sphere!

list: [45 30 60]
s: spheres
i: 0

while [i < 3][
	s/radius: list/value
	print ["Sphere " i " radius: " s/radius lf]
	list: list + 1
	s: s + 1
	i: i + 1
]
dander
20:09@maximvl It looks like it is possible to make a closure with something like this
red>> afun: func [x] [c: context compose [x: (x) f: func[y][x]] :c/f]
== func [x][c: context compose [x: (x) f: func [y] [x]] :c/f]
red>> a: afun 1
== func [y][x]
red>> a 3
== 1

I only learned about the compose trick for using the same argument name today, but it makes me think this could evolve into a generalized closure function generator

Mufferaw
04:25Using Red/System, how can I generate some random numbers? Do I need to #include something?
dockimbel
05:42@Mufferaw You should be able to include the %random.reds file from the Red runtime:
#include %runtime/random.reds

_random/init
_random/srand 123      ;-- set the seed
probe _random/rand     ;-- get a random 32-bit integer
Mufferaw
05:46@dockimbel thanks!
dockimbel
06:08@Mufferaw If you are embedding your R/S code in a Red script (using #system directive or routine), then the include and init are not required, they are already done for you by the Red runtime library.
maximvl
12:06@dander hm, can you explain what happens in your code?
12:06why does x inside f works for the context?
rebolek
12:09@maximvl f is defined in context where x is also defined.
12:10Even if afun returns f only, it does not mean that the c context is gone.
maximvl
12:26@rebolek I see, but how is that different from function version?
12:27I mean, function definition should create context, shouldn't it?
rebolek
12:28@maximvl this creates persistent context.
12:29You can’t (basically) do it with function.
maximvl
12:44@rebolek why?
rebolek
12:45@maximvl why what? When you have function all local values are initialized on each call (usually to none).
maximvl
12:53@rebolek local variables are not initialized in global scope, so there must be a local scope
rebolek
12:53@maximvl of course, there is
maximvl
12:54so why when I return function from another function it isn't bound to this local scope?
rebolek
12:54but what if you want to make i.e.: counter function, that will increase some local variable by one each time it’s called?
maximvl
12:55well, it should increase every time
rebolek
12:55try it
maximvl
12:55func [] [counter: 0 func [] [ counter: counter + 1 ]]
12:56@rebolek it works...
12:56I don't get it
12:56how does this one work without closures support?
rebolek
12:56because counter is global
12:56in your example
maximvl
rebolek
12:58func does not gather local words, so counter is defined in global context in you example
12:58IMO it does not work anyway.
maximvl
12:59func does not gather local words
12:59why is that?
rebolek
13:00It’s mostly for historical reasons, func does not gather them, function does.
maximvl
13:01historical reasons? Red is not 30 years old to be affected by historical reasons
13:01are there any other differences between func and function ?
DideC
13:04Rebol historical reasons (understand: compatibility).
13:08> are there any other differences between func and function ?

Use help .
maximvl
13:11do we really want compatibility with Rebol?
13:12I can see a problem here - people will use func because it is simply shorter, and all variables will leak into global context
13:15so the question actually is do we have any _good_ reason to not replace func with function?
dockimbel
13:47@maximvl func is the lowest level constructor for functions, it requires you to declare local words yourself. function is a higher-level constructor (it has a different behavior in Rebol), which gather the local words for you using an heuristic (gathering set-words from the function's body), which can sometimes have unwanted effects (so to be used carefully). function is just a wrapper over func.
maximvl
15:28@dockimbel I see, so set will also create a global binding inside function
rebolek
15:29Yes. Or you can use /extern
15:35But remember that it will create global binding only if that word isn’t local:
red>> bla
*** Script Error: bla has no value
*** Where: catch
red>> f: function [][bla: none set 'bla 1]
== func [/local bla][bla: none set 'bla 1]
red>> f
== 1
red>> bla
*** Script Error: bla has no value
*** Where: catch
maximvl
15:39so, if I'm explicitly writing /local x, when x will be local in any case?
rebolek
15:42Yes. But you can access global x with system/words/x
dander
16:38@maximvl , @rebolek It still seems to work when changing func to function (and actually seems better this way because it doesn't leak into the global namespace), presumably because it creates a new context object each time afun is called? I don't know if this is a good way of doing something like this. To be honest, I don't really know what I am doing. Just experimenting :smile:
rebolek
17:04@dander of course it works, context always creates new context and old one is not destroyed. But with func version, c leaks and holds last context.
dockimbel
17:04@maximvl Correct, except for already locally defined words.
17:08@dander You're doing it correctly, with what the language currently provides. Though, a closure! type or a [closure] attribut to functions would probably allow a more efficient internal implementation.
geekyi
22:02@maximvl :point_up: [October 20, 2016 6:11 PM](https://gitter.im/red/help?at=5808c288b827179842dd1191) in Rebol3 (and maybe 2) the situation was worse :smile: see the wiki
22:05[this section](https://github.com/red/red/wiki/Differences-between-Red-and-Rebol#function-vs-funct) and other pages on wiki

meijeru
09:00Urgent question: does a base face accept keypresses? If not, how do I capture keys (e.g. delete key) on a drawing that is rendered in a base face?
dockimbel
09:02@meijeru You need to put the focus on the face to get key events, otherwise, key events are sent to the window:
view [b: base on-key [print event/key] do [self/selected: b]]
meijeru
11:30Thanks, but I also need the mouse position (event/offset) and View tells me this is none. How come?
dockimbel
11:35@meijeru Feature not implemented. You can open a ticket for it, it's just a few lines to add. You'll get the mouse position relative to the focal face.
meijeru
11:50I have opened the ticket. Other question: is focus only relevant for key events? And how do you change the focus other than through setting win/selected?
pekr
12:18Focus system and/or tabing can get quite complicated. Some systems in Rebol had something like tabbable?property, to distinguish, if the item can actually get focus, or something like that. Some systems allow even the focus nesting, so that you have to press ESC to get out of that ... might be related to also how you wish arrow keys to works, etc.
dockimbel
12:20@meijeru Yes, relevant for key events only. You change it by setting /selected property or by clicking/tabbing to another focus-enabled face on screen. Tabbing support is not ready yet.
meijeru
13:22I see. Which types of faces are focus-enabled?
maximvl
13:40@geekyi ok, do x: and set 'x use same logic somewhere in low level code?
13:51I'm confused with functions calling order/rules here: https://github.com/red/red/wiki/Guru-Meditations#compiled-versus-interpreted-behaviors
13:51replace changes elements inside block
13:52why does it start evaluate functions after moving to interpreter mode?
DideC
14:04I don't have the technical explanation.
But, Carl Sassenrath claim that a Rebol script can't be compiled, due to it's dynamic nature. Dockimbel show that it's not completly true, but compiled programs "lost" some of their dynamic behaviour.
I guess JIT will handle this kind of problem one day.
But we have to leave with them for now.
greggirwin
15:24It would be good to document the details of why it works that way, since it isn't clear.
maximvl
15:31@greggirwin I just checked replace source
15:31the line insert pos value
15:31if the value is a function!, will it be evaluated?
15:32
red>> f: func [x y] [append x y]
== func [x y][append x y]
red>> f [] does [print "yo yo"]
yo yo
== [unset]
15:33this is something completely different from what I used to
15:33changing f to append x :y works though
rebolek
15:34@maximvl yes, it will be evaluated
15:34
red>> add add 1 2 3
== 6
maximvl
15:35@rebolek does it mean that add is exactly the same thing as y in my example above?
15:35ok, this starting to blow my head, I know this feeling
15:37usually in a language there is a syntax distinction between a value and function call
rebolek
15:37@maximvl yes, it’s the same
maximvl
15:37so a is a value, while a() or (a) is a call
rebolek
15:37Do not look at it as value and function call
15:38everything is value
15:38and that value gets evaluated
15:38sometimes it evaluates to function
greggirwin
15:38In Red, it's all about evaluation in a given context. You can control evaluation (e.g. passing a func as a get-word! to prevent evaluation).
maximvl
15:39@rebolek and when it evaluates to a function - function is called
15:39right?
greggirwin
15:39Correct.
maximvl
15:40and I guess errors in rebol work in the same way
rebolek
15:40@maximvl yes
15:40error! is just another datatype
maximvl
15:40if value evaluated to error, error happens
rebolek
dockimbel
15:43@maximvl As Gregg mentioned, you need to prevent unwanted intermediate evaluation of the passed function:
red>> f: func [x :y] [append x :y]
== func [x :y][append x :y]
red>> f [] does [print "yo yo"]
== [print "yo yo"]
15:43@maximvl Error: correct.
maximvl
15:45@dockimbel you work with Rebol for a long time, do you realize that there are nearly no languages doing same thing?
15:45I don't mean it's bad or something
15:47this is something that should be explained in detail to newcomers
greggirwin
15:50@maximvl, it's a bit of an advanced concept, so many newcomers won't encounter it for a long time. Functional programmers will, of course, but they should be able to grasp it with a little explanation, as we just did here. Someone want to put it in a blog post on the new Red blog Arie, et al are doing?
15:51We will also work on primer docs for people coming from various backgrounds.
maximvl
15:55good, because until this point I wasn't realizing Redbol is so different
15:56@greggirwin new red blog?
greggirwin
15:56http://redlanguageblog.blogspot.nl/
15:57That's what makes Redbol so amazing. It *looks* like something you know, but is very different under the hood. You can use is effectively without ever understanding that though. It scales with your understanding and needs.
maximvl
16:04@greggirwin thanks, now it's friday beer time :)
greggirwin
16:13http://www.rebol.com/article/0103.html
dockimbel
17:09@maximvl Indeed, evaluation rules need to be fully covered in the Red documentation. Happy beer time! ;-)
17:26@maximvl See [Get Arguments](http://www.rebol.com/docs/core23/rebolcore-9.html#section-3.3) section from Rebol manual.

this-gavagai
01:33@greggirwin and everyone else who has kindly responded to my earlier question about how to best represent entities in a simulation: Apologies for being so slow in getting back to you all. I've been playing extensively with the concepts you offered me, and it has been both exciting and fun. There's a lot to digest, and I am still processing a lot of it. I will be back at some point soon with thoughts and undoubtedly more questions! Thanks again.
01:38Also, I've been jotting down my thoughts as I go. If it would be useful to other beginners, I will do my best to consolidate them into a "Design principles of Red, from the outside" document of some sort.
dockimbel
05:02@this-gavagai Such document would be most helpful to help other developers.
greggirwin
06:38@this-gavagai +1 on notes. Those of us who have forgotten what we didn't know sometimes find it hard to explain things clearly. Very glad if this is all helpful.

maximvl
10:34@dockimbel thanks for the link, however I used to use 'a in arguments list to prevent evaluation, is it different from :a or are they the same?
PeterWAWood
10:53@maximvl
'a
, a lit-word!, evaluates to a word.
:a
, a get-word, evaluates to the contents of the value bound to
a
.
red>> a: 1
== 1
red>> do first ['a]
== a
red>> do first [:a]
== 1
11:04For many values, there is no difference when they are evaluated via a word or a get-word. e.g.
red>> a
== 1
red>> :a
== 1
11:06The difference with function! values is that when evaluated via a word, the function is executed where the function! value is returned when evaluated via a get-word.
red>> f: func [] [print "executed"]
== func [][print "executed"]
red>> f
executed
red>> :f
== func [][print "executed"]


(You probably knew this anyway.)
maximvl
11:08@PeterWAWood yep, I'm asking about difference in arguments specs: func ['a] vs func [:a]
11:13
red>> f1: func ['a] [probe a]
== func ['a][probe a]
red>> a: 5
== 5
red>> f1 a
a
== a
red>> f2: func [:a] [probe a]
== func [:a][probe a]
red>> f2 a
a
== a
11:13I don't see any difference here
PeterWAWood
11:50Which a are you evaluating in probe a?
11:51What happens if your function argument is :b:
11:51":b"
11:54Sorry, that's not relevant. (I shouldn't try to answer from my phone 🙁)
dockimbel
12:00@maximvl No difference in Red, like in Rebol3, though, the Rebol2 behavior looks more useful, so we may switch back to it.
maximvl
20:33@dockimbel what was behavior in Rebol2?
greggirwin
22:27
>> f1: func ['a] [probe a]
>> a: 5
== 5
>> f1 a
a
== a
>>  f2: func [:a] [probe a]
>> f2 a
5
== 5
PeterWAWood
23:20@dockimbel There is also a difference in how type checking is applied between Rebol 2 and Red:

Red
red>> f: func [:fun [function!]] [fun]
== func [:fun [function!]][fun]
red>> f1: func [] [print "running"]
== func [][print "running"]
red>> f f1
*** Script Error: f does not allow word! for its :fun argument
*** Where: f


Rebol2
>> f: func [:fun [function!]] [fun]
>> f1: func [] [print "running"]   
>> f f1                            
running

dockimbel
05:35@PeterWAWood That behavior difference is only because get-arguments in Red do not retrieve the word's value like in Rebol2.

maximvl
11:42how do I get keys from the object?
DideC
12:13What do you mean by "keys" and by "object" ?
rebolek
12:38@maximvl I think you are looking for words-of my-object
maximvl
12:42@rebolek exactly, thanks!
12:42@maximvl thinks words-of name is a bit misleading
12:43I was looking for keys or fields
rebolek
12:43It’s not misleading actually. They really are words that hold values.
12:44And you can get that values with values-of.
12:45You just have to get used to the redbol terminology.
maximvl
12:46yep, I see

redredwine
04:12Hello, I am new to red. I downloaded the red-061.exe on my windows 10 machine. and ran windows-061 -- cli , it gave me access denied (although i ran it as an administrator). when I tried running just windows-061.exe it does nothing, I don't get any red console.
was wondering if anyone has come across same problem before, and could help me get started.
04:16Directory of F:\red

10/27/2016 10:38 PM <DIR> .
10/27/2016 10:38 PM <DIR> ..
10/25/2016 09:29 AM 968,539 red-061.exe
1 File(s) 968,539 bytes
2 Dir(s) 100,930,060,288 bytes free

F:\red>red-061.exe --cli
Access is denied.

F:\red>
04:17F:\red>red-061.exe

F:\red>
qtxie
04:30@redredwine Maybe your anti-virus program delete it.
04:30See here: https://github.com/red/red#anti-virus-false-positive
redredwine
04:36my antivirus (avast + malwarebytes) did not raise any alert while i was running the commands above. also, when you say "maybe your anti virus delete it" , what is it deleting exactly ? the red-061.exe is still in F:/red/ folder.
Mufferaw
04:38@redredwine I had a problem with the Windows Defender before, it identified red.exe as some kids of virus
04:39No, I'm wrong, it identified one of my compiled red programs as a virus

Mufferaw
09:42I'm trying to use parse for the first time, I want to parse a block that could have things in a different order.
[RedBall sphere radius 10 position 0 0 5]
[RedBall sphere position 0 0 5 radius 10]

and my parse rule looks like this so far
rule: [
  word!
  'sphere
  any [set ver 'radius (print ver) | set ver 'position (print ver)]
  any [set int integer! (print ["Integer" int]) | float! (print ["float" ver])]
  any [set ver 'radius (print ver) | set ver 'position (print ver)]
]

After radius there should be one number (int or float) but after position there should be 3 numbers. Should it be something like
if radius [more rules]
or am I going about this completely the wrong way?
geekyi
09:49@Mufferaw unordered data... tricky. I was thinking a recursive sub rule after 'sphere, but then, what would you do about duplicates?
09:50
radius-or-position: [ radius | position | radius-or-position ]
Mufferaw
09:58@geekyi Maybe I should just keep it simple and not try anything too fancy until I understand a bit more about parse
dockimbel
10:00@Mufferaw Something like this should work (untested):
radius: pos: none

rule: [
	word!
	'sphere 2 [
		if (not radius) 'radius set radius integer! (?? radius)
		| if (not pos)  'position pos: 3 integer! (print ["position:" copy/part pos 3])
	]
]
10:01Out-of-order tokens are difficult to parse, we should provide something in Parse to help with that use-case.
geekyi
10:07@dockimbel doesn't work with the 2nd example.. I'll see if I can try my hand
10:07@Mufferaw maybe, maybe not :wink:
10:08@Mufferaw There is a wikibook about rebol3 which *massively* helped me to understand parse
PeterWAWood
10:10
radius: ['radius set ver number! (print [name "radius" ver]) ]
position: ['position set v1 number! set v2 number! set v3 number! 
			(print [name "position" v1 v2 v3 ])]

rule: [
	set name word! 'sphere
	any [radius | position ]
]

parse [RedBall sphere radius 10 position 0 0 5] rule
parse [RedBall sphere position 0 0 15 radius 20] rule
>
10:19Perhaps this is a little better:
radius: ['radius set ver number! ]
position: ['position set v1 number! set v2 number! set v3 number! ]

rule: [
	set name word! 'sphere
	any [radius | position ]
	to end (print [name "sphere of radius" ver "at position" v1 v2 v3])
]

parse [RedBall sphere radius 10 position 0 0 5] rule
parse [RedBall sphere position 0 0 15 radius 20] rule
10:20It gives this result:
RedBall sphere of radius 10 at position 0 0 5
RedBall sphere of radius 20 at position 0 0 15
Mufferaw
10:21@PeterWAWood That certainly does help! @dockimbel @geekyi I think I should definitely read that wikibook, is this the one you mean https://en.wikibooks.org/wiki/REBOL_Programming/Language_Features/Parse ?
geekyi
11:06@Mufferaw yeah, it's the end of the month, so my internet is very slow.. *crawling*
11:06even loading a page takes a really long time

Mufferaw
03:59
[Suppose we have a block and
it has two lines of text, each having a different number of words]

Is there a way to break that into two blocks? The newline character doesn't seem to work with blocks and if I convert the whole thing to a string and split it I can't change it back to a block.
greggirwin
06:16
red>> blk
== [Suppose we have a block and 
    it has two lines of text each having a different number of words
]
red>> find-new-line: func [block] [
[        forall block [if new-line? block [return block]]
[        none
[    ]
== func [block][forall block [if new-line? block [return block]] none]
red>> pos: find-new-line blk
== [
    it has two lines of text each having a different number of words
]
red>> pt-1: copy/part blk pos
== [Suppose we have a block and]
red>> pt-2: copy pos
== [
    it has two lines of text each having a different number of words
]

I have a few other line marker related funcs, though they haven't seen much use.
06:16
find-new-line: func [block] [
    forall block [if new-line? block [return block]]
    none
]
06:17Another possible case for split to handle.
Mufferaw
06:27@greggirwin Thanks!
dsgeyser
08:02Interesting ideas at worrydream.com/LearnableProgramming/
dockimbel
08:47@dsgeyser Bret Victor's work is well-known, you should watch its famous [Inventing on Principles](https://www.youtube.com/watch?v=PUv66718DII) video.
dsgeyser
09:21@dockimbel Do you think it is possible to enable visualization of data in Redbol, it being a messaging/data language?
dockimbel
10:01@dsgeyser Could you elaborate on "enable visualization of data"?
greggirwin
15:42@dsgeyser, visualizing with Red should be easier than almost any other heterogeneous type of data, whether as pure data (e.g. graphs and charts) or in the context of programming.
dsgeyser
16:27@greggirwin I am finding it hard to express to Doc the intention, but I see you have understood it. Is it possible to make a visual representation of the data and see it change over time with typical feedback of what is actually being computed at that instance. Maybe create an object of the data to serve that purpose. I can't imagine a better subject than Red to make this possible.
greggirwin
16:35There are all kinds of data. In this case, I assumed you meant "application state" based on the Bret Victor link. Since Red is data, it's easy to do this kind of thing. Doc's live-coding example, extended by Didier, shows how easy this is. And it was short work to add "time travel" to my port of the micro-Paint app from R2. Even the little *-lab apps that have been done are steps in this direction.
dsgeyser
16:36They say that GUI design is the hardest part of software development. Still unchanged since the Mac introduced the concepts. Teaching Red to the next generation in the best possible way will probably ensure widespread use.
greggirwin
16:38My current feeling is that the hardest part of software development is balancing change and patience.
dsgeyser
16:39@greggirwin What about program flow as well?
greggirwin
16:48Well, we make some things--most things--harder than they need to be. Some problems *are* hard, and some programs *will be* complex, but the vast majority of things we write shouldn't be. This is where languages targeted at application domains (DSLs) can help. But they are not required to be very, very specific. DSLs with a wider scope are not "wrong" in any way, and mapping languages would make an interesting visualization. What were they designed for? What are they really used for? If we zoom out to view languages by primary paradigm, are there some that aid program flow, if program flow is the hard part? Do others make GUIs easy if that's your main hurdle?
dsgeyser
16:48Wouldn't Red's freeform nature hinder most of the things Bret demonstated in the videos, or make difficult/impossible? Abstraction?
greggirwin
16:48I haven't re-read the article yet. Can you give me an example?
16:51These are great things to think about. As Mr. Victor points out, we often solve the wrong problem, or create something that doesn't address the problem at all, but sounds like it does.
16:56Considering program flow, is there a "best way" to do that? Is it the same for functional, OO, or imperative, or dataflow models? Is immutable data the answer? Should we all be starting with FSMs and STTs? Formal methods? It's a spectrum, and every combination of program, team, environment, and requirements has a different answer. I guess that's the other "hardest part" of software development. :^)
dsgeyser
17:00Isn't doc mostly leaning towards dataflow model, seeing that it simplifies design and changes?
17:06I found the Livecode environment to be very helpful and easy to manage code. But its OO based. Whats your view on OOP?
greggirwin
17:07Only he can say. My view is that Red has a core strength in language construction, but is otherwise paradigm agnostic. And when I say "language construction", I don't mean just at the level of DSLs, or even GPLs, but in building the language you use to implement your program. This manifests itself very clearly sometimes, where parse is leveraged for all kinds of processing you might not initially consider it for.
17:12I did OOP for quite a number of years. I'm older, and perhaps jaded or cynical now, but let's call me pragmatic instead. Tools are tools are tools. Some are perfectly suited for one task, but totally inappropriate for others. There is no silver bullet.

Let me ask this: If you could have only one tool, and it was designed to do one thing really well, what would you want that one thing to be?
dsgeyser
17:26Red being so flexible and with nearly endless capabilities, I think a tool that provides me with introspection into the code and allows me to decompose/recompose code to effectively explore all the possibilities. And allow me to go back and forth, kind of like a learning tool. The console provides some of that, but it is limiting. Somewhat like when a writer faces a blank piece of paper.
greggirwin
17:29Do you think you (or someone) can build the tool you want with Red?
17:30And the console is, very much, a blank piece of paper. :^)
dsgeyser
17:45I believe it is possible. I wouldn't mind if its loose standing code providing essential ways to streamline code development.
17:48but I get sidetracked because of limitations in inspecting for instance the state and flow. I guess no real meaningful conversation in the console.
17:54Hence the visual representation of data, which would a good indication of where you are and possible ways to continue. I don't mind playing, but that could also be disruptive.
greggirwin
17:54Red is a tool for building tools. Remember that it's just the raw language right now. There is little shiny tooling yet as the priority is to make Red self-hosting (and also what investors require).
18:06Coming back to change and patience, a lot of these things sound good, and demo well, but all the modern things I've seen have been toys and experiments, largely based on Bret Victor's inspiration. What we don't know (I'd love to see things) is how they work in practice. Like Mr. Victor, I'm a huge fan of Logo and Papert's work. Specialized languages (e.g. Processing, Mathematica) and frameworks (e.g. for audio software development and plug-ins) are proven. This comes back to domain specificity. That we can do easily. To emulate his active drawing/livecode is just treating your script as data and using do/next (basically). Generalizing this is much harder, and where the Eve/spreadsheet/dataflow model comes in.
dsgeyser
18:37Is there a difference between Red and Smalltalk objects, seeing that both are messaging languages?
greggirwin
20:43Yes, quite different. In Smalltalk you send messages to objects. Red objects are basically a way to group words in a shared context. "Messaging" means something very different in Red. It relates to the exchange of information between people and machines.

TimeSlip
03:43Is there a keyword in the red header that I can set to name the compiled output file? I like to use "." in the actual filename but then the compiler just uses the first part of the name.
dockimbel
03:59@TimeSlip Have you tried using the -o command-line option?
TimeSlip
04:00ah, of course not Doc. :-) Thanks
04:20@dander Thanks. As Doc suggested: Red -o nameofprogram.exe -c sourcedoc.red
Works like a charm!
Rebol2Red
13:29I don't understand what collect/keep does.
parse "first second third" [thru "first " copy second to " third"]
print second
second: parse "first second third" [collect ["first " keep to " third"]]
print second

Why/when use collect/keep?
pekr
13:39Anything you mark for a keep, gets added to the end result
Rebol2Red
13:44Thanks, is there some documentation on it?
pekr
13:44http://www.red-lang.org/2013/11/041-introducing-parse.html
13:46If you would run in a loop and would like to get a result, you could as well use some code like (append result parse-var), or you just use keep marker and it adds to the resulting block ...
13:46It is mostly a helper, you don't need to use it necessarily ...
Rebol2Red
13:50I understand your explanation better than the documentation which i red a while ago. Thanks again.

TimeSlip
00:55Is there a way to set panels so that they don't have a space/y pad and butt up against each other?

view/no-wait layout [  
	space 0x-2 
	panel  [ 
		space 0x-2 
 		p1: panel aqua [
 			p1a: panel white [ 
 				space 0x-2 
 				t1: text "hello" 
 				button "hi" [] 
 			] 
 		return 
 		p2: panel red  [
 			pi2: panel blue [ 
 				space 10x-2 
 				text "here is"  
 				return 
 				button "world" [] 
 			] 
 		]
 	] 
 	]	 
] 
center-face pi2 p2  
do-events
greggirwin
05:43Origin

view/no-wait layout [  
	space 0x0
	panel  [ 
		space 0x0
		origin 0x0
		p1: panel aqua [
			origin 0x0
			p1a: panel white [ 
				origin 0x0
				space 0x0
				t1: text "hello" 
				button "hi" [] 
			]
			return 
			p2: panel red  [
				origin 0x0
				pi2: panel blue [ 
					origin 0x0
					space 0x0
					text "here is"  
					return 
					button "world" [] 
				]
			]
		]
	]     
] 
center-face pi2 p2  
do-events
DideC
09:59I miss the tight R2 VID keyword. Having to set origin 0x0 in all subpanels is boring.
dockimbel
11:07@DideC Agreed, it would be a useful addition. You are welcome to push a PR for it, or open a wish ticket.
DideC
11:15Yes, but it belongs in general to the "words for a specific style" thing, not just tight. So extending per style VID dialect (in fetch-options).
I would also like a way to extend default VID dialect without having to patch it (in layout).
TimeSlip
14:20@greggirwin Ah, thanks. But of course, right?
geekyi
15:56@DideC so view/tight is only for top level container..
Mufferaw
16:28I have a block with a bunch of floats! that I want to pass to a routine, but in the routine, how can I access the values in that block?
Rebol2Red
16:45@Mufferaw You mean something like this?
test: func [
	block [series!]
][
	foreach item block [
		print item * 2 ; do something with each item
	]
]
block: [2.3 4.6 7.8 3.1 8.7 12.3 10.2]
test block
Mufferaw
16:51@Rebol2Red No, I am trying to pass the red block to a red/system routine and I don't know how to access the things in the block. I searched github but couldn't find anything, I'm not even sure it's possible
Rebol2Red
16:55Sorry, i thought you asked about a function (in some basic language routines are called functions, that's why)
Mufferaw
16:56@Rebol2Red I appreciate the reply, I should've worded my question a little better.
geekyi
16:57@Mufferaw some code might have helped?
16:58I also want to get started with red/system, and build some getting started tutorials, etc
16:59For those cases where the official reference is not enough
Mufferaw
17:09Here is what I'm trying to do
convert: routine[
	ob [block!]
	ob-len[integer!]
	/local len i s
][
       ob ; ????
]

Sblock: [10.0 0.0 0.0 -1.0 2.0 1.0 0.2 0.2 0.0 10.0 0.0 0.0 -1.0 1.0 1.0 0.2 0.2 0.0]
convert Sblock length? Sblock
rebolek
18:15@Mufferaw it’s possible, but not trivial. You have to pass red values with red- prefix (so as red-block!) and then use R/S functions defined in %red/runtime/datatypes/block.reds to work with that block.
Mufferaw
18:20@rebolek thanks, I'm taking a look at that now
greggirwin
18:20Routine handles that automatically, but I had the same thought Bolek.
rebolek
18:24Yeah, routine may handle passing red values without prefix automatically, I may be wrong here, I haven’t worked with R/S recently.
greggirwin
18:25I haven't done much with routines either, but this works.
convert: routine [
	ob [block!]
	ob-len [integer!]
	return: [integer!]
	/local len i size
][
	size: block/rs-length? ob
	return size
]

Sblock: [10.0 0.0 0.0 -1.0 2.0 1.0 0.2 0.2 0.0 10.0 0.0 0.0 -1.0 1.0 1.0 0.2 0.2 0.0]
print convert Sblock length? Sblock
Mufferaw
18:31@greggirwin @rebolek I don't need to do anything too fancy with the block, my main goal is just to send the floats to my routine but the number of floats may change, so I thought I could use block!
greggirwin
19:55You can, of course. Check out how natives are implemented that work against blocks. It's just a bit of effort. What is the reason for using a routine, as opposed to straight Red? Or is it just to learn how?

dockimbel
03:21@Mufferaw Here is something to help you get started:
convert: routine[
    ob [block!]
    ob-len[integer!]
    /local len i s value tail fl
][
	value: block/rs-head ob
	tail:  block/rs-tail ob
	
	while [value < tail][
		fl: as red-float! value
		probe fl/value
		value: value + 1
	]
]
Mufferaw
04:30@dockimbel Thanks, that's got me pointed in the right direction
04:35@greggirwin for my 'learning exercise' I wrote a raytracer program in red/system, now I've made a GUI for it which has a 'scene' input area (that's why I had all those questions about parse earlier). The next step is to send the data from the gui to the red/system routines .
04:54@dockimbel It works now, thanks again, here is the updated function
convert: routine[
    ob [block!]
    ob-len[integer!]
    /local len i s value tail fl head
][
	
		s: GET_BUFFER (ob)
		
		head:  s/offset
		value: head
		tail:  s/tail

    while [value < tail][
        fl: as red-float! value
        probe fl/value
        value: value + 1
    ]
]
dockimbel
04:56@Mufferaw You're welcome. Right, that's the optimized way to extract the beginning and end of the block. ;-)

WiseGenius
03:33When using call, how does one specify the working directory? change-dir doesn't seem to affect it.
qtxie
03:43@WiseGenius It should be affected by change-dir, Which OS are you using?
WiseGenius
03:44XP. Let me try again, in case I made a mistake.
03:56@qtxie Don't worry. It was a stupid bug in my code. In one of the places, I had change-dir: instead of change-dir, haha!
dsgeyser
15:14What is "operator overloading " in Red terms? An example is most welcome.
greggirwin
18:03Answered in red/welcome.

maximvl
14:50fyi: Elm's type system doesn't allow one to make a select: https://medium.com/@boxed/a-small-dive-into-and-rejection-of-elm-8217fd5da235#.tj6koq1cs
dockimbel
15:09@maximvl I read it this morning. Seems like it was Elm's bashing day, there was another article on /r/programming also against Elm.
maximvl
15:19@dockimbel heh, it's interesting how people start using type systems to get some help from computer, but end up limiting themselves
geekyi
20:35http://softwareengineering.stackexchange.com/questions/335504/why-do-languages-require-parenthesis-around-expressions-when-used-with-if-and
20:37Can't help but notice the rebol family is a good answer for that..
greggirwin
22:44Others are similar, requiring a block for the condition handler.
TomGrey303
22:50Hi, just started with Red - Can someone tell me how to call an exe from Red script. I'm using windows 10 - I did try an example from here: https://github.com/red/red/wiki/Reference-Call - but with no luck.
qtxie
22:54@TomGrey303 What error message you got?
TomGrey303
23:01Compilation Error: undefined symbol: red/binary/rs-insert *** in function: exec/system-call/inset-string *** at line 121 *** near: [binary/rs-insert as red-binary! str 0 data/buffer data/count - I used the #include %system/library/call/call.red before compilling
qtxie
23:04@TomGrey303 Try release mode (add -r):
C:\Red>red.exe -r -c tests\console-call.red
TomGrey303
23:05@qtxie thanks will try now
23:23@qtxie Many thanks - looks like that was it.

meijeru
21:16How do you test if a bitset value contains at least one bit that is set? I tried not empty? but that is forbidden.
geekyi
22:11@meijeru somewhat convoluted:
test1: make bitset! {test}
test2: make bitset! length? test1
not test2 = test1

Rebol2Red
10:45While creating dynamic buttons, i need to know which button is clicked
block: 				copy []
number-of-buttons: 	10
fontsize: 			50
buttonsize: 		100x70
repeat i number-of-buttons [
	s: to string! i
	append block [button buttonsize font-size fontsize]
	append block s
	append block [[print "clicked"]] ; need to know which one is clicked
]
probe block
view layout block ; post-processing with layout
rebolek
11:04@Rebol2Red You have face object available. That should be enough IMO. But if it’s not, set something in extra.
11:04Something like: view layout [button extra 'my-button [probe face/extra]]
Rebol2Red
11:46@rebolek I don't get it. Where does extra fit in?
rebolek
11:49@Rebol2Red let me rewrite your example...
Rebol2Red
11:50Please do!
rebolek
11:52For example:

block:                 copy []
number-of-buttons:     10
fontsize:             50
buttonsize:         100x70
repeat i number-of-buttons [
    append block compose [
    	button buttonsize font-size fontsize extra (i) (form i) [print ["clicked" face/extra]]
    ]
]
probe block
view layout block ; post-processing with layout
Rebol2Red
12:08Maybe i should refrase myself: Is extra a keyword or something you can add to an object or ...?
rebolek
12:09@Rebol2Red extra is part of face! definition (try red>> ? face!) that can be used for storing user data.
12:09To use extra in VID, you write extra keyword, followed by some value.
Rebol2Red
12:11Now i get it, thanks for explaining!
wolframkriesing
13:00@rebolek cool articles! keep it up, fun to read and learning red by applying them. My daily dose of Red :)
rebolek
13:11@wolframkriesing Thanks! I am glad you find it helpful!
13:12But daily dose...I don’t think I can write one every day ;)
wolframkriesing
13:12LOL there is enough to learn and to play with, already in those two articles
13:13I found the rebol articles always a bit hard to read, I prefer your style :)
maximvl
13:13are you talking about this one http://redlanguageblog.blogspot.co.uk/ ?
rebolek
13:13@maximvl http://red.qyz.cz/code-is-data.html
maximvl
13:13oh nice, I missed this one
wolframkriesing
13:13and http://rebol.qyz.cz/subdom/red/safe-and-persistent-locals.html
maximvl
13:13thanks
rebolek
13:14Here is list of them http://red.qyz.cz/
13:14Hm, I probably should make it bit nicer ;)
maximvl
13:15@rebolek do you run it on redbol backend?
rebolek
13:16@maximvl No, not yet. It runs on Apache server that has R3 CGI support, but these are static pages, so no Redbol is used.
maximvl
13:21since we have stdin/out I think it is possible to use CGI
rebolek
13:25That’s possible. I haven’t tried it, I do not want to spent much time messing with web right now.
Rebol2Red
14:08Warning: Maybe a silly question ahead :)

I want seven images on a row with a text below it (3 times)
like this :

i01 i02 i03 i04 i05 i06 i07
t01 t02 t03 t04 t05 t06 t07

i08 i09 i10 i11 i12 i13 i14
t08 t09 t10 t11 t12 t13 t14

i15 i16 i17 i18 i19 i20 i21
t15 t16 t17 t18 t19 t20 t21

i stands for image, t stands for text (formatting is lost during posting)

I have this code:
block: copy []
append block [size 800x600]
repeat i 21 [
	t: rejoin["t" i]
	append block compose [
		image 50x50 text (t)
	]
] 
probe block
view block


What can be done? (I prefer the 'easy' way)

I thought about:

Use a group-box:
But then i can't use return in it to put the text below the picture
Return is not allowed in a group-box block
Is there any way to put the text below the image inside a group-box?

Use 2 loops:
I could place the images and text at a fixed place but the code would
be 'ugly' and not 'dynamic'

Let an expert show me how (Think it comes down to this :) )
DideC
14:58Use panel maybe :
block: copy []
append block [size 800x600 below]
repeat j 3 [
    append block reduce ['panel sub: copy [origin 0x0 below]]
    repeat i 7 [
        t: rejoin["t" i]
        append sub compose [
            image 50x50 text (t) return
        ]
    ]
]
probe block
view block
Rebol2Red
15:09Yep that's it, thanks again
Maybe someone knows a version (maybe using group-box) without the 2 loops?
15:31If someone is interested
Here is a version of the code from DideC with the addition of returning the clicked image as a pair
block: copy []
append block [size 800x600 below]
repeat j 3 [
    append block reduce ['panel sub: copy [origin 0x0 below]]
    repeat i 7 [
        t: rejoin["t" j "," i]
        append sub compose [
            image 50x50 extra (as-pair j i) [print ["clicked" face/extra]] text (t)  return
        ]
    ]
]
;probe block
view block
maximvl
16:13@Rebol2Red could you show screenshot of the result? I don't have windows to test right now :)
Rebol2Red
19:14Is there a simple way to share a link or an image directly?

Because of murphy's law i can't:
Drag the screenshot onto this, gives an upload error
Can't share it with google drive despite the tutorial to do this
Uploaded to my ftp server but can't access it

It was too big to drag onto here, hope it isn't too small now :)
19:18[![screenshot.jpg](https://files.gitter.im/red/help/xJUg/thumb/screenshot.jpg)](https://files.gitter.im/red/help/xJUg/screenshot.jpg)
rebolek
19:23@Rebol2Red I use http://imgur.com for sharing images
Rebol2Red
19:25[![Knipsel.jpg](https://files.gitter.im/red/help/Cx4g/thumb/Knipsel.jpg)](https://files.gitter.im/red/help/Cx4g/Knipsel.jpg)
fergus4
23:46I did not know this room existed. Gitter not good at making available rooms visible.

dockimbel
04:41@fergus4 See https://github.com/red/red/wiki/Gitter-Room-Index
RiVeND
11:44@dockimbel One room listed in there no longer appears to exist: red/red/char-datatype
matrixbot
16:07irx @fergus4 and there is https://gitter.im/red which will send you to the listing of all red rooms.
PeterWAWood
23:50@RiVeND Thanks. I removed the link.

geekyi
10:23irx which client are you using?
matrixbot
13:55irx @geekyi, I'm using gitter bridged into matrix and then the matrix client. Mostly riot android, sometimes riot.im/develop web-client.
13:57irx It's great for reading (except edited posts are hard to read this way). It's not so great to post.

geekyi
10:00irx thanks! Will try it out, I need an alternative when gitter.im is down for me. ISP still recovering from the recent dns attacks
10:00It's much better today tho
10:04@Rebol2Red so the error was due to your
> i can't:
Drag the screenshot onto this, gives an upload error
It was too big to drag onto here, hope it isn't too small now :)
10:05image being too big?
10:06I found http://getgreenshot.org/ , pretty lightweight and featureful

Rebol2Red
19:55@geekyi The image was my desktop size 1640x1050 , after resizing it , i was able to drag&drop it here.
I just don't know right away after which size it works (Think it was 800x600, but i am not sure).
Just do a little trial and error if you have to upload an image here.

TomGrey303
01:39Hi, im pretty new to red - Is there any info on the Red compile switches, not sure if thats the correct term - I mean, i understand -c and -t but there's more -r - are there any docs on this ?
rebolek
01:39@TomGrey303 see https://github.com/red/red/
01:40search for options
TomGrey303
01:50I looked there but nothing explains it to me - '-c' means compile. Then '-c -t windows' means compile to windows, but whats the rest for ? - just struggling here a bit.
rebolek
01:52@TomGrey303 I don’t understand, all the options are explained there. For example:
-r, --no-runtime               : Do not include runtime during Red/System
                                 source compilation.
TomGrey303
01:53sorry will look again
rebolek
01:53It’s about in the half of the page.
TomGrey303
02:00@rebolek Ah, got it. many thanks for your help
rebolek
02:00You’re welcome.

gearss
12:14how can I install Red on my android phone?
WiseGenius
14:40@gearss Someone correct me if I'm wrong, but if you know how to compile Red from source, you could theoretically cross-compile the Red interpreter as I compiled hello.red in my similar question [here](http://stackoverflow.com/questions/24360991/how-do-i-run-an-android-app-ive-written-in-red), and then follow the answers there, especially the top 2, to get it working on Android.
I haven't tried it for the Red interpreter, but it worked for hello.red. I haven't done it in a long time, and Red has been worked on a lot since then, so there's a small chance that the Android part might not work anymore. Someone else might know, or you could just try it. It won't take long.
Have you compiled Red from source before? It isn't hard.
geekyi
19:24@donaldtsang can you post a concrete example. Here or SO
DonaldTsang
19:25@geekyi So basically in Python, there are different byte encodings (bytes, also used for binary data and file blobs) and one singular universal character set/string (str)
19:26@geekyi the Most common Unicode encoding scheme is UTF8 and UTF16
geekyi
19:28@DonaldTsang yes, in Python3 (to be specific) I recall you have fixed length bytes and the string type is unicode, utf-8
19:28(I've not really had a *need* for unicode encoding other than utf-8)
DonaldTsang
19:31@geekyi No, in Python3 string is universal and count by the character (and other diacritics etc.) while bytes can represent UTF8, UTF16, file data or other "byte-like" things
19:32@geekyi there is a function that convert string into bytes by encoding systems
geekyi
19:33@DonaldTsang Er.. I thought that was what I said :D SO you want to convert from one code point into another?
19:34More specifically, you want to work with text encodings, rather than binary data?
DonaldTsang
19:36@geekyi No, string uses code points or "characters" (which transcends binary data) while bytes represents binary data. I use bytes for texts sometimes and read/write files other times...
19:37But lets focus on the text part of the equation
geekyi
19:37IMHO, for text, there's little reason to not use anything other than UTF-8 these days
DonaldTsang
19:38@geekyi but compatibility with HTML+CSS+JS is important (they use UTF16)
geekyi
19:38But if you want to work with other encodings, I don't know. Might have to write that part yourself
19:39@DonaldTsang Don't they ~~all~~ mostly use UTF-8
19:39I think I get what you are trying to say..
19:41> @geekyi No, string uses code points or "characters" (which transcends binary data) while bytes represents binary data. I use bytes for texts sometimes and read/write files other times...
FYI, never disagreed with string being a text type with virtual encodings
DonaldTsang
19:42@geekyi when you convert from UTF8 to UTF16, or other common encodings like Big5/GB/JIS, you need to convert bytes to strings and then back to bytes
geekyi
19:47
HTML+CSS+JS is important (they use UTF16)

UTF16 is used internally for performance right?>
19:51@DonaldTsang are you talking about [this](https://news.ycombinator.com/item?id=3906590)
19:52>pervasiveness of JavaScript means that UTF-16 interoperability will be needed as least as long as the Web is alive. JavaScript strings are fundamentally UTF-16. This is why we've tentatively decided to go with UTF-16 in Servo (the experimental browser engine) -- converting to UTF-8 every time text needed to go through the layout engine would kill us in benchmarks.
For new APIs in which legacy interoperability isn't needed, I completely approve of this document.
DonaldTsang
19:58@geekyi I think so
geekyi
20:15@gearss btw, I've also tried what @WiseGenius has done, but the whole console instead.. didn't work because red requires libcurl on linux then. SHould try again sometime
DonaldTsang
20:17@geekyi So basically code point count vs byte count
geekyi
20:21@DonaldTsang basically, if you are just trying to count code points vs bytes length? works on binary! and string!. I think then you might need a custom UTF-16 type
20:21Gonna retire now

iceflow19
06:57@DonaldTsang Are you looking for something along these lines: https://gist.github.com/iceflow19/f7d31ef5890f9d16e737e89086294bee

Rebol2Red
20:06Can i get the name of the script while executing it?
Rebol2: print system/options/script
Red returns none
20:45Can someone explains this?
I read 159 times a plain text file which is 4,66MB
After 41 percent of reading i get an out of memory error?
Looks like reading takes many more memory than expected, about 3 to 4 times

[![memory.jpg](https://files.gitter.im/red/help/n4ry/thumb/memory.jpg)](https://files.gitter.im/red/help/n4ry/memory.jpg)
21:04Memory = Geheugen
Available = Beschikbaar
In use = In gebruik
21:15Correction:
It is not at 41 percent when i get the error but at 25.78 percent
After reading 41 times 4,66 MB (after reading 191MB) so the used memory is a lot more than 3 to 4 times. See the gigantic spike.
21:32I wonder if there is a way to clear the memory after reading and processing a file?
rebolek
21:33@Rebol2Red not yet, you have to wait for garbage collector.
Rebol2Red
21:36@rebolek Do you have any idea how long this would take, because i now get the idea i have more problems which might be related to this problem.
geekyi
21:38@Rebol2Red is it reading that causes the spike?
21:39:point_up: [November 21, 2016 1:45 AM](https://gitter.im/red/help?at=58320b6ab563b5516c4436b8) can you paste a gist?
rebolek
21:39@Rebol2Red simple GC should be there in 0.6.4. See https://trello.com/b/FlQ6pzdB/red-tasks-overview
Rebol2Red
21:49@geekyi What else can it be? The code is on the left side of the screenshot.
You mean paste the code over here?
view [
	button "start" [
		repeat i 159 [
			p/data: (i / 159.0)
			p/data: to percent! p/data
			read %bookmarks.txt ; size is 4,66MB
		]
		t/text: "Ready"
	]
	t: text font-size 20 " "
	p: progress data 0.0
]

The bookmarks.txt is just a long plain txt file with links and descriptions in it.
geekyi
21:49@Rebol2Red Yeah thanks
Rebol2Red
21:52Just a small sample of the bookmarks.txt
Acer Store Europe
http://go.acer.com/?id=14428
Acer Store US
http://us-store.acer.com/
Amazon
http://www.amazon.com/?force-full-site=1
Artificial Intelligence - Chapter 2 Notes - Computer Science Now
http://www.comsci.us/ai/notes/chap02.html
Back2BASIC - B2B Code Show
http://back2basic.phatcode.net/?Issue_%235:B2B_Code_Show
Back2BASIC - B2B Code Show: Polyplotter
http://back2basic.phatcode.net/?Issue_%237:B2B_Code_Show%3A_Polyplotter
BBC
http://www.bbc.co.uk
Beyond The Cosmos Quantum Mechanics - YouTube

Ofcourse i would'nt read this file 159 times, but is was just a test to see if i could read
long files 159 times, which i have to do for my bookmarksextractor program.
geekyi
22:01[![image.png](https://files.gitter.im/red/help/bPga/thumb/image.png)](https://files.gitter.im/red/help/bPga/image.png)
22:02@Rebol2Red I changed the read line to
read/binary %red-061.exe ; size is <1MB ;P
Rebol2Red
22:03Is this a workaround or my bad or...?
geekyi
22:04I don't see that much of an increase there, ~164MB as you can see, which is expected.. haven't tried plain text file yet
22:04@Rebol2Red At least a workaround I hope ;-)
Rebol2Red
22:16@geekyi Yep, this works, but now i have the problem that i can't directly use the parse command on the binary data.
I'll first have to make strings from the binary data and then do the parsing on it, which takes ... time.
I do'nt read plain txt files but html files which must be parsed.
geekyi
22:20[![image.png](https://files.gitter.im/red/help/qDX9/thumb/image.png)](https://files.gitter.im/red/help/qDX9/image.png)
22:21Yeah, with plain text.. 3x as much memory.. with your sample text copied as many times to make size ~3.94MB
22:23:point_up: [November 21, 2016 1:45 AM](https://gitter.im/red/help?at=58320b6ab563b5516c4436b8) from this it appears much larger tho.. ?
Rebol2Red
22:25@geekyi I suppose you have much more memory than this "old" pc which has 4G
I use windows 10. Which version are you using?
geekyi
22:25Ok.. read/lines crashes it for me
22:25Win 10 64bit
22:26With read/lines, there's a huge 771mb spike like your graph
22:27[![image.png](https://files.gitter.im/red/help/sj7u/thumb/image.png)](https://files.gitter.im/red/help/sj7u/image.png)
Rebol2Red
22:28@geekyi Strange, i can't explain why my computer behaves different. Maybe because you have more memory free?
geekyi
22:29Maybe.. but it shouldn't?
22:30Do you have any other code in that file?
Rebol2Red
22:32@geekyi I think i have a reason why.
I only have 112 MB free on my harddrive. Maybe Red writes to the drive while reading?
And yes i have other code i shall test it in another file. I'll be back soon.
geekyi
22:33Yeah, maybe swap:
22:34[![image.png](https://files.gitter.im/red/help/tjI1/thumb/image.png)](https://files.gitter.im/red/help/tjI1/image.png)
22:40read/lines/part/seek %file.txt chunk offset might help
22:40Maybe without the /lines
22:41@Rebol2Red gonna go now, hope it helps!
Rebol2Red
22:42@geekyi Alright, thanks. I'll hope to find the solution and will post it here when i find one.
geekyi
22:44:point_up: [November 21, 2016 3:32 AM](https://gitter.im/red/help?at=5832247023ce1ae73c0701c0) @Rebol2Red red itself doesn't write, maybe your OS writes swap.. still a bit strange.. I'm using red-20nov16-88de5e0
22:46Also [process hacker](http://processhacker.sourceforge.net/downloads.php) is real nice for debugging on windows
Rebol2Red
22:46@geekyi I use the same version 20-11-2016. I'll look into process hacker.

Rebol2Red
00:10@geekyi Can it be Red is handling some bytes in the file not right so it keeps on reading?
Maybe some invalid utf-8?
That could be the reason why read/binary works well.
But then again, you mentioned a spike too with read/lines
I'll give up on this. Never ever had problems reading files with Freebasic.
I have tested it with a simular program in Freebasic and the memory it used is steady at 0.5 MB even while displaying every line in the file.
I could ofcourse read the files with Freebasic and process it with Red but i like to do all things in one program.
qtxie
02:13@Rebol2Red If the text contains non-ascii characters, reading as string will take memory 2 ~ 5 times larger than the original file size.
02:19Here explains how does red string handle unicode: http://www.red-lang.org/2012/09/plan-for-unicode-support.html
Rebol2Red
09:17@qtxie @geekyi
Now i get it.
Why didn't i thought of that before!
I thought there was something wrong with my computer.
So the solution is to write the file as latin-1 (ISO-8859) instead of utf-16?
Or maybe better to read the file directly in latin-1. (not implemented yet?)
Maybe a hint howto read directly? (I could use a online convertor for writing)
read/lines/as %bookmarks.txt 'latin-1 
*** Internal Error: reserved for future use (or not yet implemented)
*** Where: read
10:04
view [
	button "start" [
		repeat i 159 [
			p/data: (i / 159.0)
			w: read/lines %testing.red ; change to an existing (small) file!
		]
		t/text: "Ready"
	]
	t: text font-size 20 " "
	p: progress data 0.0
]

If i use this script i get the text "Ready" way before reaching 100%.
Am i doing things wrong (or how can i "synchronise" this)?
endo64
10:30Just set p/data: 1.0 before t/text: "Ready"
Rebol2Red
10:39@endo64 That does'nt work (at least not over here).
I was using a small file and a "small" loop, but even when using a large loop and p/data: 1.0 the text shows up way earlier.
10:59
view [
	button "start" [
		repeat i 2259 [
			p/data: (i / 2259.0)
			w: read/lines %testing.red 
 ; change to an existing (small) file!
		]
		p/data: 1.0 
		t/text: "Ready"
	]
	t: text font-size 20 " "
	p: progress data 0.0
]

At about 30 percent the text shows up

note:
In fact i am using the above script as the test file.

Is there a way to get the name of a running script?
so i do'nt have to ask someone who test it to change the name of the file.
That way people are more willing to test them.

Rebol2: print system/options/script
Red: print system/options/script returns none
qtxie
13:01@Rebol2Red
13:01> If i use this script i get the text "Ready" way before reaching 100%.
13:02It's caused by the animation of the progressbar on Windows.
13:02There is a hack to turn off it, maybe we should turn it off?
13:07@Rebol2Red Another issue is the window is frozen after pressing the start button. It can be improved as below:
view [
    button "start" [
        repeat i 159 [
            p/data: (i / 159.0)
            wait 0.1
            loop 5 [do-events/no-wait]       ;-- let the View engine to process some events
        ]
        t/text: "Ready"
    ]
    t: text font-size 20 " "
    p: progress data 0.0
]
Rebol2Red
17:33@qtxie Thanks. Just a little bit earlier before reaching 100% which is fine by me.
I did not have an issue of a frozen window after pressing the start button.
Maybe because of the windows version? I am using windows 10
18:02@qtxie
This will show at exactly the right time but then the progress is going from 30 directly to 100%
Now i would like to ask if wait depends on the speed of the computer?
view [
	button "start" [
		repeat i 2259 [
			p/data: (i / 2259.0)
			w: read/lines %testing.red ; change to an existing (small) file!
		]
		wait 0.1
        loop 5 [do-events/no-wait]       ;-- let the View engine to process some events
		t/text: "Ready"
	]
	t: text font-size 20 " "
	p: progress data 0.0
]

rebolek
18:04Is it possible to use wait in event code? I haven’t experimented with it yet, it was big no-no in Rebol, AFAIR.
greggirwin
18:05I think it's still a no-no.
rebolek
18:07@Rebol2Red I would move your code to on-time event.
greggirwin
18:07No fault of Red. Just a side effect of being in an event loop and being single threaded. And I don't think we want to head down the path of multithreading for event handlers.

Bolek +1. I suggested that earlier as well.
rebolek
18:08@greggirwin Oh, good. I haven’t watched the discussion closely, sorry.
greggirwin
18:08NP, I feel validated now. :^)
Rebol2Red
18:09@rebolek How does on-time works, i mean when does the on-time event occurs?
Can i have multiple on-time events?
rebolek
18:10@Rebol2Red if by multiple you mean multiple faces, each with its own on-time, then yes
Rebol2Red
18:11You mean i can use hidden faces?
rebolek
18:11You have to set rate for face and then it starts to processs on-time events.
greggirwin
18:11
view [
    button rate 1 on-time [print ["Not a click!" now/time]]
]
rebolek
18:11@Rebol2Red Every face can have it’s on rate, so also 0x0 sized faces, why not.
18:12@greggirwin Thanks for nice example. @Rebol2Red for something more complicated, see http://www.red-lang.org/2016/07/eve-style-clock-demo-in-red-livecoded.html
greggirwin
18:12@Rebol2Red, if you want different intervals on a single face's timer, you need to manage that yourself. Just set a higher rate, check modulos, etc.
Rebol2Red
18:13Nice, multple timers!
greggirwin
18:17I imagine we'll see higher level timer functionality, as Nenad and Gabriele built a nice timer system for R2.
rebolek
18:18Yes, it’s nice to have. I think that for GUI animations it’s better to have just one dispatcher that takes care of all animations, but that’s fairly easy to write.
greggirwin
18:20Yes, different purposes benefit from different models. Gabriele's timers and Nenad's scheduler are really nice for cron type work.
18:40@dockimbel, I don't see info in the macro execution context currently, but is there a plan for including current file and line info? Just curious.
Rebol2Red
18:50@rebolek "I would move your code to on-time event"
Problems:
Rate can't be set to zero so how to start the on-time event with a button?
Reading of files would be done in the on-time event so there will be some waisted time.
rebolek
18:52@Rebol2Red
> how to start the on-time event with a button

x: base on-time [...]; anim here
button "start" [x/rate: 10]
button "stop" [x/rate: none]
Rebol2Red
18:56@rebolek Great, What about the waisted time? Will there even be waisted time i wonder?
rebolek
18:59@Rebol2Red what do you mean by wasted time?
Rebol2Red
19:01If on-time events go at a specified rate then the reading of files will also be at that rate?
i: 1
view [
    at 0x0
	x: base hidden on-time [
		either i <= 15 [
			w: read/lines %testing.red 
; change to an existing (small) file!
			prin i print { }  ; show it is working
			i: i + 1
			p/data: (i / 15.0)
		][
			t/text: "Ready"
		]
	]; anim here
	button "start" [x/rate: 10]
	button "stop" [x/rate: none]

    t: text font-size 20 " "
    p: progress data 0.0
]

It looks like the reading will finish between the events but i want to be sure
greggirwin
20:47Reading a file is synchronus, so timer events will be blocked while you read.

qtxie
00:06@Rebol2Red I use wait 0.1 to simulate read ... in your code, you don't need to use wait. Also you should put do-event ... inside your repeat loop.
dockimbel
09:42@greggirwin
> @dockimbel, I don't see info in the macro execution context currently, but is there a plan for including current file and line info? Just curious.

If you think about reflection, we could add the current filename in the execution context. For the line info, that is not possible as the macros are evaluated *after* LOAD.
Rebol2Red
11:16"Is there a way to get the name of a running script?" was not a good question
I could have found the answer when i looked at the documentation on red-lang.org
Anyway, in case someone wants to know:
scriptname-as-file: 	to file! system/options/args
scriptname-as-string: 	to string! system/options/args
probe scriptname-as-file
probe scriptname-as-string

Note: I do'nt know how to get this compiled
rebolek
12:09@fergus4 hello
fergus4
12:25Typo on my phone...could not delete
meijeru
12:43@Rebol2Red system/options/args is of type string!, so to string! is not needed in your example. Moreover, to file! can be replaced by as file!.
12:55One should also add to-rebol-file in order to change the \into / (at least on Windows).
maximvl
12:56@meijeru name is very misleading =)
12:57to-unix-path is how I would name it
meijeru
13:11Correction: I should of course have written to-red-file. Furthermore, Red uses /as separator for path elements, just like Unix, so to-red-file is correct and OS-independent. The converse is called to-local-file, which generates the OS-dependent form.
greggirwin
16:39> If you think about reflection, we could add the current filename in the execution context. For the line info, that is not possible as the macros are evaluated after LOAD.

Thanks @dockimbel. We could probably do something like "near" in errors. Tooling could do more from there.

justinthesmith
08:08How do I convert binary numbers to integers? In Rebol it's as simple as
to-integer #{B79CE5D3}
== 3080512979
rebolek
08:11@jthsmith If you look at https://github.com/red/red/blob/master/docs/conversion-matrix.xlsx for binary!->integer!, it says *base 16 binary as integer*. So expect it in next release.
Rebol2Red
08:12@meijeru @maximvl
If i post code over here i don't do optimization, documentation and error checking (just the bare minimal code, no "fancy" stuff to distract or confuse the reader). I will leave all other things to the reader. He/she will stumbles upon the errors and in the process will learn how to avoid them. In a real program it's a different story. I think this is not the place for real programs (gists would be better). Only if code is plain wrong i would mention this, otherwise it might scare people off to show their code. I hope this is not the way this community will go. Do'nt get me wrong, i appreciate any comments on my code!
rebolek
08:12There has been a lot of work on make/to conversions in recent days, so latest version may have it already.
justinthesmith
08:19Wow thanks for the quick and helpful reply. Just tried the latest build and sure 'nough it works:
red>> to-integer #{B79CE5D3}
== -1214454317

In fact it works better than Rebol 3 in correctly handling the negative (R2 works correctly as well). Thanks!
rebolek
08:20@jthsmith You’re welcome. If you have any other questions, feel free to ask!
Rebol2Red
08:30@rebolek +1 That's my point. Feel free to ask!
justinthesmith
08:35Suppose I want to copy the first 4 bits of a binary string to convert to integer. This works:
red>> to integer! to binary! parse #{B79CE5D3ABCD} [collect [4 [keep skip]] to end]
== -1214454317

But it's not exactly elegant, 2 manual type conversions--collect returns a block of integers. Any suggestions for just copying out the 4-part sequence directly as a binary? Something like:
parse #{B79CE5D3ABCD} [copy number 4 bits to end]


rebolek
08:454 bits or bytes?
08:48If you mean bytes, it’s easy. collect collects to block by default, but you can provide you own word to change behavior:
red>> number: #{}
== #{}
red>> parse #{B79CE5D3ABCD} [collect into number [4 [keep skip]] to end]
== true
red>> number
== #{B79CE5D3}


or you can grab it directly:

red>> parse #{B79CE5D3ABCD} [copy number 4 skip to end]
== true
red>> number
== #{B79CE5D3}
justinthesmith
09:01Ah that does it, thanks again!
Rebol2Red
09:07Maybe something more general?
mid: func [s start len][copy/part at s start len] ; like basic's midstring
print to integer! mid #{B79CE5D3ABCD} 1 4 ; mid string start length
justinthesmith
09:11That's cool. But in my case I need to copy the bytes after a specific sequence instead of starting at a set position:
parse contents [thru #{030623E593} copy number 4 skip to end]

Probably not worth generalizing.
Rebol2Red
09:13@jthsmith Fine by me. Maybe you have some use for it.
09:29@jthsmith I do not know if "Fine by me" sounds harsh (it might be)? If so, it was not my intention, English is not my native language.
justinthesmith
09:35No worries, appreciate the help!
Rebol2Red
10:58@rebolek I wanted to have a look at your gitter script. Can you tell me how to get a token?
I don't know what to do on https://developer.gitter.im/apps
In your program i tried rebol2red as token but that's not right.
rebolek
11:01@Rebol2Red press [Sign in] button in top-right corner.
11:01You will see "token" followed by long hexadecimal value.
11:03The master branch is pretty old now, I do the development in stylize branch. Once @dockimbel accepts my stylize PR, I will merge the changes back to master.
Rebol2Red
11:04@rebolek Copying and pasting the code is'nt working *** Syntax Error: invalid integer! at "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
rebolek
11:05Hm, let me try it...
11:08@Rebol2Red let’s move to https://gitter.im/red-gitter/Lobby please.

dander
05:40I was playing around with the macros from the [documentation examples](https://github.com/red/docs/blob/master/preprocessor.md#expand-directives) and had a couple questions. When inside expand-directives, if there is an error, the red console exits. Is that expected behavior, bug, or just not implemented yet?

This is from the documentation:
λ red --cli
--== Red 0.6.1 ==--
Type HELP for starting information.

red>> about
Red 0.6.1 - 28-Nov-2016/16:46:05-8:00
red>> expand-directives [print #either config/OS = 'Windows ["Windows"]["Unix"]]
*** Preprocessor Error in #either
*** Script Error: path config/OS is not valid for none! type
*** Where: ???
λ $LASTEXITCODE
0


I think it was meant to be this:
red>> expand-directives [print #either system/platform = 'Windows ["Windows"]["Unix"]]
== [print "Windows"]

RiVeND
12:01@dander @dockimbel Looks like a regression.
12:04
red>> about
Red 0.6.1 - 22-Nov-2016/14:35:39
red>> expand-directives [print #either config/OS = 'Windows ["Windows"]["Unix"]]
== [print "Windows"]
red>> about
Red 0.6.1 - 29-Nov-2016/11:59:47
red>> expand-directives [print #either config/OS = 'Windows ["Windows"]["Unix"]]
*** Preprocessor Error in #either 
*** Script Error: path config/OS is not valid for none! type
*** Where: ???
(halted)

geekyi
15:33Halfway writing this, I realized you were talking about something else and @RiVeND misunderstood the original problem, like me
(you can see in @RiVeND version that console doesn't exit but prints (halted))
>@RiVeND @dander the red console exiting feels like the saner behavior for me. At least in that particular case. Wouldn't doing otherwise lead to hard to find bugs?
In your particular example, I can't understand why it does that

RiVeND
11:34@geekyi Hah, yes! Note to self, read things properly before commenting!
dockimbel
16:00@dander @RiVeND Thanks for the report (noticed only today). I've pushed a fix for it.
geekyi
16:03@dockimbel Eh.. https://github.com/red/red/commit/49c6bb26bf306035a2859a1c142d6c3b98971acd was the actual fix for this problem. You fixed something else! :smile:
dockimbel
16:36@geekyi There were two different issues in the same error case.

TimeSlip
00:37Hello, I was just wondering about the Android state of affairs. Is there a general, "this will work" and "this won't" ? My guess is the VID doesn't at this point but I'd love to be wrong about that.
geekyi
07:49@TimeSlip I've not been able to run the red binary on Android because it requires libcurl. Haven't found an easy way to install it. You might be able to hack around by commenting out the include in simple.io L1670 ? Also haven't tried out the android branch yet, which produces an apk I think

meijeru
11:12How does one compare c-strings in Red/System? The following does NOT work (see issue #2369):

s: "abc"
if s = "def" [print "hoopla"]

rebolek
11:12@meijeru char by char IMO
11:13@meijeru https://github.com/rebolek/user.reds/blob/master/user.reds#L238
dockimbel
11:14I think we don't have any function for that in the Red or R/S runtimes (not needed internally). You can write your own function or import one of the C lib functions (like strcmp() or the safer strncmp()).
meijeru
11:16OK if that is what it takes. But instead of the compiler internal error on naive comparison one should have a warning...
dockimbel
11:16You can open a ticket for signaling that internal error, that should not happen.
rebolek
11:17@meijeru see above link, I already wrote such function
meijeru
13:09Thanks both @rebolek @dockimbel I did the ticket.
geekyi
22:33@rebolek that looks like a useful set of functions! Wished I'd seen them sooner. There is a problem of discoverability right now. Been thinking of making something like a package manager / searcher
rebolek
22:55@geekyi Thanks! I believe these functions are very useful, but I use Red now, so I haven’t updated my Red/System stuff in a while.
Anyway, I understand your desire for some package manager but I would definitely wait for modules in Red. If you want improve discoverability, do some simple web page/db with links. The data are always more important, code can be always build on top of them later.
geekyi
23:29@rebolek it's automating the collection of data I'm thinking of. I think it is orthogonal to having modules in red.
Right now, code is in various places; in gists and github repos.
Most of the useful info is (or should be) stored in the Red headers. But I don't know of any conventions or standards on this. I guess you can say I'm still a bit new.
23:31What I'm thinking is http://www.rebol.org/ for red, but decentralized (with a local cache)
[METADATA.jl](https://github.com/JuliaLang/METADATA.jl) for the Julia programming is a good example I think
Basically, it's like a dump of RED[] header data. But I guess much simpler in this case
23:34The basic structure is a folder with package name, url for updates and a folder for each version. Data in each version folder is just a list of dependencies and sha1. Such a file for red can include even more info
23:42*tl;dr* As an example, for the [Plots](https://github.com/JuliaLang/METADATA.jl/tree/metadata-v2/Plots) package, the structure is:
Plots: [
  versions: [
    0.0.1: [
      requires: [dependencies list of packages]
      sha1
    ]
  ...
  ]
  url : git://github.com/tbreloff/Plots.jl.git
]
23:49Actually, I've only rarely used rebol.org; sometimes for searching. If it had a better interface like a package manager, I might use it more
rebolek
23:52@geekyi header is probably the most underestimated thing
23:53it could be so powerful, when used correctly
geekyi
23:54Indeed. If anyone has a workflow/standard for searching/building packages (especially on rebol.org) that would be very helpful for me
23:55Rebol.org and github are the sites where I've found most of the code. So if I can search those 2, I guess that would give the majority of what I want
23:56If I have that, then I can build on that layer some other ideas I have
23:58@rebolek can I put gritter as a the first test package? ;)

rebolek
00:01@geekyi of course! gritter is free to use, it would be public domain,if public domain was not banned in certain countries like germany
00:07but i recommend using the *stylize* branch, that’s where the development is going on. let’s hope @dockimbel will accept stylize pull request soon, so i can merge the improvements into master
greggirwin
17:30@geekyi , the devil is in the details and the design. We probably all agree that it will be useful, and important, but someone either needs to make a well-thought-out proposal or wait for one. A long time ago, I did extensive research on various meta info and formats for projects, and still have my notes somewhere.

DideC
14:13@geekyi for Rebol.org, [the Librarian](http://www.rebol.org/download-librarian.r) is not far to be a package manager ;-)

geekyi
01:43Thanks. That is awesome! I wish it cached the index instead of doing it every time I started it tho
01:50Oh ok, I spoke too soon. It's a binary pack of all the scripts. Should have read the instructions properly too

DideC
09:33@geekyi Rebol scripts are so small, than it's more usefull to fully include them, than just an index. Bonus : work offline. And the full download is smaller than most of othe language package manager alone :-)
OneArb
18:36Hi,

I am trying to get my first Red GUI script working.

I picked up simple-clock.red trying to do live coding with fields.

How to set facets to execute?
[(panel-background)]

How to set fields to execute?
I'd have expected [ok] to do something.

Is using origin optimal?

Can I define ok: and panel-background: within the react facet?

Thanks


Red [
]

ok: [ button 100x33 "Ok"]

field-demo: {
    
 text bold font-size 10 55x20 [(panel-background)]
	 center "Name"
 field 80x20 "Enter Name"

 origin 0x50
 Button 100x33 "Ok"

 origin 0x100
 text font-size 10 bold "Keep me"
 radio "Public"
 radio "Private"
}

system/view/silent?: yes

panel-background: maroon

view [
	title "Text entry"
	backdrop panel-background
	across
	
	source: area #13181E 410x300 no-border field-demo font [
		name: "Consolas"
		size: 9
		color: hex-to-rgb #9EBACB
	]
	
	panel 400x300 panel-background react [
		attempt/safer [face/pane: layout/tight/only load source/text]
	]
]
geekyi
19:08@OneArb so many questions! :p I think asking each on stackoverflow and linking here is better
greggirwin
19:09@OneArb, I suggest building some simple GUIs that don't involve live coding if you're new to Red and it's GUI system. Can you build the GUI you want directly? I'm not sure what you mean by "set field/facet to execute", and [ok] isn't used anywhere that I see, so I'm not sure what you tried with it. Also not sure how origin can be optimal or not.
OneArb
19:45Hi and thanks!

Live adding fields or screen composition is the specific feature I need and the reason I am considering Red.

[ok] won't display when added to field-demo

Is there a way to refresh the panel? When reducing the size of a button part of the resized button drawing remains on the screen.

In the same spirit I wrote the following code in Rebol which still runs in Red

Red[]

Result: "Test"

field1.Process: [
			alert join  "You typed: " 
			Result: field1/text
			]

field1.Initialize: [do [field1/text: Result]]

field1.Declare: compose/deep [
		field1: field
		[(field1.Process)]
		(field1.Initialize)
	]

block: 	compose [ 
			(field1.Declare)
			field
			field
		]

view layout (block)

Any solution?

Thanks
19:55@geekyi I'll try that
geekyi
19:56@OneArb btw, I feel you are diving too fast into this. It's better to spend some time learning and reading a bit of rebol
OneArb
20:10 @greggirwin I like Red/Rebol ability to scafold code at run time.

When I include or type [ok] in field-demo: I expect the code [ button 100x33 "Ok"]to run and a new button with these facets to be displayed in panel due to the react function.

I ran into the same issue in Rebol. In

field1.Declare: compose/deep [
        field1: field
        [(field1.Process)]
        (field1.Initialize)
    ]

[(field1.Process)] works with brackets and parenthesis, (field1.Initialize)works fine with parenthesis only. I am trying to figure out the consistency of "code composition".

21:08Refresh fails with panel-background: "#2C3339" works with
panel-background:black.

Opened a ticket.
greggirwin
21:39Start by taking out the live-coding aspect, even if you want that eventually. Also take out reactivity. If you create a static layout using your definition for ok and making field-demo a block instead of a string you load, does it work how you expect?

Origin is not for positioning individual items. Use at for that. And you shouldn't need to set a precise offset for everything. Use across and below, space and let VID align things for you as much as possible.
OneArb
22:06@geekyi @greggirwin FYI The preceding code attempts to use Red/Rebol as a template language and manage code using code inserts, in particular segregate all data from the code.

HostileFork made extensive comments on it on Stackoverflow code review.

https://codereview.stackexchange.com/questions/53794/rebol-view-layout-compose-seek-minima-notation

I'll read it in more details. Boils down to writing my own compose function, if I get it right.
geekyi
22:12@OneArb wait, asked 2 years ago??
OneArb
22:14@geekyi what is your question?
geekyi
22:16Oh, just didn't know you had asked the question a long time ago. The first thing I notice is your use of . , it probably doesn't work like you think. You may want / instead
greggirwin
22:19I think that's just @OneArb 's naming convention. Not path access.
OneArb
22:19@greggirwin correct
22:20Good point below, now it comes back :)
geekyi
22:23Yeah, looking at the code, I'm not exactly certain what you were trying to do there.. unusual naming convention kinda tripped me up :p
greggirwin
22:23Me too.
geekyi
22:25Possibly.. you want to compose Rebol code into the view dialect @OneArb ?
OneArb
22:27The GUI is still in Beta? below does not place the fields below
geekyi
22:28@OneArb I'm going to try to answer that question
greggirwin
22:28It does: view [below text "A" field text "B" field]
OneArb
22:30By the way the origin is simple-clock.red from http://www.red-lang.org/2016/07/eve-style-clock-demo-in-red-livecoded.html
22:32I'll try with a structure, good point.
22:41 @greggirwin Thanks for the tips. I know where to look now.

I am trying to make a tiny editor wherein I can add fields live within the text.

The simple way is probably to update the structure then show rather than use react?
geekyi
22:50@OneArb can you post :point_up: [this](https://gitter.im/red/help?at=58597a2ee7bdfe4e297ae9c2) also as a review question and link here?
OneArb
22:53Sure. Since field-demo is a string it makes total sense that [ok] the structure would not display?
22:54Ask a review question where?
geekyi
23:03@OneArb same site as your other question
PeterWAWood
23:19> The GUI is still in Beta? below does not place the fields below

Red is still in Alpha? A Beta release is some way off.

DideC
16:56@OneArb Don't confused "livecoding" and "code generation". Especially in GUI domain.
1) "Livecoding" is for a quick and realtime prototyping of a GUI.
2) "Code generation" can be used for giving some dynamic behaviours to your GUI in the final program.

17:011) "Livecoding" implies rebuilding all graphics objects from scratch at each modification of the VID code. So in an application, it can be problematic if your code refers to graphics objects (ie my-field/text or my-list/data) as contexts will be lost between each GUI rebuilt. You will need to always reduce or compose the code that acces these objects.
It is good for prototyping the VID or Draw code that you will copy to your application script as a base for your application.
maximvl
17:02but if you separate your data from gui it should be fine
greggirwin
20:00> I am trying to make a tiny editor wherein I can add fields live within the text.

@OneArb, being able to generate a GUI from a fixed spec is easy with Red, as the live-coding demos show but, as Didier points out, there are a lot of details that may not work as expected. It makes perfect sense that [ok] will not work as expected inside a string in your live-coding example. *Why* it doesn't work is the reason we suggest building simpler things first, and getting more familiar with when/where/how things are evaluated.
OneArb
23:43@DideC Two livecoding / dynamic screen use-case:

IDE:

I develop using code generation aka template programming since the early 90's.

Positioning fields and other faces by hand (mouse) took me a great amount of time. Once RAD scaffold code, screen design became for certain projects the next bottleneck.

Run time field generation was an option but annoying to manage.

Placing faces on the screen in a livecode setting, I look forward.
I find it intuitive fast and fun, especially when I can develop my own
set of face / facets structure.

Runtime screen customize:

Stakeholders would love reorder field position, sequence order
to match their own workflow/taste? Can Red offer a dynamic experience?

What stands in the way of a persistent context?

OneArb
00:01@maximvl Segregate data is the explore aim of the posted code.

I prefer data, including field description face/facet to be stored managed in a dictionary. A feature that buys WinDev and Clarion data engine independence.

Clarion, last I know, uses a two step generation process:
template language process application description, turns it into code to compile.

Red/Rebol can use a single language.

00:04@greggirwin I did backtrack to get the dynamic face to work. Follows the fixed code. Add compose/deep before load and use (ok)
Red []

ok: [ Button 100x33 "Ok"]

field-demo: {
    
 text maroon yellow bold font-size 10 55x20
    center "Name"

 field 80x20

 origin 0x50
 (ok)
}
 
system/view/silent?: yes

panel-background: black

view [
	title "my text entry"
	backdrop black
	across
  
	source: area #13181E 410x300 no-border field-demo font [
		name: "Consolas"
		size: 9
		color: hex-to-rgb #9EBACB
	]
	
	panel 400x300 panel-background react [
		attempt/safer [face/pane: layout/tight/only compose/deep load source/text]
	]
]
00:15@maximvl Segregate data is the explore aim of the posted code.

field1: field
        [(field1.Process)]
        (field1.Initialize)

field description face/facet feeds from a data dictionary. That feature buys WinDev and Clarion data engine independence.

Clarion, last I know, uses a two step generation process:
template language processes application description (data dictionary, screen design, business code), churns it into code to compile.
geekyi
01:26@OneArb "Talk in forth, you are" -yoda ;P
01:26Did you see my answer to your previous [question](https://codereview.stackexchange.com/questions/53794/rebol-view-layout-compose-seek-minima-notation)?
01:27I'm wondering if it helped
OneArb
17:07@geekyi Forth can seep-into natural language, at times, clarify!

Thanks for [in-depth code review] (https://codereview.stackexchange.com/questions/53794/rebol-view-layout-compose-seek-minima-notation)

The lines between self-documenting code, documentation and screen description remain to be explored.

IDE can feed screen design data and code into your final version code generator example.

Red/Rebol would make a great template language.

I like debug looking at generated code. Editor can feedback code modify into IDE.

I need some time to look into the use case.
greggirwin
17:25Good progress. I believe Red will let you do everything you want. It's just a matter of design now. :^)

GianlucaM95_twitter
10:05Hi everyone! I'm new to Red, I started writing some code on Fedora 23 and everything worked fine, but on Void Linux 64 bit I get this error when I run ./red-061 : symbol lookup error: ~/.red/console-2016-6-30-23134: undefined symbol: dlopen. Am I missing some dependency? glibc-devel-32bit is installed. In my filesystem I have both /usr/include/bits/dlfcn.h and /usr/include/dlfcn.h
rebolek
10:19Ho @GianlucaM95_twitter ! check if you have all the required 32bit libs, the list is here: http://www.red-lang.org/p/download.html

OneArb
00:22Where would I find a VID handler example?

I couldn't find any within VID doc and Github Scripts / showcase.
dander
07:48@OneArb have you seen https://github.com/red/red/blob/master/tests/view-test.red ? It might have some examples that you are looking for.
geekyi
07:48@OneArb not sure what you mean by VID *handler*
OneArb
15:44@geekyi I picked that speak from the doc:

*Event type* click
*Handler* on-click
*Description* Triggered when the user clicks on the button

VID facet handler works for you?
16:53@dander Somewhat

I got as far as field field-data on-enter [field-data: face/text]

What about moving the focus to the next field or face on hitting Enter?

Since I want my default behavior to be on-enter [field-data: face/text] how can I avoid repeat that code for each field?
17:11I'd love to see a basic data processing example showing how all the pieces tie in together.

Within VID Field documentation how would Red describe field-data role within field field-data on-enter [field-data: face/text]?

face/text?
9214
17:14@OneArb I think field-data is text which will be displayed in text field by default, and after you've entered something in that text field and clicked enter, this text will be saved in field-data, though I may be wrong since I haven't test it
OneArb
17:21@9214 Reading the VID documentation, I'd conclude field in VID DSL expects a word! as face/text from reading face/text description "Input text, read/write value."?
9214
17:22@OneArb that what I think too
OneArb
17:27@9214 Would string! symbol be an accurate face/text description?

endo64
07:43> Since I want my default behavior to be on-enter [field-data: face/text] how can I avoid repeat that code for each field?

You can use style for that:
view [
  style my-field: field red on-enter [probe face/text]
  my-field
  my-field
  my-field
]

theopen-institute
10:49Hello, I'm getting unexpected (to me) results with random.
test_random: function [iterations][
	count: 0
	loop iterations [
		if random 1.0 < .20 [count: count + 1]
	]
	print to percent! (to float! count / to float! iterations) 
]

I would expect outputs to cluster around 20%, but no matter what value I use for iterations I get what looks like a normal distribution centered on 50%. What am I doing wrong?
maximvl
11:02@theopen-institute Hi and welcome, the problem in your code is that you calculate random boolean =)
11:02
red>> random 1.0 < .2
== false
red>> random 1.0 < .2
== false
red>> random 1.0 < .2
== true
11:03so Red first calculates < and then random
11:03that's why you get exactly 50%
theopen-institute
11:03oh wow. silly mistake. Thanks!
maximvl
11:04the fix coud be if (random 1.0) < .20 [count: count + 1]
11:04which gives exactly 20% =)
theopen-institute
11:04indeed it does! thanks Maxim
maximvl
11:05general rule as with other languages - use parens if you are not sure about execution order
11:05or try in repl to find out what happens
16:29btw for me this is counter intuitive:
red>> random true
== true
red>> random true
== false
16:30don't you think it would be better to allow datatypes for random? like
red>> random logic!
*** Script Error: random does not allow datatype! for its value argument
*** Where: random
rebolek
16:34It makes sense for logic! that has two values, but what would i.e. random email! do?
maximvl
16:35well, it may make random email address, why not
16:36it makes sense for test purposes
16:36at least
16:37as well as other datatypes: percent, issues, dates etc
16:38in Julia language random method has type Datatype! => A (Datatype!)
16:38so if you want random number you do random(Int64), random date - random(Date)
16:39and you can add your own of course
greggirwin
17:34The help string makes it sound like it could be extended. Each type just needs to be updated. I've always written my own random data generators, and think a dialect for doing so would be the way to go there, so you can specify constraints and such.
OneArb
17:44@endo64 Great got that!
17:50How can I get text-list to refresh once its underlying block as been changed?

I tried show. For now updating the block causes text-list to remove the changed line from text-list facet.


lines: 10
i: 0
block: []

repeat i lines [
  append block append copy "line" i
  ]

text-list-selected: 2

view [  
  below
  field on-enter [ 
    poke block text-list-selected face/data
    probe block
    show tl
  ]
  
  tl: text-list data block
    on-create 
      [ face/selected: text-list-selected ]
    on-change
      [ text-list-selected: face/selected 
        print text-list-selected
      ]
            
  button "Quit" on-click [quit]
]
maximvl
19:24@greggirwin
>think a dialect for doing so would be the way to go there

I think random can become that dialect =)
greggirwin
19:25Except that random on a block! would require a refinement or something, to distinguish it from returning a randomized block.
geekyi
22:06@maximvl @greggirwin I'd always thought a generate function which operates only on datatype!s would be useful as an inverse to parse
22:08Then you would have generate: func [ /random /limits /others] [...]
22:08Would be useful for testing
22:09It would work somewhat like the quickcheck family of testing (smallcheck, parsecheck)
22:09It was an idea I had as part of a versatile test function
greggirwin
23:33Generate. Good name @geekyi.

maximvl
20:33@dockimbel ok, I simplified it a lot, I replaced panel with image, I removed generation of code and blocks allocation, now it just assigns to image directly, I turned off auto-sync
20:33https://gist.github.com/maximvl/81f31f26b49a7a3a5891b9a63f47171a
20:34typing is still quite slow, though image doesn't blink anymore :)
20:37@dockimbel is there anything else I can do before trying R/S? how can I move only the generation part to R/S?

9214
15:20@maximvl :clap:
geekyi
16:07@maximvl wip?
maximvl
16:10@geekyi ?
geekyi
16:10I'm not sure if it works for me
16:10wip aka.. "work in progress?"
16:11may need to update red.. running it in the interpreter btw
maximvl
16:11yes, this is the gui part, I still need to add Forth interpreter there
16:12for now I'm trying to make it less laggy
geekyi
16:13[![image.png](https://files.gitter.im/red/help/mRnF/thumb/image.png)](https://files.gitter.im/red/help/mRnF/image.png)
maximvl
16:13yep, this is it :)
16:15@geekyi if you go here:
http://forthsalon.appspot.com/haiku-editor
enter 0.5 and press two arrows button you will see
geekyi
16:15@maximvl Yeah, I was checking it out and trying to figure out how it works
16:16Wasn't sure if your version was supposed to run red or forth
maximvl
16:16basically it runs your Forth code for each pixel and the output is 4 numbers which result color code for this pixel
16:17so you can get coordinates and use conditionals to draw something
16:17try just x y
16:18@geekyi I want to make version with Forth to explore and practice parse
16:18I want exact same copy
geekyi
16:18Ah, like [shader toy](https://www.shadertoy.com/) but simpler
maximvl
16:19@geekyi here are couple examples of it: http://forthsalon.appspot.com/haiku-list?order=rank
16:20you can also do animations and different stuff
geekyi
16:20and audio too?
16:22wasn't immediately apparent to me how it worked until :point_up: [December 30, 2016 9:16 PM](https://gitter.im/red/help?at=5866886aaf6b364a2911a655)
maximvl
16:23@geekyi there is audio word, so probably yes :)
http://forthsalon.appspot.com/word-view/617564696F
16:29@geekyi shader toy hangs my browser =\
geekyi
16:29:point_left: [December 28, 2016 10:08 PM](https://gitter.im/red/red?at=5863f17fc02c1a3959c0b4cd) so this is where it started
maximvl
16:31oh, yes, I decided to move discussion here, I think this channel is more appropriate
geekyi
16:32yep, it is the best place for it, I'm just concerned the flow of the conversation getting lost, so just documenting it ;p
16:38> @geekyi shader toy hangs my browser =\

yeah, it's pretty processor intensive, the idea is basically the same, but using gpu shaders
16:48[hacker news haiku thread](https://news.ycombinator.com/item?id=8307717)
16:51[audio](http://forthsalon.appspot.com/haiku-view/ahBzfmZvcnRoc2Fsb24taHJkchILEgVIYWlrdRiAgIDA2aiACgw):
: hz pi * 2 * t * sin ;
440 hz
audio
maximvl
16:53cool, maybe we should also go to HN once Red version is complete ;)
geekyi
16:59:+1:
16:59[mouse test](http://forthsalon.appspot.com/haiku-view/ahBzfmZvcnRoc2Fsb24taHJkchILEgVIYWlrdRiAgIDAq5yeCgw) even works as a thumbnail on the home page!
17:32(btw, audio doesn't seem to be supported on firefox)
17:34and this is where I miss factor's functions for collections and high-level programming
greggirwin
21:36Any examples of things you miss @geekyi ?
geekyi
21:38@greggirwin do you remember fry?
21:38Things in factor missing in forth actually

maximvl
14:53there is something strange in bind + reduce combination:
red>> f1: func [x y block /local z] [bind block 'z]
== func [x y block /local z][bind block 'z]
red>> f1 1 2 [x y h]
== [x y h]
red>> reduce f1 1 2 [x y h]
*** Script Error: y is not in the specified context
*** Where: reduce
14:54why does it say y is not in the context?
14:55oh, context got destroyed after func finishes
17:01I started with few simple things in mind, but now I'm already finishing 3rd DSL
17:01Red is something
18:47Added forth interpreter and testing framework:
https://gist.github.com/maximvl/81f31f26b49a7a3a5891b9a63f47171a
18:51Interesting thing is that I can run this script, but can't compile it
18:51
-=== Red Compiler 0.6.1 ===- 

Compiling Z:\home\maxvel\rebol\gui\test.red ...
Compiling libRedRT...
...compilation time : 1877 ms

Compiling to native code...
...compilation time : 52844 ms
...linking time     : 898 ms
...output file size : 792576 bytes
...output file      : Z:\home\maxvel\rebol\libRedRT.dll 

*** Syntax Error: Missing matching ]
*** line: 348
*** at: {[
   stack: copy []
   words: [
      ; }
19:08@greggirwin now it's much more than 100 lines :)