Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
NjinN
@NjinN
And what happens when i just type +: :add twice
Vladimir Vasilyev
@9214
You just do the same redefinition two times, and this action, apparently, does not rely on +.
*: :multiply, for example, seems to be harmless.
NjinN
@NjinN
It seems to be harmless, but causes trouble......
Gregg Irwin
@greggirwin
It would be good to see exactly why it's crashing, and catch that in a nicer way. We can also doc that ops are usually made from funcs, to give them infix form.
Novvorto
@novvorto_twitter
Red [needs: 'view]
view [
    f1: field
    button 
        "Evaluate" 
        [
            view [text f1/text]
        ]
    button 
        "Quit" 
        [quit]
]

produces this error message:
Script Error: VID - invalid syntax at: [f1/text] Where: do
Stack: view do-events do-actor do-safe view layout cause-error Script Error: head does not allow none! for its series argument
Where: head Stack: view do-events do-actor do-safe error? do-actor do-safe eval-set-path

Whereas this works:

Red [needs: 'view]
view [
    f1: field
    button 
        "Evaluate" 
        [
            x: f1/text
            view [text x]
        ]
    button 
        "Quit" 
        [quit]
]

I am using red-25oct18-12ad56be.exe.

Is this by design? If it is, what is the purpose?
Boleslav Březovský
@rebolek
You can't use paths as arguments, only words. I don't think it's by design, more like not implemented yet.
Rudolf Meijer
@meijeru
In general, such problems can be solved by inserting compose and putting the information that is to be computed in a paren. In fact, the automatic evaluation of single words is a convenience to save having to write (x).
Semseddin Moldibi
@endo64
view compose [text (f1/text)]or view [text with [text: f1/text]] would also work.
I also would like to see that paths are supported.
Simon
@simonmc_gitlab
hello! is there an equivalent for the Rebol dt function in Red? I'm trying to load a 40MB file that contains a block! without success. I would like to graph the loading time for a sample of files of different size to understand the limits of the Red loader. thank you!
Semseddin Moldibi
@endo64
dt is a very simple function, you can copy/paste from Rebol to Red.
But loading 40MB might not work on Red yet. If it is not mandatory to load, try read and then parse (or read/lines and foreach)
Boleslav Březovský
@rebolek

@simonmc_gitlab

without success

What does it mean? Is there an error, crash, ...?

Simon
@simonmc_gitlab
@endo64 Good idea! Thanks a lot, I don't know why I did not think of that. I will use read -> parse as you suggest
@rebolek the console crashes, it uses over 1.5G and then the console silently crashes
Boleslav Březovský
@rebolek
@simonmc_gitlab I see. I know that problem :(
Simon
@simonmc_gitlab
@rebolek It's ok, for now the workaround of @endo64 is good, thank you :)
Boleslav Březovský
@rebolek
ok
nedzadarek
@nedzadarek
When I was playing with the draw: https://gist.github.com/nedzadarek/836adb9fc20c1e2cb1dce6436133a4ab
I wanted to ask few questions about draw (especially for @toomasv as you are writing a lot vid code):
1) When people post some draw code they don't use set-words (e.g. view [base draw [b: box 2x2 3x3 ] on-up [b/2: b/2 + 1]] but they uses face/draw/N(e.g. view [base draw [box 2x2 3x3 ] on-up [face/draw/2: face/draw/2 + 1]]). Is there a reason for this?
2) We cannot put set-words between elements' arguments (e.g. b1: box pos-start: 2x2 pos-end: 3x3 is not possible). They disallow this because it's just easier to parse (draw) or is there another reason?
Toomas Vooglaid
@toomasv
@nedzadarek About (1) I don't think there are any rules for this. It is matter of personal preferences and your application logic. IMO in some cases it is easier to use set-words (I have heavily relied on these) than positional references on other cases vice versa.
About (2) I think the answer lies here
lepinekong
@lepinekong_twitter
@simonmc_gitlab I found red has improved over rebol as for the number of variables: I didn't reach yet the limit. As for processing large amount of data rebol has never been very scalable and performant. I'm thinking about mixing powershell with red.
Nenad Rakocevic
@dockimbel

@simonmc_gitlab

hello! is there an equivalent for the Rebol dt function in Red? I'm trying to load a 40MB file that contains a block! without success. I would like to graph the loading time for a sample of files of different size to understand the limits of the Red loader. thank you!

Does it load with Rebol2?
If yes, how much memory does it use in Rebol?
Could you provide us with a copy of that file for testing?

GiuseppeChillemi
@GiuseppeChillemi
I wish to store some common functions in external files to be laoded from multiple script.
Which is the correct way of doing this ?
READ and then DO passing arguments (if needed) ? LOAD and then DO passing arguments (if needed) ?
Boleslav Březovský
@rebolek
why not do %script.red
GiuseppeChillemi
@GiuseppeChillemi
@rebolek I wish to store functions which needs to be used often. So loading in memory is needed
Boleslav Březovský
@rebolek
@GiuseppeChillemi if you do script, it is of course loaded in memory.
GiuseppeChillemi
@GiuseppeChillemi
@rebolek but using again the function you are adding to your code needs reloading and I would like to not load it again for the second time as some code needs speed !. File content would be something like:
myfunc: funct  [a b] [print [a + b]]
So myfunct is added to the main code
Boleslav Březovský
@rebolek

@GiuseppeChillemi if you have file that looks like:

Red[]
myfunc: func [x y][x + y]

and then do it in another file:

do %myscript.red

Then you can use myfunc, %myscript.red gets loaded only once.

GiuseppeChillemi
@GiuseppeChillemi
Ok, thanks. Are there any other tecniques for creating code libraries on disk ?
GiuseppeChillemi
@GiuseppeChillemi
This question has been triggered from Rebol load documentation where I have read
"/next - Load the next value only. Return block with value and new position."
So I have imagined many things like having the code ID as first paraneter...
*parameter and you could "select" It by ID
nedzadarek
@nedzadarek
@GiuseppeChillemi
:point_up: 26 października 2018 23:29
They are making "library system".
@toomasv I see, thank you.
Gregg Irwin
@greggirwin
@GiuseppeChillemi just use do or #include for now, and don't sweat it. If you have hard numbers about it being too slow, we can look at the exact use case and make better suggestions.
Toomas Vooglaid
@toomasv
@nedzadarek You are welcome! E.g. if you insert dynamically elements to draw-block or reorder elements in it, then it may be preferable to use set-words, because elements’ indexes are changing. Otherwise you have to find element’s index each time you need to change it.
GiuseppeChillemi
@GiuseppeChillemi

@nedzadarek

@GiuseppeChillemi
:point_up: 26 października 2018 23:29
They are making "library system".
@toomasv I see, thank you.

Pardon me, I have not understood whatg you are comminicatingoto me.

@greggirwin

@GiuseppeChillemi just use do or #include for now, and don't sweat it. If you have hard numbers about it being too slow, we can look at the exact use case and make better suggestions.

I will use "DO" but, why are you discarding "load" from your suggestion ?

Boleslav Březovský
@rebolek
It's an extra step. do will load for you automatically.
nedzadarek
@nedzadarek
@GiuseppeChillemi as for now, you can do/load/read your files (sorry if I forgot about something). The Red programmers want to extend loading and executing extra (e.g. in other files) code with new features. You may check main website for this news.
nedzadarek
@nedzadarek
@toomasv but where it is preferable to to use face/draw/...? I guess when you are changing whole draw block: view [base draw [d:] on-down [face/draw: reduce ['ellipse event/offset 3x3]]] but you can achieve it with clear/append: view [base draw [d:] on-down [clear d append d reduce ['ellipse event/offset 3x3]]].
Toomas Vooglaid
@toomasv
@nedzadarek But here you don't have positional references! I prefer to use positional references when my draw-block is simple and stable, and I don't bother to set up context to capture words used in draw-box (or in VID generally), so that they would not leak into global environment.
GiuseppeChillemi
@GiuseppeChillemi
@nedzadarek Is there a something to read about this or these ideas ?
GiuseppeChillemi
@GiuseppeChillemi
@toomasv I have few questions on the AREA face
Is there a way:
to highlight text in 2 areas at the same time ? When one looses focus it returns not highlighted
Is there a way to set the cursor position ?
Is there a way to scroll the text once "appened" to the area and as position a line number to be to the center (or some other position) of the visible area ?
Toomas Vooglaid
@toomasv

@GiuseppeChillemi
1) Selection in two areas:

