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

World: r3wp

[Core] Discuss core issues

Oldes
25-Oct-2010
[147x2]
Is this prefered result?:
>> sort [748x430 68x206 748x194 305x147]
== [305x147 748x194 68x206 748x430]
I take it back.. REBOL cannot have any idea what I want to do, so 
better to use compare function, like:
sort-pairs: func[block-of-pairs][
	sort/compare block-of-pairs func[a b][
		either a/x < b/x [
			1
		][
			either a/x = b/x [
				either a/y < b/y [
					1
				][
					either a/y > b/y [-1][0]
				]
			][ -1 ]
		]
	]
]

sort-pairs [748x430 68x206 748x194 305x147]
;== [748x430 748x194 305x147 68x206]
GrahamC
25-Oct-2010
[149]
What object issues?
james_nak
25-Oct-2010
[150]
XML to objects from SUnday
Steeve
25-Oct-2010
[151]
get-obj-value: func[o [object!] p [path! word!]][attempt[do append 
to-path 'o p]]

Not optimized for speed though...
GrahamC
25-Oct-2010
[152x2]
hmm... clever
So why am I walking the path?  lol
Steeve
25-Oct-2010
[154x2]
Oldes, exactly the use case to use case... 

case [
	a/x < b/x [-1]
	a/x > b/x [1]
	a/y < b/y [-1]
	a/y > b/y [1]
	'equal 0
]
(except I reversed some stuffs...)
Oldes
25-Oct-2010
[156]
yes, that's nice example where to use case:)
james_nak
25-Oct-2010
[157]
Steeve, that's sweet. "Case" doesn't show up in the dictionary and 
I had no clue we had such a thing. Very cool.
Steeve
25-Oct-2010
[158]
not in the dictionnary ? strange...
james_nak
25-Oct-2010
[159]
http://www.rebol.com/docs/dictionary.html
Henrik
25-Oct-2010
[160]
I use it a lot. CASE/ALL is also useful.
Sunanda
25-Oct-2010
[161]
CASE is in the R3 dictionary:
   http://www.rebol.com/r3/docs/functions.html
But you are right -- it should be in the R2 dictionary too.
Maxim
26-Oct-2010
[162]
anyone know how to submit args when using 


r2.exe --do "probe what-dir probe system/script/args" --args  "r3.exe"

the above prints none
Izkata
27-Oct-2010
[163]
The help says this:
    -- args          Provide args without a script

There's a space between the -- and the word args, so I tried this 
and it worked:

   rebol --do '? system/script/args q' -- 'arguments here'

The help should probably say something like:
   -- <args>
to make it more obvious
Maxim
27-Oct-2010
[164x2]
doh... ok, I get it.
thanks.
GrahamC
27-Oct-2010
[166]
Isn't this a rather erroneous message ?

>> now - 365
== 27-Oct-2009/23:03:45+13:00
>> now - 365.25
** Script Error: Cannot use subtract on date! value
** Near: now - 365.25
Anton
27-Oct-2010
[167]
Yes.. Better might be "Cannot subtract decimal! from date! value."
amacleod
27-Oct-2010
[168]
email? [name-:-domain-:-com]
== true
>> email? [name-:-domain]..com
== true
>> email? [name-:-domain]...com
== true

Is this a bug?
Henrik
27-Oct-2010
[169]
The email parser is not very good.
Rebolek
27-Oct-2010
[170]
You can convert anything to email.
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 ]