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

World: r3wp

[Core] Discuss core issues

Gregg
3-Feb-2012
[2767]
Only Carl can say if it's by design or not.
james_nak
3-Feb-2012
[2768x5]
I've got a function that doesn't and I know one of you can explain 
why. 
foo: func [  /dothis anobject ] [
 if dothis [
  dosomething anobject
 ]
]

foo myobject


So the dosomething function does not work with the "anobject".  However, 
If I hardcode the "myobject" into foo like:
foo: func [ /dothis ]
[
 if dothis [ 
 dosomething myobject
 ]
] 


It works. So my questions are: Is it because "anobject" is a pointer? 
And what do I do on the calling/receiving sides to fix that?
Thanks in advance.
=doesn't work.
Hold on. I think I might be testing the wrong thing.
Nope, that wasn't it and I'm back to wondering what's the difference 
between the object and the passed object.
OK, figured it out. I had to pass the object as a 'word then "do" 
it in the function to get it to work.
GrahamC
3-Feb-2012
[2773]
You can pass functions as parameters, and then omit the 'do
Gregg
3-Feb-2012
[2774]
In your example, you didn't spec the /do-this refinement on the call. 
Probably just a glitch in posting here though.
james_nak
3-Feb-2012
[2775]
Thanks Graham and Gregg. The object that I was passing was a face 
and I tried different ways to get it to work and that was the only 
way it would work. I guess the question is how does one know when 
he is passing some value if the receiving function sees it as the 
writer is intending it to be seen. Anyway for now I am satisfied 
and have moved on to other issues. I appreciate your input though.
Gregg
3-Feb-2012
[2776]
If the func doesn't take a lit-word/get-word argument, it should 
evaluate and pass as an object. Now, if you have a block of words 
that refer to list faces, and you pass that word, that's what you 
get. If your func has types defined for the args, that can help catch 
issues like this.
james_nak
3-Feb-2012
[2777]
Gregg, thanks, it could be the func that's getting the arg, the "dosomething" 
in my example. I hadn't look at that though I was wondering still 
what the difference was with the two objects. Unfortunately it always 
seemed right even with the types defined because they were both objects. 
At least that's what type? outputted. Maybe it has something to do 
with the context they were bound to. Anyway, that's for another day. 
Thank you as always.
Maxim
7-Feb-2012
[2778x2]
James, I think you are mixing up the word which refers to an object 
with an object value.  this is confusing in Rebol because words are 
not variables.  

it's happened to me a few times (especially in VID) that I mix this 
up in action blocks and VID dialect builders.
often, I'd build a block to be used and forget to reduce the block 
before appending it to the spec.  so what happens is that you receive 
an unbound word, instead of the data you assumed it should be refering 
to.
james_nak
7-Feb-2012
[2780]
Thanks Maxim.
Maxim
7-Feb-2012
[2781]
since I've been doing parse compilers for the last 2 months, I can 
say this have happened even more often lately  ;-)

you might also look up the 'COMPOSE word, it's very handy for resolving 
these kinds of issues (considering it's this kid of issue to begin 
with ;-)
james_nak
7-Feb-2012
[2782]
Thanks. I wish there was a way to compare words like this so one 
could find out what the difference was. I suppose that is part of 
the bindology world. Glad to hear you are working with Rebol. It 
could be me but I haven't seen you around lately. Probably me because 
I haven't been around much here myself.
Maxim
7-Feb-2012
[2783x4]
I've been working a lot lately, and haven't had a lot of spare time. 
 I'm actually working with REBOL full time at a company which is 
using it to get a significant competitive advantage over the competition.
(eek that was redundant, sorry ;-)
I think people don't realize just how much power lies in parse.  
 Even I'm impressed with it right now.  I've been doing tests with 
really crazy stuff like two-cursor parse rules and run-time auto-recompilation 
of 400MB parse rules. 


 I've been doing things like parsing 100MB word documents and pushing 
 the interpreter to the limit ... reaching the 32-bit 1.6 GB RAM limit, 
 6 hour loop tests, etc. :-)
in my last test I was doing natural language extraction of concepts 
at a rate of 25000 words a second within multi-megabyte text files. 
 :-)