view [
    a1: area "Some text" 
    a2: area "Other text" 
    button [
        a1/selected: 1x4 
        a2/selected: 1x5
    ]
]

2) Cursor position:

view [
    a1: area "Some text" 
    a2: area "Other text" 
    button [
        a1/selected: 6x5 
        a2/selected: 7x6
    ]
]

Push button, then click either area. Cursor shoud be on the beginning of second word.
3) Centering appended text: I think it is possible, but don't have time now to experiment with it. I just did something lik it with rich-text-box though.
It involves counting lines and skipping around in area's text. First steps:

view [
    a1: area "Some^/text^/more" below 
    button "Head" [a1/text: head a1/text] 
    button "Tail" [a1/text: find/last/tail a1/text "^/"]
]
Toomas Vooglaid
@toomasv

More on double selection:

sel: func [f t][
    as-pair i: index? find f/text t i - 1 + length? t
] 
view [
    a1: area "Some text other" 
    a2: area "Other text some" 
    below 
    fld: field "text" 
    button "Select" [
        foreach a reduce [a1 a2][
            a/selected: sel a fld/text
]]]

Try to change word and "Select".

Gregg Irwin
@greggirwin
@GiuseppeChillemi word choice can help express intent, as well as what @rebolek said. If I see do I know that evaluation is intended. If I see load it tells me that it's likely the data is meant to be processed. i.e. do tells me it's code, load hints that it's data.