AltME: REBOL3

Messages

Gregg
Protocols were never completed for R3.

Bo
A long time ago (Sep 2014 I believe), I wrote a question here but never got an answer. I did eventually figure it out, but I recently had to figure it out again, so I'm posting it here for posterity:
Here's the solution when encountering the following:
$ sudo ./r3
sudo: unable to execute ./r3: No such file or directory
ARM devices running 64-bit operating systems don't generally have the 32-bit libraries installed. This can be fixed with the following commands:
sudo dpkg --add-architecture armhf
sudo apt install libc6:armhf libncurses5:armhf libstdc++6:armhf
After installing those libraries, the executable should now run!
A similar procedure can be performed for Intel machines as well by replacing the "armhf" with "i386".

Endo
Thank you for posting this Bo, I had this issue several times and it was diffcult for me to find.

Bo
:-)

GiuseppeC
How could I find the corresponding date for:
"The monday of 2 weeks ago"
"The next sunday"
"The last day of the current/next/prev month ?"
Ashley
The monday of 2 weeks ago ... either now/weekday = 1 [now - 14][now - (6 + now/weekday)]
The next sunday ... either now/weekday = 7 [now + 7][now + (7 - now/weekday)]
The last day of the current/next/prev month ... http://www.rebol.org/view-script.r?script=date-time.r

Gregg
Giuseppe, individual date calcs are relatively easy. Designing a dialect to interpret human expressions of them is more work, though still doable. I have a number of things that do part of it, but no complete, open system I can post.
Watch for boundary issues. Here are a couple helpers that show what I mean.
set 'last-day-of-month func [date /local d] [
    d: date
    d/day: 1
    d/month: d/month + 1
    d: d - 1
    d
]
set 'same-day-next-month func [date /local d] [
    d: date
    d/month: d/month + 1
    if d/day < date/day [d: d - d/day]
    d
]
GiuseppeC
Ashley, how if I need to calculate a generic monday of N weeks AGO
or
sunday of N weeks in the future ?
Gregg
What have you tried so far Giuseppe?
GiuseppeC
I am currently working on it on the consolle
GiuseppeC
dayofweek: 1
date:  either now/weekday = dayofweek [now - (7 * (weeks - 1))] [now - (((7 * (weeks - 1)) - either now/weekday = 1 [now - (7 * (weeks - 1))] [now - (((7 * (weeks - 1)) -  dayofweek) + now/weekday)]
GiuseppeC
Ooops... to many copies
The following code returns the dayofweek of /weeks/ ago
        dayofweek: 1
        weeks: 2
        date: either now/weekday = dayofweek
            [now - (7 * (weeks - 1))]
            [now - (((7 * (weeks - 1)) -  dayofweek) + now/weekday)]
GiuseppeC
Note that this formula is dangerous when you want to filter something from a start to and date because it includes TIME!
now should be changed to now/date
DideC
I have a generic calculation for dates:   date-of-monday: a-date + 1 - a-date/weekday
If you need a sunday, it become:   date-of-sunday: a-date + 7 - a-date/weekday
Then just add or remove (weeks  * 7)

GiuseppeC
Interesting
Arnold
What should same-day-next-month be today?

Gregg
That would be open to interpretation on a day like today. My call, when I wrote that func, was to use the last day of the month, if the next month has less days than the target month.
Alternately, you could throw an error or return none.
Arnold
Yes depends on what you want it to be.

Last message posted 164 weeks ago.