GrahamC
8-Feb-2012
[2787]
Who is this guy?
Maxim
8-Feb-2012
[2788]
hum... either that was sarcasm or you mean, what is the company I 
now work for?
GrahamC
8-Feb-2012
[2789]
Not sarcasm .. just humor :)
Maxim
8-Feb-2012
[2790]
hehe, I wasn't sure  ;-)
james_nak
8-Feb-2012
[2791]
That's incredible Maxim. Good work. With what you do with parse, 
is the knowledge available online  in tthe form of the present parse 
documentation, or did you have to discover new techniques? I have 
to admit I just barely use it when I need to. Anyway, thanks for 
sharing your experience. I
Maxim
8-Feb-2012
[2792]
learning parse requires baby steps and at some point, the decision 
to solve a real problem with it and force yourself to learn it.  
I didn't use parse for almost a decade until I started using it more 
and more to a point that currently I do more parse than any other 
coding in REBOL (but that's just because its idealy suited for this).


some little tricks accumulate with experience and eventually, we 
discover pretty wacky things, which allow us to use parse almost 
like a VM.
Oldes
8-Feb-2012
[2793]
Parse is REBOL's heart... I cannot imagine living without it.
Pekr
9-Feb-2012
[2794]
REBOL parse is a gem, a treasure to follow. Me, the coding lamer, 
did few things using it. Guys coding C++ first came meh, well, interpreter. 
Then  - how is it possible it is faster than C++ app? Later on, they 
came with new requests asking - well, you know, you have that parser, 
we need to do following stuff ...
ddharing
9-Feb-2012
[2795]
Well said, Oldes.
james_nak
9-Feb-2012
[2796]
Guys, with all this said (and I agree), perhaps this is the one things 
that needs to be the focal point for Rebol and eventually the #Not 
Rebol languages.  I know there are some tutorials out there but do 
any of them do justice to parse? I keep going back to the Codeconscious 
one: http://www.codeconscious.com/rebol/parse-tutorial.htmland 
the ones at reboltutorial, but there doesn't seem to be a lot considering 
how much one can do with it.
Maxim
9-Feb-2012
[2797]
I learnt parse using the 2.3 rebol core guide...  I thought it did 
a pretty good job of launching one in the good direction.   parse 
HAS evolved since then, but for the basic semantics and principles 
of parsing I think its pretty good.

you can also look at this tutorial by Nick Antonaccio:
http://musiclessonz.com/rebol_tutorial.html#section-9.3


IIRC nick has a good sense of tutoring, so it may be a good first 
step... he also gives links to other parse resources at the end of 
that part of his (short) tutorial
Pekr
9-Feb-2012
[2798]
Max - are you using R2 parse, or R3 enhanced one?
Maxim
9-Feb-2012
[2799]
R2.   


since we compile just about all the rules from other datasets and 
simplified user-data, the R3 advantage is much less significant (because 
we can simulate all the R3 improvements by using R2 idoms, though 
its sometimes tricky).


Using R3, it probably would be a few percent faster since some of 
the rules we have would be simpler and those tricks would be managed 
natively by parse rather than by *more* parse rules.
james_nak
9-Feb-2012
[2800]
Thanks Maxim. I appreciate the info.
Maxim
9-Feb-2012
[2801x2]
The problem with R3 right now is that it isn't yet compiled in 64-bits 
we still have the 1.6GB RAM limit for a process which is the biggest 
issue right now.   I have blown that limit a few times already, so 
it makes things a bit more complex and it doesn't allow me to fully 
optimize speed by using more pre-generated tables and unfolded state 
rules.
Our datasets are huge and we optimise for performance by unfolding 
and indexing a lot of stuff into rules... for example instead of 
parsing by a list of words, I parse by a hierarchical tree of characters. 
 its much faster since the speed is linear to the length of the word 
instead of to the number of items in the table. i.e.  the typical 
 O*n   vs.   O*O*n  type of scenario .  just switching to parse already 
was 10 times faster than using  hash! tables and using find on them.... 


In the end, we had a 100 time speed improvement from before parse 
to compiled parse datasets.  this means going from 30 minutes to 
less than 20 seconds....but this comes at a huge cost in RAM... a 
400MB Overhead to be precise.
ddharing
9-Feb-2012
[2803x2]
Memory is cheap. It's the 32-bit limit that is the real problem -- 
as you stated.
I'm confused. Why is REBOL limited to 1.6GB? I've seen that myself 
too, but that is nowhere near the 4GB limit.
Maxim
9-Feb-2012
[2805x3]
yeah...  I've got a server that has 64GB of RAM  I want to use it 
 !!!   :-)
its the MS windows limit.   it can only address 1.6GB of memory in 
32-bit mode.
it may be higher on linux, I've never tested it.
ddharing
9-Feb-2012
[2808]
I see. What about Linux?
Maxim
9-Feb-2012
[2809x2]
(btw that 1.6GB limit used to be a real problem when I was doing 
3D stuff...  3D animation apps are memory hogs, and in some cases, 
we could only work 15 minutes before high-end apps would crash.

which is a problem when a 3D scene takes 30 minutes to save to disk 
over the network  ;-)
can anyone explain a single use for this R2 path conversion?

>> to-string first [path/item]
== "pathitem"


I know I can use mold... it's just that I wonder why to-string doesn't 
use the molded string equivalent as well?
Oldes
9-Feb-2012
[2811]
funny.. I was thinking about it today as well.. but I don't know
Sunanda
9-Feb-2012
[2812]
Something inconsistent in the way paths are handled:
    to-string load "path/item"
    == "pathitem"
     to-string to-path "path/item"
     "path/item"
Steeve
9-Feb-2012
[2813]
You can use FORM as well.

And having alternatives should not be something to complain about. 
:)
Maxim
9-Feb-2012
[2814]
I'm not complaining, I just find absolutely no use-case for the default 
  :-D


my question was can anyone give me a reason for the current use of 
to-string?  

can you?  ;-P
Ladislav
9-Feb-2012
[2815x2]
What is "O*O*n"?
Use case for default:

to-string [1 "." 2] ; == "1.2"