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
dimsum
@KimRoach143_twitter
do we have MDI (Multiple document interface)with gui?? If yes any example
Boleslav Březovský
@rebolek
@abdllhygt I see, you can’t put the code there directly, use something like
compose [text (form 123)]
Abdullah Yiğiterol
@abdllhygt
doesn't work, "Script Error: VID - invalid syntax at: [(form 100)]"
BeardPower
@BeardPower
Which version are you using? Works on 0.6.3
Abdullah Yiğiterol
@abdllhygt
yes, 0.6.3
BeardPower
@BeardPower
>> compose [text (form 123)]
== [text "123"]
dimsum
@KimRoach143_twitter
yep works for me too
Vladimir Vasilyev
@9214
@abdllhygt I bet you forgot compose
Abdullah Yiğiterol
@abdllhygt
@9214 no, i did use
Boleslav Březovský
@rebolek
This works: view compose [text (form "123")]
Vladimir Vasilyev
@9214
can you show full code snippet?
Abdullah Yiğiterol
@abdllhygt
"Kasa " [
            compose [text (form 120)]
                ; "Kasa" is tab-panel
        ]
My full code is long
error message: Script Error: VID - invalid syntax at: [compose [text (form 120)]] Where: do
* Stack: view layout layout layout cause-error
Vladimir Vasilyev
@9214
@abdllhygt
view compose/deep [text-list data [(form 1) (form 2) (form 3)]]
Abdullah Yiğiterol
@abdllhygt
yes :D
thank you @9214 haha
Abdullah Yiğiterol
@abdllhygt
i develop a commercial app with red
dimsum
@KimRoach143_twitter
@abdllhygt can you please share last code because it still gives me same error
Abdullah Yiğiterol
@abdllhygt
@KimRoach143_twitter i add near view "compose/deep"
view compose/deep [
;your code
]
dimsum
@KimRoach143_twitter
thanks @abdllhygt
Abdullah Yiğiterol
@abdllhygt
you're welcome
GiuseppeChillemi
@GiuseppeChillemi
Hi, I am still having problems understanding why a: "" or a: [] does not reset the content of A
From you comments at the end of april I have realized the "code is data" concept.
In this example:
red>> do code
== func [input /local s][s: "hello world" append s input]
red>> test "x"
== "hello worldx"
red>> body-of :test
== [s: "hello worldx" append s input]
I have realized that you are directly modifing the data/code structure.
But why a: "" or a: [] lead to nothing ? Aren't we linking a: to an empty block or are "" and [] "non existant", so it is like doing nothing ?
Vladimir Vasilyev
@9214
@GiuseppeChillemi for "how" - use copy or copy/deep, for "why" - series! values are passed as pointers to some memory location, then you say something like word: [], it means "allocate some space for series, initiate it with some content (no content in this case) and make word point to that storage space" . So, in fact,word from that moment is always bound to static memory address, while content of that address could be changed and extended freely.
GiuseppeChillemi
@GiuseppeChillemi
but if you a: "abcdef" and later a: "" why it is still "abcdef" ? shouldn't "a:" get linked to another memory region ?
Vladimir Vasilyev
@9214
@GiuseppeChillemi ?
>> a: [1 2 3]
== [1 2 3]
>> a: ""
== ""
>> a
== ""
GiuseppeChillemi
@GiuseppeChillemi

rebol []

print-it: func [/local str] [
str: ""
insert str "ha"
print str
str: ""
]

try print-it many times
Vladimir Vasilyev
@9214
Body of print-it is data, just like everything else in Red. This data is represented by block of 9 elements, and while 2nd and 9th element looks identical, they're not the same thing.
Vladimir Vasilyev
@9214
perhaps my answer with pointers and stuff was misleading :confused:
Vladimir Vasilyev
@9214
>> foo: func [x][s: [no spoon] probe append s x poke body-of :foo 2 [no spoon]]
== func [x][s: [no spoon] probe append s x poke body-of :foo 2 [no spoon]]
>> foo 'whatsoever
[no spoon whatsoever]
== [no spoon]
>> body-of :foo
== [s: [no spoon] probe append s x poke body-of :foo 2 [no spoon]]
I wonder if self could be supported in specs?
Vladimir Vasilyev
@9214
>> foo: func [x][s: "before" probe append s x s: "after" probe s]
== func [x][s: "before" probe append s x s: "after" probe s]
>> foo "!!!"
"before!!!"
"after"
== "after"
>> body-of :foo
== [s: "before!!!" probe append s x s: "after" probe s]
Step by step:
  • s: means next time when you see s, evaluate it to the result of an expression that follows me, whatever it might be;
  • "before" is just a string to which s word is bound now, as implied by s: syntax;
  • append is word that is bounded to a function, that function receives two arguments that follow append word;
  • the first argument, s, evaluates to the thing that follows s:, namely "before" string, or, more specifically second element of foo's body;
  • the second argument, x, evaluates to whatever we've passed to foo;
  • now, we have second element of foo's body and some value; what append does is just this: append some value to second element of foo's body;
  • next s:, just like the first one, simply states next time when you see s, evaluate it to the result of an expression that follows me, whatever it might be;
  • and "after" is what follows s:, it's the 8th element of foo's body, all subsequent s words will be evaluated to it;
  • probe is a word that is bounded to function that blah-blah-blah;
  • finally, s is evaluated to the 8th element of foo's body, and it is what it is, just "after".
Gregg Irwin
@greggirwin

@GiuseppeChillemi, see https://github.com/red/red/wiki/Why-do-I-have-to-copy-series-values%3F

Or maybe this will help:

print-it: func [] [
    ""
    insert first body-of :print-it "ha"
    print first body-of :print-it
    ""
]
>> print-it
ha
== ""
>> print-it
haha
== ""
>> print-it
hahaha
== ""
Same as @9214's answer, without the explanation. :^) That is, the two empty strings in your func exist independently of any words that refer to them. So, at the end of your func, you have str point to the second one, but it's never used. On the next call, str is set to refer to the first string, which has now been modified, and you print that.
Vladimir Vasilyev
@9214
All modifications are happen in-place, i.e. they modify original data. If you have a cup and ask Red to break that cup, it will break that cup instead of magically poofing broken cup out of air next to the original one.
Gregg Irwin
@greggirwin

From the end of the wiki page:

One more thing. The colon (:) suffix in a word is not an assignment operator (as in other languages), it's part of the set-word! datatype literal syntax. When evaluated, it binds the word to the result of next expression. It doesn't do anything more than that. So a: "" does not "reset" or "reinitialize" the "variable" a. That is an incorrect interpretation, it just makes the word a refer to the literal string "" which follows it.

Vladimir Vasilyev
@9214
but if you're just curious how broken cup might look like and don't want your precious cup to be mutilated, use copy on your cup, that way Red will make a new cup identical to yours (yeah, Red knows pottery) and will break that copy of a cup
Gregg Irwin
@greggirwin
I thought it was a vase he broke when he met the oracle. :^\
Vladimir Vasilyev
@9214
which vase? CRUSH SOUND
Gregg Irwin
@greggirwin
Yes! Well played.
Vladimir Vasilyev
@9214
though, I still can't bridge that mental gap between when data is evaluated and becomes another data
Gregg Irwin
@greggirwin
Now you can edit your post and say "What cup?"
Vladimir Vasilyev
@9214
I mean, code is what to do, something active, and data is something to manipulate upon, something passive
if everything is data and everything is passive, how something can happen at all?
Greg T
@gltewalt
Do!
Vladimir Vasilyev
@9214
I know that this active/passive presupposition is lame and it comes from another languages, but it just doesn't click
well, do is data too