r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

Geomol
5-Oct-2011
[4284x2]
Yeah, if I didn't put the : in front, it would look up, what NOT 
means, found it to be a function taking one argument and give an 
error, because the argument isn't there. With :not, it takes the 
value of NOT without evaluating it, and that's the function itself.

>> !: not
** Script Error: not is missing its value argument
:not is called a get-word! datatype. You get same result as normal 
words for most datatypes, like

>> a: 42
== 42
>> b: :a
== 42

That would be the same as writing:

>> b: a
== 42

But for functions, operators and such, get-words are useful.
todun
5-Oct-2011
[4286]
@Geomol, it does function composition?
Geomol
5-Oct-2011
[4287]
What do you mean?
todun
5-Oct-2011
[4288x2]
@Geomol, I mean that for non-integer values(functions etc), using 
the get-word! datatype seems to pass a function into a variable.
Geomol, I meant to say equational-reasoning and not function composition. 
Sorry.
Geomol
5-Oct-2011
[4290]
Well, I'm not sure, exactly what you mean, but in REBOL you don't 
have keywords. Functions, operators and such are often referenced 
by words. So NOT is just a word like ! can be a word. I just defined 
! to mean the same as the NOT word.

You can redefine everything in REBOL.
todun
5-Oct-2011
[4291]
Geomol, Ok. That makes sense. What I mean perhaps is not neccessary 
in this context where everything is a word.
Izkata
5-Oct-2011
[4292]
Linux copy/paste:


To copy from AltME to somewhere else, right-clicking on a URL will 
copy it to the clipboard, right clicking on text will copy the entire 
thing to the clipboard, or highlighting it and pressing CTRL + C 
will copy it to the clipboard.  To paste it somewhere else, use the 
middle mouse button.


To go from somewhere else to AltME, highlight the text (which automatically 
copies it), then in AltME press CTRL + V


It's confusing because AltME accesses the X clipboard, and uses CTRL+C/CTRL+V 
to do so, while traditionally the X clipboard is just highlight to 
copy/middle-click to paste.  CTRL+C/CTRL+V elsewhere on linux accesses 
a different clipboard
todun
6-Oct-2011
[4293]
@Izkata,  Ok. Thanks
todun
8-Oct-2011
[4294]
It seems that a list is always considered to begin at the head, regardless 
of the sublist you are dealign with. Is there a way to ensure that 
when you specify a sub-list you are always in a sub-list?
Henrik
8-Oct-2011
[4295]
not sure what is meant, but referencing the same series! via separate 
words always maintain separate indexes.
todun
8-Oct-2011
[4296]
@Henrik, I want to refernce the same series but the modified version, 
at each call to the series.
Henrik
8-Oct-2011
[4297x2]
if by modification you mean, moved index, then simply:

>>b: next a: [a b c]
== [b c]
>> same? b a
== false
>> head? b
== false
>> head? a
== true
>> same? head b a
== true
>> a/2: 'y
>> a
== [a y c]
>> b
== [y c]


The word "modified" is usually used when changing something in the 
series, except for the index. It's important to know when a function 
modifies a series or not, as you then will have to copy it first, 
if you don't want the original series modified.
not sure if this helps you
todun
8-Oct-2011
[4299x3]
@Henrik, this is what I mean.
x: btn "B" [
       swap SOME_LIST at SOME_LIST 6
]
Anytime I press "B", I want SOME_LIST to be modified.
Henrik
8-Oct-2011
[4302]
is SWAP a pseudo function or a real one?
todun
8-Oct-2011
[4303x3]
@Henrik, it is in-built.
swap SERIES1 SERIES2 
SERIES1 has its head replaced by the head of SERIES2.
SERIES2 has its head repalced by the head of SERIES1.
http://www.rebol.com/r3/docs/functions/swap.html
Henrik
8-Oct-2011
[4306x2]
OK. I'm still not sure, but if you want to use SOME_LIST not at the 
head, you can simply move its index elsewhere, using AT.
sorry, I can't be more helpful.
todun
8-Oct-2011
[4308x2]
but if I press the button again, if will act on the original list, 
not the updated list.
@Henrik, not a  problem. You've been helpful, by helping :D
Henrik
8-Oct-2011
[4310]
yes, it's the same list, because SWAP does not modify the index, 
only the content. you will probably need to use AT in a separate 
operation afterwards to move the index to the desired position.
todun
8-Oct-2011
[4311]
@Henrik, I do use AT in the example I show you. It still doesn't 
work.
Henrik
8-Oct-2011
[4312]
because AT does not store the new index. it works like this:

>> a: [a b c]
>> index? a
== 1
>> index? next a
== 2
>> index? a
== 1
>> index? a: next a ; stores new index
== 2
>> index? a
== 2
Sunanda
8-Oct-2011
[4313]
SWAP ... AT should work in R3.

Are you on R2 or R3 -- SWAP exists only in R3 .... Though it is easy 
to write a version for R2.
Henrik
8-Oct-2011
[4314]
SWAP is in R2, 2.7.7 and up, it seems.
todun
8-Oct-2011
[4315x2]
@Sunanda, desktop says I'm using REBOL/View 2.7.8
@Henrik, you seem to be suggesting that i store my intermediate operations...ok. 
Let me try that. thanks.
Henrik
8-Oct-2011
[4317]
so, todun, the general mechanism is that you can store a new index 
of a series, by simply by first move the index and storing the series 
under the same word again:

a: at a 4

This works for BACK, NEXT, AT, SKIP, HEAD, TAIL.

The series will not be modified or copied.


Note that when you COPY, COPY will only copy from the current index 
and forward.


If your index is not at head, HEAD is useful to temporarily reference 
the series from the head, like if you use AT several times in a loop 
or something:

at head a 4
todun
8-Oct-2011
[4318]
@Henrik, ok. I'm trying your first suggestion but it doesn't work. 
I'm trying to do the second one to see if it will work now....
Sunanda
8-Oct-2011
[4319]
I suspect then you do not have SWAP. What do you see if you type 
this at the console?
   swap "abc" "def"
todun
8-Oct-2011
[4320x2]
@Henrik, the assignment you suggest seems to be depopulating my file 
on the button presses
@Sunanda, I get "dbc"
Sunanda
8-Oct-2011
[4322]
Okay -- then you do have SWAP.....That's a start :)
Henrik
8-Oct-2011
[4323x2]
if you save your data with the index moved away from head, then you 
will get data loss.
can you post your revised code?
todun
8-Oct-2011
[4325x3]
@Henrik, I just want to swap the data though.
@Henrik, the code is multi-part. I'm still not sure how many lines 
of code I'm allowed to post here.
@Henrik, I can also post the local portions doing the swapping...but 
that will keep you in the dark on other parts though.
Henrik
8-Oct-2011
[4328]
perhaps about 30-50 lines is OK, but perhaps it makes better sense 
to try the steps in the console.
todun
8-Oct-2011
[4329]
@Henrik, I have tried it in console..or do you mean somethign else 
?
Henrik
8-Oct-2011
[4330x2]
no, I mean the console alright.
but I understand that you save the file to disk after modifying the 
index? perhaps it's the saving process that contains errors.
todun
8-Oct-2011
[4332x2]
@Henrik, let me post it...one second.
@Henrik: better still, can I just send you a pastebin linke