Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 01 2018 17:34
    @greggirwin banned @BIjeuca_twitter
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:20
    @PeterWAWood banned @TimeSeriesLord
Vladimir Vasilyev
@9214

not sure what I meant either :D

>> f: func [x][y: 0 y: y + x]
== func [x][y: 0 y: y + x]
>> f 5
== 5
>> body-of :f
== [y: 0 y: y + x]
>> f: func [x][y: [0] y/1: y/1 + x]
== func [x][y: [0] y/1: y/1 + x]
>> f 5
== 5
>> body-of :f
== [y: [5] y/1: y/1 + x]

what if I want y in the first example to be modified as in the second example, only without explicit block wrapping?

I thought that ref! is something like a pointer to series position
reference
Boleslav Březovský
@rebolek
No, probably the name is confusing and should be changed.
Vladimir Vasilyev
@9214
so, ref! is sort of a @9214 mention?
couldn't find any info about this datatype in R3 docs
Boleslav Březovský
@rebolek
@9214 it is not in R3
Vladimir Vasilyev
@9214
another thing that I learned today is that tuple! is not limited in it's length (I thought that it should contain exactly 4 elements)
PeterWAWood
@PeterWAWood

another thing that I learned today is that tuple! is not limited in it's length (I thought that it should contain exactly 4 elements)

tuple! is limited in length.

>> 1.2.3.4.5.6.7.8.9.10.11.12
== 1.2.3.4.5.6.7.8.9.10.11.12
>> 1.2.3.4.5.6.7.8.9.10.11.12.13
*** Syntax Error: invalid tuple! at "1.2.3.4.5.6.7.8.9.10.11.12.13"
*** Where: do
*** Stack: load
Vladimir Vasilyev
@9214
@PeterWAWood thanks, my bad, I stopped at 10th :D
and minimum length is 3, otherwise it's a float!
Toomas Vooglaid
@toomasv
It doesn't accept devil's dozen :imp:
PeterWAWood
@PeterWAWood
A baker's dozen in England 🥐
Petr Krenzelok
@pekr
ref!leads ppl to think it is a pointer oriented datatype. I can simply imagine it being named name! or label!
btw - as for a pointer stuff, isn't there a handle!datatype for that?
Gregg Irwin
@greggirwin

The ref! name was discussed quite heavily at one point, on atlme too, but is not finalized. We also have tuple! with a different meaning than in other languages. What we need to do is ask: "What is the main purpose of this datatype? What does it represent?" People new to Red have a lot of concepts to learn, and old habits and ideas to un-learn.

I'm short on time, but will try to write up thoughts in the future. But ref! values aren't just for human handles in chat (e.g. @pekr). They could be used to refer to locations in code, as in a cross-reference, a specific message in a chat, a point in time, etc. That is, it refers to something. And since Red has no concept of a pointer, though R/S does, there shouldn't be much confusion after initial exposure.

