World: r3wp
[Core] Discuss core issues
older newer | first last |
Oldes 4-Sep-2006 [5251] | And if I use pmap command I can see that there is one bigger memory block which will be probably the preallocated space - then if I create in Rebol for example some string, the memory usage in pmap is not changed although stats increase. |
Cyphre 4-Sep-2006 [5252] | Oldes: I think not all memory allocations of the interpreter are under control of the 'Rebol GC' so the STATS value should be always smaller than the real OS mem usage. |
BrianW 6-Sep-2006 [5253x2] | I've been using the following approach for using a series like a stack, and I was wondering if there was a better way I'd missed: insert my-list item ;; "pop" item: my-list/first ;; "push" part 1 remove/part my-list 1 ;; "push" part 2 I know it's working on the beginning of the series rather than the end, but I had trouble remembering if there is a '"pop" (remove last item from series and return item to caller) sort of function for Rebol. |
Sorry, switch the 'pop' and 'push' comments in my sample. I'm still waking up | |
Anton 6-Sep-2006 [5255x2] | remove removes one value, no need to specify /part .. 1 |
anyway, don't you mean this: item: first my-list ; pop part 1 remove my-list ; pop part 2 | |
BrianW 6-Sep-2006 [5257] | yes. I shouldn't have bothered posting until I finished my coffee. |
Anton 6-Sep-2006 [5258] | :) |
BrianW 6-Sep-2006 [5259] | I'd been using 'x: my-list/1' |
Anton 6-Sep-2006 [5260] | Using a path like that is not safe if you want to pop a function. It will call the function. To avoid that use either FIRST or PICK my-list 1 |
BrianW 6-Sep-2006 [5261] | Thanks |
Anton 6-Sep-2006 [5262x2] | >> stack: [] == [] >> insert stack func [arg][] == [] >> stack/1 ** Script Error: 1 is missing its arg argument ** Near: stack/1 >> first stack >> pick stack 1 >> |
So you get that weird looking error message when using path notation. | |
Oldes 9-Sep-2006 [5264] | How to remove once used word from system/words list? For example if I do>> load [my-word1 my-word2] << The words, are now in the system/words (find first system/words 'my-word1) Is it possible to remove them at this moment somehow (I know that it will be changed in R3)? |
Volker 9-Sep-2006 [5265] | No. |
Gabriele 9-Sep-2006 [5266] | volker is right, there's no way to remove words from system/words. |
Graham 9-Sep-2006 [5267] | if you have a situation where f1: does [ f2 f3 f4 ] .. where all f1 - f4 are functions, is there a way that f2 can cause a return to the calling function of f1. Do I have to throw an error to do this? |
Ladislav 10-Sep-2006 [5268x2] | Graham: I guess you mean something like: f1: func [[throw]] [f2]. |
(my TFUNC does this "more comfortably" and for REBOL3 a change in that direction is planned) | |
Graham 10-Sep-2006 [5270] | Ok. |
Ladislav 11-Sep-2006 [5271x4] | How RETURN works in R2 |
let's define the following function: g: func [f [any-function!]] [f [return 1] 2] | |
now we may test what happens for different argument functions we may supply: | |
>> g :do ; == 1 == 1 >> g func [blk] [do blk] == 2 >> g func [[throw] blk] [do blk] == 1 | |
Ladislav 13-Sep-2006 [5275] | poll: do you find it acceptable that for some numbers load mold number is an error? |
Anton 13-Sep-2006 [5276] | example ? |
Ladislav 13-Sep-2006 [5277x3] | the maximal or minimal possible decimal! values cannot be load molded |
(while they can be computed, if you know how) | |
(do you really want me to present a formula here?) | |
Rebolek 13-Sep-2006 [5280] | IMO it should be moldable |
Ladislav 13-Sep-2006 [5281] | they are moldable, but you cannot load the result back |
Anton 13-Sep-2006 [5282] | Are they valid values or not ? |
Ladislav 13-Sep-2006 [5283] | they are valid |
Anton 13-Sep-2006 [5284x2] | Then they should be loadable, shouldn't they ? There will inevitably be a case where they are needed in a program. |
Are they molded differently somehow ? | |
Rebolek 13-Sep-2006 [5286] | OK, so they should be loadable too :) |
Ladislav 13-Sep-2006 [5287] | every Decimal! is "molded differently" somehow, no decimal is "exactly molded", example: 0.1 is a decimal! , but because the decimal! values are IEEE754 binary floating point, 0.1 is represented as the nearest IEEE754 number, which is not 0.1, because IEEE754 cannot represent 0.1 as you probably know |
Anton 13-Sep-2006 [5288] | Oh, I see. So to make them loadable you would have to mold them with an identifier on the front, (eg. 0d0.1) |
Rebolek 13-Sep-2006 [5289x3] | OK so minimal/maximal decimal! values can be molded as nearset loadable decimal! or not? |
nearset=nearset | |
grr nearest :) | |
Ladislav 13-Sep-2006 [5292x2] | The problem is, that there is some "inaccuracy" involved and the inaccuracy is so high, that the molded maximum is higher than the IEEE754 maximum, i.e. it causes overflow |
this means, that 0d0.1 does not help | |
Anton 13-Sep-2006 [5294x2] | That means the decimal! maximum needs to be pulled back to the highest value which does not cause a problem. |
But I am still confused - how can it be: "decimal! values are IEEE754 *binary* floating point" ? I thought decimal! where using decimal math ? | |
Ladislav 13-Sep-2006 [5296x3] | the solution is not that easy. The problem is, that if somebody gives a number that is higher than all representable numbers, the overflow *should* occur. so we may need higher accuracy instead |
I thought decimal! where using decimal math ? - my favourite example: 0.3 - 0.1 - 0.1 - 0.1 | |
in decimal math the result is exactly zero as everybody knows | |
Anton 13-Sep-2006 [5299x2] | Of course, sorry - confused with deci! ..... (Probably the first of many confusions...) |
Let me read all that again... | |
older newer | first last |