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

World: r3wp

[Core] Discuss core issues

amacleod
27-Oct-2010
[171]
I was going crazy trying to send to a long list getting errors...finally 
found the faulty address...how do you validate email then?
Rebolek
27-Oct-2010
[172]
You should write your own parse rule, it should be failry simple. 
Probably there's already something on http://www.rebol.org
Pekr
27-Oct-2010
[173]
Amacleod - there was a discussion on ML or elsewhere, about how useless 
email dtype is, if it can't work as email RFC suggests. I was told, 
that I should not mistake datatype, with complicated parser for possible 
correct emails. I still insist - the datatype is useless that way. 
I found some grammar, I even posted it back at that time, but I think 
that someone at RT was simply too lazy to implement it :-)
Henrik
27-Oct-2010
[174]
the email datatype is not useful for different reasons: it can't 
be serialized properly.
GrahamC
27-Oct-2010
[175]
either write your own parser ... or use my smtp challenge :)
GrahamC
28-Oct-2010
[176]
What would you expect here?

>> ?? test3: now
test3:
== 28-Oct-2010/17:28:36+13:00
>> ?? test3
Maxim
28-Oct-2010
[177x2]
none
or unset
GrahamC
28-Oct-2010
[179]
why?
Maxim
28-Oct-2010
[180]
?? prints test 3 and now is returned evaluated after so its printed 
by the console
GrahamC
28-Oct-2010
[181x2]
so where is the output of ?? test3:
ahh... on the first line
Maxim
28-Oct-2010
[183x6]
>> ?? test3: now
test3:   <<------ here
== 28-Oct-2010/17:28:36+13:00
its a common error I make ever so often in code.
because ?? is a lit-word argument.
(uses)
it grabs 'test3: directly, so it never gets evaluated (so it doesn't 
assign the following value)
this is true of all lit-word arguments and is probably why we don't 
use them often, they brake the visible chain of command.
GrahamC
28-Oct-2010
[189]
I should just inline 'probe
Maxim
28-Oct-2010
[190x2]
yep.. usually a better alternative... and put a prin "test3: " on 
the previous line.
(previous line is for scripts, obviously makes no sense for the command 
line hehehe)
Izkata
28-Oct-2010
[192x2]
I generally only use ? and ?? for words when I want to know the type 
as well, and because of that very issue I started using this:
probe: func [D][
    print join join type? D "!  " mold :D
    D
]

It's in my primary include file.  Helps with 'none versus none!, 
etc...
the only thing is the loss of the variable name, but using lit-word 
argument breaks the entire reason for using this, so... eh.  It'd 
be very nice to have some sort of in-between
Maxim
28-Oct-2010
[194]
I have redefine my probe so it uses mold/all instead... it also only 
dumps the first 500 chars when I try to probe something which is 
way to big (like a nested set of faces)
GrahamC
28-Oct-2010
[195x2]
what's the word to remove one series from another?
someop [ 1 1 2 3 4 ] [ 1 ] 
== [ 1 2 3 4 ]
Maxim
28-Oct-2010
[197]
exclude
GrahamC
28-Oct-2010
[198]
oh .. it's alter
Maxim
28-Oct-2010
[199]
but it will add them if they're not there.
GrahamC
28-Oct-2010
[200x2]
that's okay ... I need to remove all elements where there's only 
one of them
all patients who have had more than one office visit over the past 
year with a diagnosis of hypertension :)
Maxim
28-Oct-2010
[202x2]
oh ... you want  'UNIQUE
why do you need the second argument?

unique [ 1 1 2 3 4 ]
== [ 1 2 3 4 ]
GrahamC
28-Oct-2010
[204]
no .. I want alter

set1: [ 1 2 3 1 2 3 4 ] <= need to remove 4
set2: unique copy set1
alter set1 set2
Maxim
28-Oct-2010
[205]
no need for copy... all "set" functions copy.
GrahamC
28-Oct-2010
[206]
can never remember which copy and which inline
Maxim
28-Oct-2010
[207x2]
the above returns...  [1 2 3 4] on my test.
sorry  [1 2 3 2 3 4]
GrahamC
28-Oct-2010
[209]
well, that's no good is it!
Maxim
28-Oct-2010
[210]
so you want to remove singletons from a block?
GrahamC
28-Oct-2010
[211x2]
yes .. so why isn't alter doing that?
actually I want to remove one of each
Maxim
28-Oct-2010
[213]
ok so given:    [ 1 2 3 1 2 3 1 4 ] 
what is desired result?
GrahamC
28-Oct-2010
[214x3]
[ 1 2 3 ]
maybe I do want exclude and then unqiue
no .. exclude operates on sets
Maxim
28-Oct-2010
[217]
if you know [4] then that will work

blk:  [ 1 2 3 1 2 3 1 4 ]
unique exclude blk [4]
GrahamC
28-Oct-2010
[218]
I don't know
Maxim
28-Oct-2010
[219]
ok working on a solution (I like these quick riddles)
GrahamC
28-Oct-2010
[220]
I'm going to have to use a loop :(