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

World: r3wp

[!REBOL3-OLD1]

JaimeVargas
20-Dec-2006
[1773x4]
(apply * (map + item-order-list  item-price-list)) for example (apply 
* (map + '(1 2 4) '(100 50 25)))  ;== 300

That is my one line scheme code for totalizing an order.
But if function pre-bind blocks or pre-reduce, you lose CODE-AS-DATA, 
beside making function evaluation slower.
I used such technique in my toy implementation for supporting  multimethod 
. (Found in rebol.org)
BTW. The totalizing onliner above have '* and '+ switch. Damm dyslexia.
Maxim
20-Dec-2006
[1777]
but that step is inevitable at some point even if we added parens. 
 because of the way REBOL does its binding no?
JaimeVargas
20-Dec-2006
[1778x2]
It could be replace if for example SPACE was use as delimiter.
Or maybe  a single DOT
Maxim
20-Dec-2006
[1780x2]
or.... an yet unused char !!!!     a simple comma.
but then we get code like C with line terminations ... yuk.
JaimeVargas
20-Dec-2006
[1782x4]
Exactly. The curses of *free form*.
I actually think BLANKSPACE is a good candidate.
But thinks like append "d" copy skip "cba" 2. Need to be written 
in multiple lines.
APPEND "d" \
   COPY \
      SKIP "cba" 2


Using the '\ as hint that the expression is expecion something to 
return from the next expresion.
Maxim
20-Dec-2006
[1786]
you are tooo scheme infected.
JaimeVargas
20-Dec-2006
[1787]
Nah. You alwasy do tradeoffs in Language Design.
Maxim
20-Dec-2006
[1788x3]
;-)   for my part... REBOL's code looks are a reason I like it.
one reason I'm not attracted to what I've read of scheme is the actual 
syntax.
hehe
JaimeVargas
20-Dec-2006
[1791x2]
Actually scheme is pretty much free form; after using it for a while 
you no longer see the parens. Python removed the parens but forcing 
identation. Acutally there is a scheme mode that allow you to program 
without parens.
But the issues of expression determination is faced by every language. 
C uses Semicolons,, Scheme uses Pares, Unix Shell use Pipe and others; 
and Rebol argument counting. This simple principle will determine 
what kind of expressions are possible and what you gain and what 
you lose.
Maxim
20-Dec-2006
[1793x2]
but I think just using the \ char should be enough each \ ends one 
var arg counter.
lifo ordering of arg "grabbing" should be able to determine which 
\ ends which func... AFAICT
Pekr
20-Dec-2006
[1795]
First I thought R3 alpha will be released before the end of the year, 
now I wish we could at least see long time promissed diagrams of 
R3 architecture as a Christmas gift :-))
Maxim
20-Dec-2006
[1796]
Pekr ! where is that negative tone I've come to love !     ;-)
Pekr
20-Dec-2006
[1797x2]
ah, and I already thought, that I am being too negative even stating 
above :-)
for me R3 is inevitable, so far sounds good to me ... look - I waited 
for such architecture change since the beginning :-)
Maxim
20-Dec-2006
[1799]
we almost always agree on most of the issues within R2 so I can't 
agree more!
JaimeVargas
20-Dec-2006
[1800]
I no longer await and I have been happy since then ;-)
Maxim
20-Dec-2006
[1801]
who says we're waiting  ;-)
Maxim
21-Dec-2006
[1802x6]
Jaime, I realized just now that it would be very easy to add variable 
args useage in rebol.  without any new symbol or "trick"
if functions had a refinement which said /grab or /varargs  then 
we could simply let the function grab all the values until it hits 
a wall (the end of a paren or block)
then this would simply work DO [+ 1 2 3 4]   or apply :+ [1 2 3 4]
maybe the behaviour could then be toggled like a refinement on demand 
as an option when the use is not always mandatory  like so:

(sum/grab  1 2 3 4 5 5)
this makes all current code valid, and expands the functionality 
easily.  since its part of the function's description, anyone using 
it would just use it appropriately.
and in any case its still going to evaluate all the code till the 
end, so it won't even prevent code execution even if misused.
JaimeVargas
21-Dec-2006
[1808x5]
This doesn't scale well. The problem is what defines a wall. Actually 
that is the definition of delimiter.
The problem becomes inmediate in function composition.
What is the meaning of ?

f/grab h/grab t/grab 1 2 3 4 5
This type of composition appears a lot when using combinations of 
apply and map and fold.
Also /grab has diferent semantics than standard refinements which 
either expect 0 or 1 arguments.
sqlab
22-Dec-2006
[1813]
why not just use a block argument?
Ingo
22-Dec-2006
[1814x2]
Hi Jaime, it scales as well as in all other languages using varargs 
... of course you need to use parens to group args.
Hi sqlab, the troubel with blocks isī, that you have to add an additional 
reduce step in almost all cases ...
JaimeVargas
22-Dec-2006
[1816]
Ingo, but Max suggestions doesn't use parens. Just a refinement. 
Also in rebol parens escabe the interpreter and re-enter it. Slowing 
execution. I don't think see as a good fit.
Volker
23-Dec-2006
[1817]
Maxims approach is used in vid, where the wall is not the end of 
block but something "wrong". IE it could be standart to terminate 
such things with a dot.
  a: sum 1 2 3 4 .  print a

all needed would be a way to parse the callers code, i wish that 
for years. Other question is if is really is needed. blocks work, 
and the reduce can be done inside the function.
sqlab
23-Dec-2006
[1818]
; works as a terminator.
I used it once for a function with many unset! arguments
Gabriele
23-Dec-2006
[1819x2]
sqlab, i'm not sure about that.
>> do {print ;something^/"bla"}
bla
Pekr
23-Dec-2006
[1821]
I wonder if the lack of variable number of argument is the most needed 
feature for us?
Graham
23-Dec-2006
[1822]
nope