by

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
hiiamboris
@hiiamboris
yes, that's what I did to get to the conclusion
hiiamboris
@hiiamboris
@hiiamboris You can always use (pick a 'y) < (pick b 'y).
>> p: 2x3
== 2x3
>> pick p 2
== 3
>> second p
== 3
>> pick p 'y
*** Script Error: value out of range: y
*** Where: pick
*** Stack:
maybe there was an intent to make this work, maybe not, but just sayin... it doesn't work
lepinekong
@lepinekong_twitter
I have a weird case for set: it works with one element but not with 2 : * Script Error: forall does not allow word! for its 'word argument
P: context [

    F: [
        P1: [
            name: "John"
        ]

        P2: [
            name: "Mary"
        ]    
    ]

]

set [list1 list2] compose [
    (words-of (Context (P/F)))
    (values-of (Context (P/F)))
]

; this works
set [list1] compose [
    (words-of (Context (P/F)))
]

; this doesn't work
forall list1 [
    probe list1/1
]

forall list2 [
    probe list2/1
]
Vladimir Vasilyev
@9214
@lepinekong_twitter both list* words are bound to other words (P1 and P2, respectively).
I guess that's what you want instead:
P: context [
    F: [
        P1: [name: "John"]
        P2: [name: "Mary"]    
    ]
]

set [list1 list2] reduce [
    words-of  context p/f
    values-of context p/f
]

forall list1 [probe list1/1]
forall list2 [probe list2/1]
lepinekong
@lepinekong_twitter
@9214 ah yes thanks, have always difficulty to understand bind stuff :worried:
Vladimir Vasilyev
@9214
@lepinekong_twitter there's zero "bind stuff" here.
Examine the result of compose application and you'll probably figure out that it's not what you expected.
You should have used compose/only instead, which composes nested blocks "as-is" (though compose is superfluous here, as reduce can do the same job just fine). Moreover, I don't get why you need multiple parenthesis nestings.
lepinekong
@lepinekong_twitter
@9214 thanks I never know when to use reduce or compose, will have to think about it
Vladimir Vasilyev
@9214
@lepinekong_twitter use reduce whenever you need a block of evaluated expressions, and compose when you have a "template" data with forms to fill in.
lepinekong
@lepinekong_twitter
@9214 It is now part of my ever growing list of all troubleshootings :smile: https://i.snag.gy/obuyZO.jpg
Vladimir Vasilyev
@9214
@lepinekong_twitter don't push yourself too hard :) is that a list of "flashcards"?
GiuseppeChillemi
@GiuseppeChillemi

@greggirwin

One of the great and terrible things about Redbol langs is their chameleon ability. @nedzadarek, a great many details are hidden under a facade that makes Red quickly accessible to people, but there is the risk that they will see it "as just like X", when it really isn't.

That has been just my problem. The original REBOL core manual did not a good job on letting me forget about variables, pointer and classic OOP.

Now I read this section with great interest. I need just only to find how to bookmark discussions.
Vladimir Vasilyev
@9214
@GiuseppeChillemi click on timestamp of the message you're interested in and copy its link from the address bar. Like this:
https://gitter.im/red/help?at=5acd1de3080a3850531a9b18
GiuseppeChillemi
@GiuseppeChillemi
@9214 I have clicked everywhere but timestamp ! Thanks !
GiuseppeChillemi
@GiuseppeChillemi

@9214

unnamed0.png

@nedzadarek what you seem to call a "variable" is a binding + relation between symbol ID and value inside context.

What is SYMBOL ID ? I am getting confused. Could you make a graph adding real words, blocks and arrows to this structure and also underliyng C like rappresentation of the data structure ?

Vladimir Vasilyev
@9214

Word reference its context through a node (just a special intermediate structure) and has a symbol ID, which is an index in a symbol table. Context, in turn, is just a two-column table: first column is for symbol! slots, second one is for any-value! slots.

When a word is evaluated, a value is fetched in the context pointed by that word, from the value slot that correspond to the symbol ID held by the word. In that sense, words is an instance of an internal symbol! datatype: word = a context reference + a symbol ID.

