Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 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
Gregg Irwin
@greggirwin
:+1:
nedzadarek
@nedzadarek

@GiuseppeChillemi

is /:ind the same of /(ind) ?

Not exactly. ind in the in the :ind is a word - it is a final value, that you want to look for in the series. (...) is a paren! - you can compute "final value" here. Examples:

arr: [a 11 "b" 22]

ind: 'a
arr/:ind
arr/(ind)
arr/('a)
arr/a

ind: "b"
arr/:ind
arr/(ind)
arr/(back tail "cb")
nedzadarek
@nedzadarek
  • about :ind - I mean word that refers to a final value.
GiuseppeChillemi
@GiuseppeChillemi
@nedzadarek
Some more questions. In RED:
arr: [a 11 "b" 22]
ind: to-lit-word "a"

>> probe arr/:ind
== 11
>> probe arr/(ind)
11
IN REBOL:
>> probe arr/:ind
** Script Error: Invalid path value: a
** Where: halt-view
** Near: probe arr/:ind

>> probe arr/(ind)
11
== 11
nedzadarek
@nedzadarek
@GiuseppeChillemi in the Red, it seems that they added get-word! (:word) select on other values as well.
ps. in the Rebol: arr: [11 22 33] ind: 1 arr/:ind; =11
Vladimir Vasilyev
@9214
@GiuseppeChillemi @nedzadarek get-word! has nothing to do with it
>> block: [a 11 b 22]
== [a 11 b 22]
>> block/(probe quote 'a)
'a
== 11
>> block/(probe to lit-word! "a")
'a
== 11
nedzadarek
@nedzadarek
@9214 I mean get-word! in a path!like <word>/<get-word!> e.g. arr/:ind. I do not mean syntax with a paren!: <word!>/<paren!> e.g. arr/(ind).
And I am not sure how your example relate to the Rebol not being able to get value by <word>/<get-word!> but it can do it with <word!>/<paren!>.
Vladimir Vasilyev
@9214
lit-word! acts as a key selector, not paren! or get-word!, gee.
nedzadarek
@nedzadarek

@9214
1) Both languages can get value based on a number: arr/1.
2) Both languages can get value based on a word: arr/info.
3) Both languages can get value using paren! based on a number/word: arr/(0 + 1), arr/('info).
4) Only the Red can get value based on both a number and a word using get-word!: arr/:w where w is a word or a number.

So based on 3 paren! can acts as numeric/word selector (value from a paren!).
Based on 4 the Rebol has the "problem" with getting value from a get-word!.

In my opinion get-word! is in the centre of the problem.

Vladimir Vasilyev
@9214
@nedzadarek if you'd read original error message more carefully, you'd noticed that get-word! evaluates correctly, but Rebol fails to interpret lit-word! as a valid selector. Red in this case correctly coerces all any-word! values. So, no, problem is not with get-word!, problem is with lit-word! (or any other possible any-word! value) to which it evaluates. Same holds for paren! expressions - they are not selectors, but the result of their evaluation is.
nedzadarek
@nedzadarek

@9214

** Script Error: Invalid path value: a
** Near: probe arr/:ind

Yes, it seems that get-word! evaluates correctly but it seems that we cannot use word! as path's value. "invalid path value: a" - I assume that a is a word! here... but it can be lit-word! as well. In my opinion that error message is not as clean as you said.
Putting that aside, this answer fully explain differences. Thank you for this.

nedzadarek
@nedzadarek

Hmmm... so this is where /same refinement is useful:

arr: [a "word" 'a "lit-word" :a "get-word" a: "set-word"]
select/same arr to-get-word 'a
; == "get-word"

I guess we cannot do this using path!?

Gabriele Santilli
@giesse
@nedzadarek I think you are not reading what @9214 is writing.
REBOL/Core 2.7.6.4.2 (14-Mar-2008)
[...]
>> b: [a 1 b 2 c 3]
== [a 1 b 2 c 3]
>> b/a
== 1
>> x: 'a
== a
>> b/:x
== 1
nedzadarek
@nedzadarek
@giesse but I understand why Red can get value using lit-word! and the Rebol cannot.
Incendi
@Incendi
Hi, is anyone using red 0.6.3 on Ubuntu 18.04?
Boleslav Březovský
@rebolek
@Incendi Hi, I do.
Incendi
@Incendi
Hi, I'm interested in trying a Red but have a libcurl3 dependency issue
I'm sure you had to overcome that?
Boleslav Březovský
@rebolek
@Incendi Yes (I'm on Manjaro now, I have Ubuntu on other computer that I can't access right now, so I have to help you from memory). Do you have 32bit libraries installed, right?
Incendi
@Incendi
No. I don't think so at least because when I try to apt-get install libcurl3:i386 it wants to Uninstall libcurl4 and everything that depends on that :(
Boleslav Březovský
@rebolek
IIRC, just ignore libcurl3 and install libcurl4:i386
Incendi
@Incendi
Doing it. One moment
Brilliant! The Red console is running. Just ran my first line of code in it
Boleslav Březovský
@rebolek
@Incendi :clap: Happy Reducing! If you have any questions feel free to ask!
Incendi
@Incendi
Thank you so much :)
Toomas Vooglaid
@toomasv
How to convert Windows crlf-s into Unix lf-s in a string?
Boleslav Březovský
@rebolek
you can do replace/all
on binary of course
because Red does the conversion automatically based on your platform
replace/all read/binary file crlf lf
Toomas Vooglaid
@toomasv
@rebolek Thanks! My problem is that area/selected seems not to take Win into account, so newlines are counted as two chars.
Boleslav Březovský
@rebolek
@toomasv interesting, I guess it should be reported.
BeardPower
@BeardPower
Ah, that nasty line-ending stuff. I wished there was finally some standard!
Boleslav Březovský
@rebolek
there is. and not only one, you can choose your favorite!
Boleslav Březovský
@rebolek
I don't even have to click on it :D
BeardPower
@BeardPower
Hehe ;-)
Toomas Vooglaid
@toomasv
image.png
nedzadarek
@nedzadarek

How do you deal with time-consuming computation in the gui?

make-random-image: has [img ] [
  img: make image! 200x200 
  forall img [img/1: random 255.255.255] 
  wait 2 img
]
view [i: image [i/image: make-random-image]]

Let's suppose that make-random-image just takes at least 2 seconds to compute. In those 2 seconds I'm left with unresponsive window. Is there anything I can do to make user experience better such in cases?
ps. I know about memoization and I'm not sure if I can translate this part of code to Red/System.

Boleslav Březovský
@rebolek
You can always run another process.
nedzadarek
@nedzadarek
@rebolek from within the Red? How?
Boleslav Březovský
@rebolek
@nedzadarek using call.
  1. start another process using call "red my-heavy-script.red" that will write result to some file
  2. start timer and in on-timecheck periodically if second process finished (result file exists, or something like that)
  3. if it does, stop timer, read the result and present it to the user
nedzadarek
@nedzadarek

if it does, stop timer, read the result and present it to the user

Like this: view [b: base rate 0:0:1 on-time [b/text: to-string now/time] on-up [b/rate: none]]

?
@rebolek
Boleslav Březovský
@rebolek
@nedzadarek yes, that's how you can start and stop the timer. You can put starting in on-up also.
nedzadarek
@nedzadarek
@rebolek I see, thank you.
Boleslav Březovský
@rebolek
you're welcome