[Core] Discuss core issues
(needs recent rebol for the [integer!]-part)
of course instead of third :f1 you can just copy the source for the argument-list, and maybe add locals.
volker it's not exactly what I needed but I can probably do it this way
I'll try it, when I get home and let you. Thanks
let you know
i thought so. you want to append something to the function body. and to make that use the functions variables, you have to re-func-ing.
but i read now again.
Oh, I did not know I need to re-func it
I'm trying to append something to feel/over so I need to make new, expanded 'over and than replace old 'over with the new one, if I understand you correctly
hmm, not sure what you want to do. the words in the header are not bound to the locals, just names. only the words in the body are bound. done by 'func.
yes, expand a copy of the body (thats second :over), then make a new func with the same argument list. and the old vars are now bound to new function.
Have to go now, I'll try it at home and let you know.
Bye Kru, hpe it works.
volker thanks, now it does exactly what I wanted and I can expand functions
Has anyone seen an Language overview regarding Performance on funtions etc... that includes Rebol ??
somekind of comparisment chart...
Bolek, your first example would have worked too, if you did: append second :a compose [b (second second :a)]
Ladislav nice solution!
Or, more generally: append second :a compose [b (first find second :a 'value)]
; Similar, but you can ensure the position of a word to bind to -- b: func [value][print ["value:" value]] a: func [value][[value] probe value] append second :a bind [b value] first first second :a
This is good with one variable, but what if I've got more variables? (e.g. three like in [face action event])
that is even easier. You justg
...you just need one properly bound variable and you can bind all other code using
the problem is I don't know the name of variable so I was trying to get the new from function arguments, but I did not succeed
...get the name
That makes it difficult -- to bind one context to another, you need that word from the target context. And functions don't have a 'self value like objects. Nor are 'first and 'third values bound to the 'second.
You could loop through the args (first) to find an appropriate word in the body (second), but you rely on and argument word being present in the function body -- does that make sense?
rely on and == rely on an
eg. I don't think it'd be possible to bind any block to -- a: func [x y]
how can i know how many data is beeing uploaded to a site when using write ftp://........we have the read-net or read-thru to know how many data is beeing downloaded but what about writing ???
The UNIX cd command (a one-liner) in REBOL:
cd: func ['dir [file! word!] ][change-dir dirize to-file dir] Now it's possible to type e.g.: cd .. cd rebol/view etc.
Oops! cd rebol/view is not possible. :-)
cd: func ['dir [file! word! path!] ][change-dir dirize to-file dir] NOW it's possible.
Question to myself: Why didn't I just write: cd: func ['dir][change-dir dirize to-file dir] There are many ways to write almost the same thing in REBOL with differenct side-effects. Good or bad!? I'm not sure, but it's fun! :-)
Another version, that will get to back to system/options/path, if 'cd' has no argument: cd: func ['dir [any-type!][either value? 'dir [change-dir dirize to-file dir][change-dir system/options/path]]
get to = "get you"
I put REBOL versions of many often used UNIX commands in a "unix.r" script, that I put in my rebol/view directory, so I can easily get to them, when I have to use the REBOL prompt. Just an idea for others.
An easy one: pwd: :what-dir
There's also the group "*nix-sh" for discussing this.
*nix-sh is a private group ...
Any reason why I shouldn't make it public ?
IS there something terrible in it which annois some people, like hard religion or something? Else i see none.
ok now it's public.
How can I read any char from stdin?
system/console/input. if you need chars, not lines, set it to binary IIRC.