Symbol table, as I understand it, is nothing more than block of symbol! cells, one per Red session currently (should be one per module in the future). Symbol ID is an index of a cell in that block. symbol! cell holds a UTF-8 representation of a word (its "spelling", it's actually a pointer to a string buffer, again through node) and an alias field. If word is an alias of the other word (think case-insensitivity), this field will hold an index of the original word.

Ryan Cole
@prapro
Basically it's The Force. https://youtu.be/x2YQJsbbWNA
Vladimir Vasilyev
@9214
https://gitter.im/red/help?at=5acd2aa75f188ccc154fc0b2
:point_up: I think it should be " ... two-column table: first column is for symbol IDs ..." instead, but the idea is the same.
BeardPower
@BeardPower

The data of a type struct is stored in a cell, which is a red-value. These structures are 128bit slices on the stack (4 32bit integers). A cell consists of
header
data1
data2
data3

Which are filled/type-casted to the appropriate types.

Vladimir Vasilyev
@9214
Cells and slots are synonyms, though "cell" is used as a low-level term. Cells are allocated from the heap as block! buffers.
BeardPower
@BeardPower
It could easily confuse developers, as the compiler is printing error messages in regards to cells (data1, data2 data3) instead of the real struct, which it's casted to.
If e.g. a type is using data2 for it's value, the error message would print "error in data2" instead of "error in value".
Well, isn't a Cell consisting of 4 32bit slots? The stack consists of cells, which are build from slots.
Vladimir Vasilyev
@9214
@BeardPower but you can look at the header with type ID in it, right?
BeardPower
@BeardPower
@9214 Yes, but you still have to look up the fields by hand.
The error message will not print out the ID.
Vladimir Vasilyev
@9214

@BeardPower per my notes

Both Red and Rebol use arrays of 128-bit cells (aka slots) to store values (32-bit header + 96-bit payload).

BeardPower
@BeardPower
The error handling could be better. If an action is called internally (e.g. form and mold to print out the result of a type-cast in the REPL), but is null, it will show a stack-trace with failed form and mold calls. It would be easier, if there is a error message like: form/mold needs to be implemented!
Vladimir Vasilyev
@9214
Though maybe you're right, initially I thought that cell = 4 slots too.
BeardPower
@BeardPower

@9214 Yes, you are right. A cell is a red-value, which is 128-bit, but the allocator has this comment: placeholders to make a 128-bit cell

So I asked myself, if there are lower bit cells, and the slots are 128bit cells.

cell!: alias struct! [
    header    [integer!]                        ;-- cell's header flags
    data1    [integer!]                        ;-- placeholders to make a 128-bit cell
    data2    [integer!]
    data3    [integer!]
]
Vladimir Vasilyev
@9214
@BeardPower 1 header (32 bits) and 3 placeholders (96 bit payload) = 1 cell (128 bits total).
BeardPower
@BeardPower
So the "cell" moved onto the stack is then called a slot :)
Vladimir Vasilyev
@9214
:mortar_board:
BeardPower
@BeardPower
The cell is in the stack's slot.
Vladimir Vasilyev
@9214
Very slot, should allocate.
BeardPower
@BeardPower
:smile:
@9214 Are your notes online? Doing double work is :older_man:
Trying to siphon every info to prepare for Red 2.0 ;-)
Vladimir Vasilyev
@9214
@BeardPower don't siphon - mediate.
Inhale, exhale, do the "ohhhmmmm" sound, stare at the sources and slowly whirl your pinky finger around the belly button.
Counter-clockwise!
BeardPower
@BeardPower
Feeling :dizzy_face: Seems to work ;-)
redredwine
@redredwine

@9214 Thanks for the parse rule. it works. I was trying to use OPT, but could not figure how to use OPT.

collect [
some [
keep["tid=" to ". "]
keep[to "startTime:" ]
keep[ to ", "]
opt [to "endTime:"]
opt[ keep [to ", "]]
[thru newline]
]