Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
Vladimir Vasilyev
@9214
@toomasv :point_up: you had some really neat reactive solution for one of AoC puzzles, something about conveyors and robots?
DVL333
@DVL333
@nedzadarek
If it were there, I wouldn't ask such questions. ;)
Vladimir Vasilyev
@9214
@DVL333 it constructs a relation, yes, but I doubt that you can delete it without nuking everything with clear-reactions. object creates a copy of a spec block on creation, so original block with a linked reaction cannot be accessed anymore, not even with body-of obj2, as it returns a copy too.
Unless...
>> obj1: make reactor! [a: 1 b: 2]
== make object! [
    a: 1
    b: 2
]
>> obj2: object block: react/later [sum: obj1/a + obj1/b]
== make object! [
    sum: 3
]
>> obj1/a: 100
== 100
>> obj2
== make object! [
    sum: 102
]
>> react/unlink block obj1
== [sum: obj1/a + obj1/b]
>> obj1/a: 1'000
== 1000
>> obj2
== make object! [
    sum: 102
]
Toomas Vooglaid
@toomasv
@9214 Sorry, on the move until tomorrow evening.
Vladimir Vasilyev
@9214
@toomasv np.
Ungaretti
@Ungaretti

This has to be a bug:

Red[]
guess: ask "Enter your expression: "
print guess

Console:

Enter your expression: one
Enter your expression: one
>>

The ask text gets added to the variable (word). This does not happen in Rebol.

Vladimir Vasilyev
@9214
@Ungaretti Red version?
Ungaretti
@Ungaretti
Thanks @9214 .
Gregg Irwin
@greggirwin
We have a page where notes on reactivity can be added: https://github.com/red/red/wiki/%5BDOC%5D-Reactivity
Maciej Łoziński
@loziniak
And https://github.com/red/docs/blob/master/en/reactivity.adoc can also be modified by anyone using a pull request.
BTW would be nice to merge these two pages :-)
Vladimir Vasilyev
@9214
I'd suggest to keep official documentation's quality high and do not do PRs on a whim. If you wish to contribute in a procreative manner, it would be better to share your plan in /docs room first.
Maciej Łoziński
@loziniak
PR can always be rejected / corrected
And if there is a need for a Wiki page, probably official documentation is either incomplete or confusing.
Gregg Irwin
@greggirwin
Wikis and official docs are very different things. We're also working on docs and what each type of doc (reference, spec, tutorial) should contain.
Vladimir Vasilyev
@9214
Brilliant logic, but it's actually the other way around: wiki is there to collect material, with which documentation can then be filled, in a systematic, organized manner.
Gregg Irwin
@greggirwin
But, yes, PRs for docs are welcome.
We'll just be more strict in what we accept there.
Maciej Łoziński
@loziniak
I see. Sorry for putting your system to question, but I personally feel much confusion when learning Red :-)
Gregg Irwin
@greggirwin
Not a problem. We have things to improve.
nedzadarek
@nedzadarek

@9214

wiki is there to collect material, with which documentation can then be filled, in a systematic, organized manner.

That's nice. Someone fluent in English and the Red can transform wikis into "good" docs (grammar, is it easy/confusing to read etc). On other hands wikis can be created without fear.

Gregg Irwin
@greggirwin

wikis can be created without fear.

Exactly.

nedzadarek
@nedzadarek

@9214 if your fields have on-change handler, and if fields and sliders react to each other, then the following scenario occurs: you enter something in a field, it changes value of a slider, which in turn triggers an update in field, which either triggers slider again or remains silent because the actual data hasn't changed. Justs my after-midnight, uneducated guess.

text/field relations are only one-way - only from slider to text/field. I was thinking about this so I'll keep this in mind.

@greggirwin
Thank you. I will look at this.

nedzadarek
@nedzadarek

I have found first problem with sliders. on-change event triggers on any mouse/keyboard up/down:

i: 0 view [slider focus on-change [print face/data print (i: i + 1)]]

Can I set it somehow to detect only actual changes (face/data changed or something like this)? There is all-over to get all events. Maybe there is an equivalent to on-change?
If not I guess my only choice is to check last values to actual values. If they are not equal - trigger the change.

Vladimir Vasilyev
@9214
@nedzadarek ?
view [slider 50% on-up [label/data: face/data] label: field 70]
nedzadarek
@nedzadarek
@9214 I want to see the change instantly - I don't want to wait for user to "unlick"/"unpress" the button.
Vladimir Vasilyev
@9214
@nedzadarek I doubt that all of your color system converters can process the changed data instantly.
Especially when you change slider value multiple times per second.
You don't want on-change, which triggers events as you drag, but then you don't want on-up either, which triggers only one event when user finally changed value.
nedzadarek
@nedzadarek
@9214 With text I can see the result without delay.
Gregg Irwin
@greggirwin
Direct reactions are easy to do, and to understand (generally), but they won't work well in all cases. As things get more complex, using other approaches may work best. e.g. when a change is triggered, set a flag. In a timer event, check that flag, update, and clear the flag. @giesse also built a nice system for R2 that did event compression. Basically, it would remove all intermediate ("unimportant") events in a stream, to reduce processing overhead.
I thinkered with some functional reactive experiments some time back, mainly so we could show people how easy it is to build something like that in Red, but they (especially the real Rx stuff) are not nearly as easy to reason about IMO, or for casual users to understand.
Gabriele Santilli
@giesse
most games have a fixed refresh rate for a reason... :) setting a flag and updating in a timer may be the easiest option. perhaps Red should do something like that automatically (fixed 60hz refresh rate no matter how many times you call show or something like that)
Semseddin Moldibi
@endo64
https://gitter.im/red/help?at=5ba42d97be4f300626c444ce
@greggirwin @9214 If -e puts script source code into executable and interprets, then how it works with #system? Shouldn't it give *** Internal Error: contains Red/System code which requires compilation error?
Vladimir Vasilyev
@9214
@endo64 check out recent discussion in /system room, I left a reference to the original commit.
Semseddin Moldibi
@endo64
@9214 Got it! Thanks!
nedzadarek
@nedzadarek
@giesse @giesse "timer approach" seems to be interesting. I will try it if my approach will not work. Thank you for tips.

are not nearly as easy to reason about IMO, or for casual users to understand.

Can we put relations on a graph? The Racket have been doing this with function dependency (I cannot find screenshot).

Gregg Irwin
@greggirwin
@nedzadarek it should be doable. They are stored in system/reactivity/relations.
Simon
@simonmc_gitlab
hello! Is there some documentation for the modules import system in Red you can point me to? If not, can you tell me where to look in the Red source code to understand how it works? thank you!
Vladimir Vasilyev
@9214
@simonmc_gitlab there's no module system in Red yet, if that's what you're asking.
Simon
@simonmc_gitlab
@9214 you mean that the "needs 'view" we put in the header isn't used by the compiler?
Vladimir Vasilyev
@9214
@simonmc_gitlab it is used to include View module, yes, but it's system-specific. You can't create your own modules until 0.8.0 is here.
Simon
@simonmc_gitlab
@9214 ok I understand, thank you!
PeterWAWood
@PeterWAWood
How do I get a text field to align with a button in VID? Using across middle doesn't seem to be enough.
>> view [
[    across middle
[    button "one"
[    text "two"
[    button "three"
[    ]
Text Not Aligned.png
Vladimir Vasilyev
@9214
@PeterWAWood try center-face.
PeterWAWood
@PeterWAWood
@9214 Thanks for the suggestion. I'm worried about the vertical alignment more than the horizontal.