AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 5907 |
r3wp | 58701 |
total: | 64608 |
results window for this page: [start: 45201 end: 45300]
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
TomBon: 18-May-2009 | the numbers for the FIND can be supplied from a copy of the block with UNIQE | |
TomBon: 18-May-2009 | yep, will give it a try, thx henrik... | |
Sunanda: 18-May-2009 | I usually use Joel's tally function -- it saves me the time needed to write a faster function: http://www.rebol.org/ml-display-message.r?m=rmlKDDS | |
Izkata: 18-May-2009 | I think the fastest would be a variation of radix sort, if you know the max/min.. Setup for example: >> Data: array/initial 5000 does [random 200] == [36 119 148 112 87 59 176 21 95 138 183 28 1 119 14 74 39 78 141 99 56 71 47 174 92 81 157 182 122 123 98 73 35 170 150 11 183 8... >> MaxVal: fold Data 0 :max ;Just use a simple loop, I defined fold long ago for simplicity == 200 What I mean: >> Vals: array/initial MaxVal 0 == [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... >> foreach Val Data [Vals/:Val: Vals/:Val + 1] == 27 >> repeat I MaxVal [if 0 <> Vals/:I [print rejoin [I {, } Vals/:I { times}]]] 1, 24 times 2, 20 times .......... 199, 20 times 200, 16 times | |
Steeve: 18-May-2009 | hum, there is a bug, the last value (7) is not precessed, but u got the idea... | |
Steeve: 18-May-2009 | Don't know if it's faster, but it's a bug free and consumes less memory. fast-tally: func [b [block!] /local c u i] [ c: sort copy b u: unique c i: 1 forall u [ c: any [find c u/2 tail c] u/1: as-pair u/1 negate i - i: index? c ] c: none head u ] | |
Steeve: 18-May-2009 | Should be a little better... fast-tally: func [b [block!] /local c u i] [ c: sort copy b u: unique c i: 1 until [ c: any [find c u/2 tail c] u/1: as-pair u/1 negate i - i: index? c tail? u: next u ] c: none head u ] | |
Steeve: 18-May-2009 | izkata, in R2 maximum-of is a native function. with that, your solution should be defintivly the fastest | |
TomBon: 19-May-2009 | this is great, very fast code. thanks a lot for this. the code is used for generating dynamic parsing rules for financial market data. soon I will release a free software based on this data. | |
Steeve: 19-May-2009 | Seems that Tally is faster with R3. 2 reasons: SORT is faster MAXIMUM-OF is not anymore native (btw some of us claimed that it was a bad idea to have maximum-of not anymore native in R3, But will claimed in the desert, so now we can see the drawback) | |
Izkata: 19-May-2009 | I would definitely prefer a native fold-type function over maximum-of and minimum-of | |
BrianH: 19-May-2009 | We tried, but that has definitely been declared an R3/Plus function, not native. Making ACCUMLATE? native wouldn't help much - the mezzanine version is really fast already. You won't be able to get functional language speed even from a native because that requires compiler support, and REBOL doesn't have a compiler at all. | |
BrianH: 19-May-2009 | R3/Plus has a low barrier to entry, because it will be modular. People can just not include the modules they don't need. Conversely, there will be a high standard for inclusion as mezzanine or built-in native code because you won't as easily be able to remove it if you don't need it. Many R2 mezzanines, and even some natives won't make the cut. | |
Graham: 19-May-2009 | page: read/custom [ scheme: 'http host: "twitter.com" target: "direct_messages/new.xml" user: "my-twitter-id" pass: "mypassword" ] [ POST "text=This was also sent from a Rebol&user=synapse_emr" ] This sends a private tweet to a user ... not clear from the API docs what the call is to just tweet ... anyone know? | |
Maxim: 19-May-2009 | this is easy to figure out using firebug ;-) redirect the html page to a server you have cheyenne running and save out the whole http request, you will have url and post data :-) | |
Graham: 19-May-2009 | But there is a twitter restful api ... just can't find it there. Must be blind. | |
Steeve: 19-May-2009 | speed is a priority especially with Rebol which can be really slow if you don't take care | |
Janko: 19-May-2009 | functional: reduce [ "hi " (either is-male? gender [ "boy" ] [ "girl" ]) , "how are you?" ] vs imperativeish: a: "hi " either is-male? gender [ append a "boy" ] [ append a "girl" ] append a " How are you?" a | |
Janko: 19-May-2009 | so although I got impression from Carl's blogposts that he thinks rebol should be practical vs. functional , I think a lot of it's power and elegance and practicality come from functional aspects of it (just expressing my opinion) | |
Graham: 19-May-2009 | This works ... posting a message is actually called updating your status! page: read/custom [ scheme: 'http host: "twitter.com" target: "statuses/update.xml" user: "my-twitter-id" pass: "mypassword" ] [ POST "status=Playing with REBOL and the Twitter API" ] | |
Henrik: 22-May-2009 | is there a quick way to tell if an integer overflows? I'm missing an overflow? function: overflow? 632479375863785946758934675892 == true | |
Maxim: 22-May-2009 | unfortunately this might not work... to-integer sometimes returns a decimal... unlesss its been fixed for 2.7.6 | |
BrianH: 22-May-2009 | It should work - always return integer! or error! - if the input is a number! (as specified in the type test of the argument. TO-INTEGER would only have that problem with string input. | |
Graham: 26-May-2009 | any good reason apart from the fact that data is a block that this is not allowed? forskip data: [ 1 2 3 4 ] 2 [ ] | |
Graham: 26-May-2009 | Is that a good reason? :) | |
Graham: 27-May-2009 | Maybe this should be changed so that a default word is used instead ... | |
Graham: 27-May-2009 | if a lit-word is not supplied as an argument but a block | |
Graham: 27-May-2009 | seems a reasonable suggestion. | |
BrianH: 27-May-2009 | FORALL and FORSKIP are faster than FOREACH in R3 because they don't have a local word that requires a BIND/copy of the code. | |
Dockimbel: 27-May-2009 | Wouldn't it be more efficient to just BIND instead of BIND/copy body blocks in loops by default, and additionnally provide a /copy refinement in the (very) rare cases where you don't want the body block to be modified? Is it a design decision or did I missed some obvious reason? | |
Dockimbel: 27-May-2009 | I agree, using recursion for walking through hierarchical structures is a good approach as these structures usually have a depth limit far below the stack limit (e.g. parsing XML data) . In the last years, I've found that using block parsing for block! trees walking was probably the most efficient approach (code size and speed wise). | |
Steeve: 27-May-2009 | even in that case, i prefer to code an emulated stack (using a block) | |
BrianH: 27-May-2009 | Here's an example: Come up with a recursive-parse-rule version of the ARRAY function, including the function value calls. Compare. | |
BrianH: 27-May-2009 | Wait, bad example. ARRAY is generative, so it is likely a bad candidate for PARSE. | |
Maxim: 27-May-2009 | afaik the rebol stack goes a few thousand funcs before failing... but that depends on the amount of params you have on the functions, more args = more stack use. | |
Maxim: 27-May-2009 | rebol stack limit: >> i: 0 a: func [][i: i + 1 a] a ** Internal Error: Stack overflow ** Where: a ** Near: i: i + 1 a >> i == 14265 | |
Dockimbel: 27-May-2009 | REBOL/Core 2.5.0.3.1 >> i: 0 a: func [][i: i + 1 a] a ** Internal Error: Stack overflow ** Near: a >> i == 3151 | |
Izkata: 27-May-2009 | Rebol/View 2.7.6, 64-bit Ubuntu Hardy >> i: 0 a: func [][i: i + 1 a] a ** Internal Error: Stack overflow ** Where: a ** Near: i: i + 1 a >> i == 1705 | |
Dockimbel: 27-May-2009 | So WindowsXP is more recursion-friendly than Leopard...finally a good argument to not switch to MacOSX! ;-) | |
Izkata: 27-May-2009 | >> i: 0 a: func [z][i: i + 1 a 1] a 1 == 1704 >> i: 0 a: func [z y][i: i + 1 a 1 2] a 1 2 == 1706 >> i: 0 a: func [z y x][i: i + 1 a 1 2 3] a 1 2 3 == 1705 | |
Maxim: 27-May-2009 | possibly the stack includes a single payload block for calls... this would make sense, in preventing stack depth variance. | |
Maxim: 27-May-2009 | possibly, yes, by indirection. push stack [func args-block] and args-block is a mem copy of the args block with local values | |
BrianH: 27-May-2009 | This is why the R3 host code is separate, and will be open-sourced. The host code is non-portable. The VM can call API functions provided by the host code. This would be necessary for a variety of reasons, not the least of which is that memory management, tasking, networking, any number of things are implemented by different platforms differently. | |
Henrik: 29-May-2009 | http://www.openldap.org/lists/openldap-devel/200304/msg00123.html Anyone made a REBOL version of this? It's a UTF-8 <-> ISO-8859-1 converter in C. | |
Maxim: 29-May-2009 | hasn't peterwood just uploaded a pretty nice string en/decoder on rebol.org? | |
Maxim: 30-May-2009 | peterwood can I make a wish? I really need a function which can detect if a file is binary or text... do you think its possible to have such capabilities in your module? | |
Sunanda: 30-May-2009 | I have a printable? function that checks if a string has only ASCII printable characters. Would that meed your need, Maxim? | |
Maxim: 30-May-2009 | its already very usefull, its for detection of how to process files in distro-bot. right now it just treats any non rebol script as a binary, but I'd like to add some processing to other text files. maybe peter can extend the concept and figure out if there are only printable characters in other encodings :-) | |
Graham: 7-Jun-2009 | Doesn't seem a very suitable name for what it does ... | |
Sunanda: 7-Jun-2009 | 'alter was always a poor choice of name -- short for 'alternate apparently, but too short to be obvious. Anton has suggested 'toggle as a better name for it. | |
Graham: 7-Jun-2009 | toggle implies something is always there ... but in a different state. Swap is to imply that something goes in and out :) | |
Henrik: 7-Jun-2009 | I've used ALTER once for user selection in a list, and it was even a special case. I think having the ability to just conditionally append to a block if the value does not exist is more useful. I.e. an ALTER, split in two functions. | |
Graham: 7-Jun-2009 | >> a: [ b b c d ] == [b b c d] >> alter a 'b == false >> a == [b c d] | |
Sunanda: 7-Jun-2009 | 'alter is a hard one to name. The operation is: * if the target value exists in the series: remove the first instance of it * if it does not exist in the series: append it to the end. The "remove first instance" makes it more generic than rotate/swap/toggle when there is more than one instance of the target in the series. | |
Chris: 7-Jun-2009 | 'cull would be a great name for 'remove-each : ) cull deer herd [deer = not smart] | |
BrianH: 7-Jun-2009 | In theory, ALTER is a set function, so the series in question is not supposed to have duplicates. | |
Sunanda: 7-Jun-2009 | You are quite right -- 'alter is still in R3 ..... My mistake. Several of REBOL's set operations operate on series. Series are more like bags than sets, hence they can have duplicate values. That adds value for a programmer, but dilutes academic purity. Perhaps 'alter could have a purer set defintion by becoming a no-op if the target value exists more than once in the series. | |
amacleod: 7-Jun-2009 | Is there a way to adjust computer time from rebol? | |
amacleod: 7-Jun-2009 | you are a real tease, Graham. | |
amacleod: 7-Jun-2009 | No matter what I change the rime zone to on the computer I get a rebol time with -4:00 | |
amacleod: 7-Jun-2009 | Got it..thanks Graham... Here are three lines that adjust the time zone and time of the local computer after checking time with a server with a daytime server running: call "RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Eastern Standard Time" a: to-date read daytime://myserver.com b: a/time call rejoin ["time " b] | |
amacleod: 7-Jun-2009 | I guess it might be off by a second or less ...close enough | |
Graham: 8-Jun-2009 | I originally hard coded one time server into my program as in Ladislav's example, but I had the misfortune of that time server being out of action for a few weeks which introduced a 30 second timeout when my program started up. Now i adjust the timeout to a much shorter value, and randomize from a pool of time servers. And then restore the timeout value. | |
amacleod: 10-Jun-2009 | What am I doing wrong here?? given a block of blocks: [ [67 "FFP Vol.2 - BASIC ENGINE OPERATIONS" "Chapter 1 - INTRODUCTION" "1.1"] [69 "FFP Vol.2 - BASIC ENGINE OPERATIONS" "Chapter 1 - INTRODUCTION" "1.3"] [68 "FFP Vol.2 - BASIC ENGINE OPERATIONS" "Chapter 1 - INTRODUCTION" "1.2"] [71 "FFP Vol.2 - BASIC ENGINE OPERATIONS" "Chapter 1 - INTRODUCTION" "1.2"] [268 "FFP Vol.2 - BASIC ENGINE OPERATIONS" "Chapter 1 - INTRODUCTION" "1.2"] [721 "FFP Vol.2 - BASIC ENGINE OPERATIONS" "Chapter 1 - INTRODUCTION" "1.2"] ] Using alter to remove each block in a loop: foreach z a [alter a reduce [z] probe a wait 3] with a being the blocks above | |
amacleod: 10-Jun-2009 | It seems to work for the first two but than skips a block and than fails... | |
amacleod: 10-Jun-2009 | same result using find-remove: foreach z a [if find a reduce [z] [remove a reduce [z]]] I get three left over blocks i I run it again I get one left over block and f I run it a final time it reoves the final block | |
Izkata: 10-Jun-2009 | foreach will advance to the next index whether or not the series was modified: >> D: [1 2 3 4 5 6 7 8 9] == [1 2 3 4 5 6 7 8 9] >> foreach X D [remove find D X] == [] >> ? D D is a block of value: [2 4 6 8] | |
Izkata: 10-Jun-2009 | Using remove-each is better for this: >> D: [1 2 3 4 5 6 7 8 9] == [1 2 3 4 5 6 7 8 9] >> remove-each X D [integer? X] == [] >> ? D D is a block of value: [] | |
amacleod: 10-Jun-2009 | I'm a dope...Thanks for the clue... I used another 'variable' to what I needed...it works now! | |
Gregg: 11-Jun-2009 | Modifying a series you're iterating over is always risky. Not only do you have to make sure you get it right, but there is always a possibility that iterators might change their behavior. | |
Janko: 13-Jun-2009 | I was already thinking a little that you probably don't really need them since you can change/generate code structures at startup or "JIT" and "cache" them ... but it was just a hunch.. not something I could imagine all the way down ... | |
Ladislav: 13-Jun-2009 | perf. penalty: REBOL, due to its "philosophy", is an iterpreted language, which is a "performance penalty" against compiled languages, yes. But who cares? I have seen many compiled programs much slower than what I was able to write in interpreted REBOL. | |
Janko: 13-Jun-2009 | I sometimes have some stupid ideas of changing code and blocks into something else but I don't have a totally clear view yet if that is ok to do and what would be the right way to do that. | |
Janko: 13-Jun-2009 | I have one example ... it was fun to make but all in all doesn't seem a good idea so I don't use it now (I think it's not really robust and it gives strange errors.. not 100%), I am not sure.. would classic macros make it more possible, this all make changes at runtime: any-is?: func [ 'PRE s ] [ while [ not tail? s ] [ s: next insert s PRE ] any reduce head s ] ; usage if any-is? empty? [ d-y d-m d-d title category ] [ print "Error some value is empty: " fail: true ] if any-is? positive? [ apples oranges kiwis grapes ] [ print "There is some fruit in your fridge" ] if any-is? [ not empty? ] [ a b ] [ print "yup" ] if any-is? [ 5 < ] [ num1 num2 ] [ print "yup" ] if any-is? [ 5 < length? ] [ str1 str2 ] [ print "yup" ] | |
Maxim: 13-Jun-2009 | janko, that's a great function! | |
Janko: 13-Jun-2009 | I am not sure what was the problem .. it's a while since I used it .. I just thought this function can't be good .. | |
Janko: 13-Jun-2009 | it works in general cases and I have it in some older code .. maybe errors got a little strange if datatype didn't match the PRE function ... like empty? none ... I can take some time and test it again | |
Maxim: 13-Jun-2009 | the copy is a good idea though, cause if you use it for real data, some functions can mangle the content of the block. I'd even do a copy/deep | |
Maxim: 13-Jun-2009 | copy could optionally be a refinement, if you know that the test isn't destructive... cause copy will be a performance hit . | |
Janko: 13-Jun-2009 | maybe this behaviour was bugging me .. because I know I use the order of things in any or all a lot of times to avoid null errors and similar .. and any-is? always preprocessed all elements | |
Maxim: 13-Jun-2009 | very ;-) I fixed a little issue with interdependant libraries last month, but a part from that it has remained the same for years. | |
Maxim: 13-Jun-2009 | I use slim and prebol together within the sdk, it works very well. I should use %include.r though, its much better and would solve a few little complexities I have with using the prerebol.r | |
Ladislav: 13-Jun-2009 | it is quite surprising for me, that Carl is not a fan of the PREBOL approach, taking into account, that he invented it. I had a version of INCLUDE before PREBOL came and adapted it to the PREBOL standard afterwards | |
Ladislav: 13-Jun-2009 | ...but INCLUDE (in essence) is just a combination of PREBOL and DO, so nothing really new | |
Ladislav: 13-Jun-2009 | Not invented here may be a problem... | |
Maxim: 13-Jun-2009 | but now that he has a group of like-minded people, changes are much lower that we don't think in the same lines. | |
BrianH: 15-Jun-2009 | Use a get-word. | |
Henrik: 16-Jun-2009 | If you make an object with images, blocks and a lot of data and then set the object to none, and the data inside is not referenced elsewhere, will everything else inside be properly deallocated? | |
PeterWood: 16-Jun-2009 | Perhaps not - >> stats == 67680368 >> a: make object! [ [ b: make block! 1000000 [ c: make block! 1000000 [ d: make block! 1000000 [ e: make block! 1000000 [ f: make block! 1000000 [ ] >> stats == 167685587 >> a: none == none >> stats == 167686079 >> recycle >> stats == 167685527 | |
PeterWood: 16-Jun-2009 | Which is probably to be expected as the values referenced by the fields in the blocks have not been de-referenced. Looks as though you'll have to do it yourself: >> stats == 167686051 >> a: make object! [ [ b: make block! 1000000 [ c: make block! 1000000 [ d: make block! 1000000 [ e: make block! 1000000 [ f: make block! 1000000 [ ] >> stats == 267690882 >> a/b: none == none >> a/c: none == none >> a/d: none == none >> a/e: none == none >> a/f: none == none >> recycle >> stats == 167687087 | |
PeterWood: 16-Jun-2009 | I'm sure there's a better way but this should work: >> foreach word remove first a [do join "a/" [word ": none"]] ;; provided your object is called a | |
Steeve: 16-Jun-2009 | in R3, >>set a none | |
Steeve: 16-Jun-2009 | in R2, that should work >> set bind first a a none | |
Steeve: 16-Jun-2009 | hmm... >>set a none It works for both... | |
BrianH: 16-Jun-2009 | Peter, here's some R3 fun. To do the initial block allocation in R3: a: make object! 5 foreach w [b c d e f] [extend a w make block! 1000000] or maybe this way: a: object [b: c: d: e: f:] foreach w a [set w make block! 1000000] To clear your way: foreach w a [set w none] Of course Steeve's method works too, and better :) | |
Maxim: 16-Jun-2009 | henrik: the GC doesn't deallocate on demand... you can have several hundred megs of RAM allocated... and sundendly the RAM goes down. and some things do not cause the rebol executables to shrink. images, in my experience cause memory leaks, where they never get de-allocated from RAM under some circumstances. in theory if you remove all references to a context, its content is supposed to deallocate, but when passing anything through view, all bets are off. I've had 400MB pictures stay stuck in RAM, with absolutely no GC happening, not even going through view... just loading the image, without assigning it... its stuck :-( | |
Maxim: 16-Jun-2009 | that's a nice improvement in R3 | |
Maxim: 16-Jun-2009 | load %some-image.png not even assigned once... causes a permanent memory use in the last version of which I had to use huge images. I ended up using image magic which was able to use the equivalent of 20 GBs of image data in a single 75 minute composition. | |
Ladislav: 16-Jun-2009 | yes, but that is a different matter | |
Henrik: 16-Jun-2009 | that's quite a problem, but is it possible to allocate space and load new image data into that location? |
45201 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 451 | 452 | [453] | 454 | 455 | ... | 643 | 644 | 645 | 646 | 647 |