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
Toomas Vooglaid
@toomasv
> gui-console-ctx/cfg/history
== ["gui-console-ctx/cfg/history" "gui-console-ctx/history" "system/console/history" "...
>> gui-console-ctx/terminal/history
== ["gui-console-ctx/terminal/history" "gui-console-ctx/cfg/history" "gui-console-ctx/...
>> system/console/history
== false
Vladimir Vasilyev
@9214
I believe these are aliases for internal buffer, which you can't modify.
Toomas Vooglaid
@toomasv

@nedzadarek

but every clear / change/part adds something to the history as well.

Nope.

nedzadarek
@nedzadarek
@toomasv you are right, my bad.
@9214 then type, for example, 42 + enter in the console.
Vladimir Vasilyev
@9214
>> any reduce [gui-console-ctx/cfg/history system/console/history quote 'disabled]
== disabled
>> 42
== 42
nedzadarek
@nedzadarek
@9214 I mean answer to console: no:
system/console/history: no
42
Vladimir Vasilyev
@9214
I don't follow what you want me to do. All history words are already set to false, that's why any in the example above returns disabled.
lepinekong
@lepinekong_twitter
@toomasv ok thansk for history
nedzadarek
@nedzadarek

@9214 you said:

Though, system/console/history: no doesn't seem to break anything.

You are wrong. As soon as you enter something your console should crash... at least on Red for Windows version 0.6.3 built 26-Mar-2018/1:14:22+02:00.

Vladimir Vasilyev
@9214
If you say so.
>> system/console/history: no
== false
>> 42
== 42
>> about
Red 0.6.3 for Windows built 6-Oct-2018/7:28:28+05:00 commit #dafc828
nedzadarek
@nedzadarek
@9214 good to know that it doesn't cause crash any more. Thank you for this.
nedzadarek
@nedzadarek
How can you add something (e.g. text "1" field "#FF00C8") into one of the tab-panel's panel:
view [
  tabs: tab-panel 400x400 [
     "something" [base red] 
     "dynamic" [
        button "add" [ "some code here" ]
     ]
    ]
]
and I want button to add it after itself.
after 2 clicks on that button should end as:
...
"dynamic" [
   button "add" [ "some code here" ]
   text "1" field "#FF00C8"
   text "2" field "#FF00C8"
]
...
nedzadarek
@nedzadarek

ps. I've tried something like this:

  append/only tabs/pane/(index? find tabs/data "dynamic")/pane [
          text "next color"
]

but it says invalid face type.

Vladimir Vasilyev
@9214
?
view [
  tabs: tab-panel 400x400 [
     "something" [base red] 
     "dynamic" [
        button "add" [append face/parent/pane layout/only [at 100x100 text center middle "yes"]]
     ]
    ]
]
GiuseppeChillemi
@GiuseppeChillemi
Find returns the series at the position of search item, while select returns the ELEMENT after the search item. Is there an istruction to return the POSITION of the ELEMENT after the search item ?
if pos: find series value [pos: next pos]
Something like the code above
nedzadarek
@nedzadarek
@GiuseppeChillemi /tail?
GiuseppeChillemi
@GiuseppeChillemi
@nedzadarek Thanks ! I have not seen it. Tail confuse me with /reverse
nedzadarek
@nedzadarek
find [1 2 3] 2
; == [2 3]
find/tail [1 2 3] 2
; == [3]
well, you can read description (? find)
GiuseppeChillemi
@GiuseppeChillemi
Rearding...
nedzadarek
@nedzadarek
@9214 face's parentand layout/only... I have never thought about it. Thank you.
GiuseppeChillemi
@GiuseppeChillemi

Which is the meaning of maintaining CR in blocks ?

Example:

 a: [aaa
        [ccccc]]

>> append a [bbbb [ccccc]]
== [aaa 
    [ccccc] bbbb [ccccc]]

Are:

[aaa 
    [ccccc] bbbb [ccccc]]

and

[aaa [ccccc] bbbb [ccccc]

The same ?

(Note, for readibility reasons I prefer the former bit I don't know how to add from code in this way)
nedzadarek
@nedzadarek

@GiuseppeChillemi they are the same (unless I don't know something):

a: [a
    b]
;== [a 
 ;   b
;]
aa: [a b]
; == [a b]
a = aa 
; == true

if you want to add newline (I guess that what you mean by CR) then you can just add newline in your code (hit enter):

a: [a]
; == [a]
append a [
    b]
;== [a 
;    b
;]

However certain operations may delete newlines. You can check and set/clear newlines manually using new-line/new-line?:


  arr: [a b c]
; [a b c]
  arr: next arr
; [b c]
  new-line? arr
; false
  new-line arr on ; on = true
; [
;    b c
; ]
  new-line? arr
; true
  head arr
; [a 
;     b c
; ]
GiuseppeChillemi
@GiuseppeChillemi
@nedzadarek so they are totally neutral ? No find/select , etc ?
nedzadarek
@nedzadarek

@GiuseppeChillemi

neutral

Yes, I haven't find any difference.

no find/select

what you mean?

GiuseppeChillemi
@GiuseppeChillemi
Something like Find series newline
nedzadarek
@nedzadarek
@GiuseppeChillemi you can use forall loop:
>> arr: head arr
== [a 
    b c
]
>> forall arr [
[    probe arr
[    print new-line? arr
[    ]
[a 
    b c
]
false
[
    b c
]
true
[c]
false
GiuseppeChillemi
@GiuseppeChillemi
So, forall detects newline and Find and Select do not.
Detects = manage.
While It is trasparent/invisible to Find/select
nedzadarek
@nedzadarek
@GiuseppeChillemi forall doesn't detects anything. It's just a loop that changes position of the series (arr: [1 2 3] > [1 2 3] > [2 3] > ...). new-line? detects new lines.
GiuseppeChillemi
@GiuseppeChillemi
I use the wrong terminology : It does not skip newline
While find/select do skip It.
I am on mobile client for gitter and can't test but Will try "foreach" and lenght? Too.
nedzadarek
@nedzadarek
@GiuseppeChillemi I don't think find/select skip new-line markers on purpose. It's just they are made to do something else. They are made to check values not new-line markers. New-line markers are not "normal values".
foreach won't work because it gives you element of the series. The element doesn't hold information about new-line markers.
GiuseppeChillemi
@GiuseppeChillemi
If lenght? counts new-lines too, I Need to reconsider some routines
nedzadarek
@nedzadarek
@GiuseppeChillemi no, length? doesn't count new lines markers. length? arr; 3
Toomas Vooglaid
@toomasv
@GiuseppeChillemi See also red-by-example
Vladimir Vasilyev
@9214
This markers exist solely for formatting purposes, and do not affect anything except series appearance.
Chris Prinos
@cprinos

how would you store functions in a block/series and then execute them with foreach. I tried various things along the lines of this:

a: function [x] [x + 1]
b: function [x] [x * 2]
c: function [x] [x * x]

funcs: [:a :b :c]

foreach f funcs [ print f 5]

which is printing 'a b c', when I'm trying to get '6 10 25'.

Vladimir Vasilyev
@9214
foreach f reduce funcs ...
Vladimir Vasilyev
@9214
@cprinos you're not storing functions, you're storing get-word!s.
Toomas Vooglaid
@toomasv
@cprinos To store functions: funcs: reduce [:a :b :c].
Palaing
@Palaing

Looking for a way to give a variable as an argument to cd? I try:

dir: %/D/Dropbox/utils
cd :dir

...that does not work: "cd does not allow get-word! for its :dir argument"
Any hint?

Boleslav Březovský
@rebolek
@Palaing use change-dir instead
cd is meant for interactive console sessions