GiuseppeChillemi
@GiuseppeChillemi
@dockimbel
I have worked on the "there is no spoon" problem and while it seems I have understood the "code is data"/"data is code" paradigm, I have ended up in a problem:
Please look at this code:
GiuseppeChillemi
@GiuseppeChillemi
print-it: func [/local str] [
    str: ""
    insert str "ha"
    print ["First STR" str]
    str: ""
    print ["Secnd STR" str]
    Clear STR
    print ["Clear STR" str]
]
New users head "explodes" while thinking that "STR" as the second "str" let us think the first one is being reset and referenc to the value of the rist one lost.
GiuseppeChillemi
@GiuseppeChillemi
What confuses more, and I am talking of personal experience, is the fact this kind of code works flawlessy in the main code body as if you do not repeat it in a loop, each time you start the script REDBOL programs seems behave like other programming languages
Only inside a loop, when the first STR and its next VALUE is referenced for the second time you will discover it is "ah" and then "ahah" and then "ahahah" at the third round.
GiuseppeChillemi
@GiuseppeChillemi
In other programming languages STR: "ah" and STR: "" change the value of the variable with a CLEAR and SET TO a value which is independend from the position of the code. While in REDBOL languages the position is a STORAGE of VALUE too.And we should workwith a very different logic
Vladimir Vasilyev
@9214
@GiuseppeChillemi
Every Redbol script is contiguous block of data. Think of it as one dimensional space. Now, this one dimensional space have some sort of spatial markers which point to specific location in this space. This is what set-word! is - it's just this type of marker. set-word! points to location in source code, while variables usually point to location in memory. But there's no variables in Redbol. In a vague sense, script's body is it's own memory. Entire script is just one big chunk of self-modifiable state, which can be trivially serialized, saved and restored.
GiuseppeChillemi
@GiuseppeChillemi
STR: "ah" must be read: STR is taking data from the CODEFLOW position shich is next to it (lets say it is pointer 1 to "ah")
another STR: "" must be read as TAKE DATA FROM CODEFLOW position next to it (lets say it is a pointer 2 to "")
When the code loops the first STR takes data from code position 1
So it is like having a different pointer not the same one which is reset or repositioned to point to another value
GiuseppeChillemi
@GiuseppeChillemi
In
STR: "ah"
STR: ""
We have
STR: is "CODEFLOW POSITION INDEX 1"
"ah" is "CODEFLOW POSITION INDEX 2"
STR: "CODEFLOW POSITION INDEX 3"
"" is "CODEFLOW POSITION INDEX 4"
Vladimir Vasilyev
@9214
what is "codeflow" anyway?
GiuseppeChillemi
@GiuseppeChillemi
It is FLOW of CODE: any word which makes up your code
Vladimir Vasilyev
@9214
and why not just "block"?
GiuseppeChillemi
@GiuseppeChillemi

When you:

STR: "" ;""  is data structure position 2
insert STR "ah"
STR: "" ;"" is data structure position 7
insert STR "bb"

you are stating: SET STR to what you find at position 2 of your data structure ("")
Then: insert on what is rapresented in position 5 (word "ah") on position 2
Then: set STR to what is rapresented in position 7 (second "") and use THIS POSITION in further reference to get/set the contend of STR
then insert on POSITION 7 "bb"
If this code loops, the first STR will take again the value "ah" insted of "BB" as it will use the content of position 2. The second one will use te conent of position 7.

So the first insert STR "ah" will have as result "ahah" at the second loop
Alexander Higgins
@cahiggins
that makes sense now
GiuseppeChillemi
@GiuseppeChillemi
@cahiggins After more than 10 years of REBOL it now makes sense to me too. It is important to help other users to "disconnect" to their old knowledge and connect to the new one.
I can say I am out of the matrix now !
Vladimir Vasilyev
@9214
here's another food for thought - think about how it all mixes together with bind and contexts
GiuseppeChillemi
@GiuseppeChillemi
@9214 Bind, contexts, reduce, form, mold, set, pick, blocks, system/words, parse, dialects.... I have to start over with new eyes.
there is no spoon !
I am a borg ! I am part of the group. We all say "there is no spoon". You will be assimilated to the 'NO SPOON" logic. Resistence is futile.
Vladimir Vasilyev
@9214
for that matter, the next step is to accept that there's no I
Boleslav Březovský
@rebolek
Carl has described Rebol script as series of values which is best description IMO.
Vladimir Vasilyev
@9214
@rebolek well, yeah, since script can be in various forms (block!, string!, binary!)
Boleslav Březovský
@rebolek
Yes, but it loads as block! anyway.
PeterWAWood
@PeterWAWood

Carl also refers to Rebol scripts as expressions. He says "REBOL Expressions are based on this concept: you combine values and words into blocks".

The chapter Expressions in the Rebol User Guide is pretty much essential reading.

Boleslav Březovský
@rebolek
I agree. Basically the whole book is essential reading.
geekyi
@geekyi
image.png

@dockimbel :point_up: September 29, 2017 12:13 PM

@geekyi How to do you end up with those counts?

I used a program that reads strings in memory

geekyi
@geekyi
Interestingly, I can also write to memory (notice the Blu):
image.png