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: 3401 end: 3500]
world-name: r4wp
Group: Rebol School ... REBOL School [web-public] | ||
Sunanda: 11-Mar-2013 | Nick -- sounds like you want an algorithm that, say, returns the next 50 -- that way you can work with a window rather than have to generate all perms in one gulp. Some of the offered solutions should be easily adaptable in that way. | |
NickA: 11-Mar-2013 | Ladislav, can you make one which performs faster than Steeve's? Sunanda, paging through windows of is a great way to be practical. I'm more concerned with finding the fastest algorithm - no reason - just frustrated with myself for sitting last night for longer than I wanted with a CS101 type problem ;) | |
NickA: 11-Mar-2013 | Just out of curiosity, has anyone written a difinitive article about the performance of various looping structures in REBOL? I remember some discussion about it several years ago, related to how badly REBOL did in the language "shootout" benchmarks (lots of "for'" loops, if I remember correctly). That would be a nice article to have available. | |
BrianH: 11-Mar-2013 | FOR has bind/copy overhead in R3 and is a complex mezzanine in R2, so I only use it when it is really appropriate. | |
BrianH: 11-Mar-2013 | UNTIL is native in both too, basically a slightly simplified WHILE. | |
BrianH: 11-Mar-2013 | R3 is currently missing anything like the feature that made it possible to write really well-integrated mezzanine control structures, instead turning all such control structures into natives. Which was a problem before R3 was open sourced, not as much of one now. | |
Sunanda: 11-Mar-2013 | Nick -- Have you looked at using a variable base algorithm? It may be fast, and it should be amenable to windowing: http://rosettacode.org/wiki/Permutations/Rank_of_a_permutation Even if neither, it should be fun to write the script. | |
Ladislav: 11-Mar-2013 | FOR ... is a complex mezzanine in R2 , with a lot of bugs, I have to add | |
BrianH: 11-Mar-2013 | Do you have a non-buggy version? I'd love to add it to rebol-patches, with your permission. | |
Ladislav: 11-Mar-2013 | Hmm, I do (I once submitted it to Carl, but he never used it). Nevertheless, in my code I prefer a general loop called CFOR (the name is unfortunate, I must admit). That is what I propose instead since it is both faster and more flexible at the same time. Do you think it makes sense to propose it in the CC? | |
Ladislav: 11-Mar-2013 | Any good idea of a Rebol-compatible name for it? | |
Ladislav: 11-Mar-2013 | The trouble with FOR is not only that it has bugs. Another problem is that it is incompatible with REPEAT, while assumed to be a generalization of it... | |
BrianH: 11-Mar-2013 | I remember CFOR, it was interesting. It's not FOR compatible though. What I was hoping to put in rebol-patches was a function with the same API as FOR, but without the bugs. Additional functions are great too, but out of scope for the rebol-patches project. | |
Ladislav: 11-Mar-2013 | Hmm, I actually do not propose to use my patched FOR since it is extremely slow like the original, I think it would make more sense to use a more REPEAT-compatible version of it, which I do not have now. | |
BrianH: 11-Mar-2013 | I don't recommend using FOR in R2, patched or not, but I would rather have a patched version than a non-patched version. That's the whole point to rebol-patches. I don't judge the functions in some philosophical or practical way, I just make sure they at least work. | |
Ladislav: 11-Mar-2013 | or, to tell it differently: I prefer to have a version of FOR which would be more R3 FOR compatible... | |
BrianH: 11-Mar-2013 | Can that be done without breaking too much code? Because if so, that would definitely be in the project scope. A native FOR replacement would be ideal, but we can't change existing R2 versions to have always had such a function in the past. The rebol-patches project is for bringing up the compatibility and fixing known bugs when run on existing R2 versions. I hope to push its compatibility all the way back to 2.5.0. Replacing FOR with a non-buggy native version in some future R2 release would just mean that for that version going forward rebol-patches wouldn't need to patch that particular function. | |
BrianH: 11-Mar-2013 | So unless you have a way for rebol-patches to perform a retrofit of an existing R2 version with a new native function using cross-platform code, we're going to need not only the mezz patch for the past and the native for future R2 releases (if any). | |
BrianH: 11-Mar-2013 | How would it be different? Do you have a link to one of those articles you write about this kind of thing? :) | |
Sunanda: 13-Mar-2013 | SKIP's offset arg can take a pair! -- Can someone show me an example of doing that? | |
GrahamC: 13-Mar-2013 | that's for moving across a bitmap isn't it? | |
Sunanda: 13-Mar-2013 | Also interested in usage example for TAKE/DEEP where the /deep can be a pair! | |
GrahamC: 13-Mar-2013 | auto-crop-bitmap-text: func ["Returns a cropped image, or none if the input image was blank" image [image!] /local region ][ if region: find-bitmap-text-crop-region image [ copy/part skip image region/1 region/2 ; return a cropped image ] ] | |
BrianH: 13-Mar-2013 | The bitset type could be thought of as a one-dimensional bitmap of depth 1, but that's stretching the defitnition a little :) | |
BrianH: 14-Mar-2013 | No, because TAKE removes from the original, and that would change the dimensions of the original in the case on an image, assuming it's possible (you can't take a hole from the middle, for instance). So you mean COPY/part here. | |
Sunanda: 14-Mar-2013 | My confusion is due to the help for TAKE saying the /DEEP arg can take a pair! -- So I was looking for a usage case. | |
BrianH: 14-Mar-2013 | Well, maybe it was intended to work on image (if so, sorry). I'd have to review the R2/Forward code to be sure, since its version of TAKE would have replicated that. It's a really weird thing to do to an image though. | |
BrianH: 14-Mar-2013 | The R2/Forward TAKE makes reference to an image in its code, but not in its typespec. Weird. A bug? | |
Bo: 14-Mar-2013 | BrianH: If I wanted to take a subsection of an image, why wouldn't it create a new image with just that subsection, and then replace the "taken" part in the old image with 0.0.0? Or am I understanding the purpose of 'take incorrectly? | |
Sunanda: 16-Mar-2013 | Here's a starting point for such an article..... http://www.rebol.com/docs/expert-intro.html | |
BrianH: 16-Mar-2013 | Bo, TAKE physically removes stuff, it doesn't leave a hole. | |
GrahamC: 19-Mar-2013 | You can't yet because we can't calculate a sha256 .. we only have sha1 | |
Bo: 19-Mar-2013 | I'm looking into pitching a Rebol programming class to the community college here (I'd teach it). I know of NickA's excellent tutorials. What would you all suggest for a class text. | |
caelum: 19-Mar-2013 | I found the 'Rebol for Dummies' book quite disappointing for my personal use, but it might be good as a course book though. It certainly covers a lot of ground quickly. I personally preferred Nick's video series http://re-bol.com/rebol.html.Somehow more interesting and easier to digest. Just my personal experience. | |
PeterWood: 19-Mar-2013 | Is the class for new programmers or people new to programming? If the latter, Olivier Auverlot's REBOL - A Programmer's Guide" might suffice. Full disclosure - I translated the book from French to English. The content of the book is a little dated by newer than Official and Dummies. | |
caelum: 19-Mar-2013 | After looking at 'Rebol for Dummies' again, that is what I'd recommend for a community college course. Even if a little dated. | |
NickA: 19-Mar-2013 | @Graham - thank you, yes I'm aware we only have sha1. It looks like OpenSSL, PolarSSL, MD5Deep, cryptlib, and a bunch of others are out there. Have you used any successfully with AWS? | |
Endo: 20-Mar-2013 | There is a beginner's level View/VID part too. | |
Bo: 20-Mar-2013 | PeterWood, caelum and Endo: Thanks for the ideas. I've seen Olivier's book, but I don't have a copy myself. That might be a good choice. | |
Arnold: 21-Mar-2013 | I used that to get really more familiar with REBOL. It is a good introduction, unfortunately it is not finished. The up-to-date is less bothering for it is the basics that's covered and those are the same still. | |
Ladislav: 22-Mar-2013 | MaxV: one more improvement to the text; I wrote: c: closure [a [number!]] [func [b [number!]] [a + b]] , but, actually, I think that c: closure [a [number!]] [closure [b [number!]] [a + b]] wold look better (more uniform) | |
DocKimbel: 22-Mar-2013 | The "series copy trap" is what makes me hesitate about making closures the default function constructor. I think it should not be a "trap" in the first place, it is just undocumented, while it should IMHO be very clearly explained in the series chapter. Understanding how literal series behave is an important step in understanding Rebol. | |
Endo: 22-Mar-2013 | Ladislav: "** Script error: a word is not bound to a context. -That is actually better than what you get in R2" Why is that? | |
Ladislav: 22-Mar-2013 | This is what you get in R2: f: func [a [number!]] [func [b [number!]] [a + b]] g: f 1 h: f 2 >> g 1 == 3 , this is much worse than error! | |
Maxim: 22-Mar-2013 | I don't agree, because 'H is defined within context of 'G and uses 'H binding. its both consistent and logical... because Rebol binding is supposed to be static. in the above example, I'd say the construct itself does what it should, but the real question is should one usually do this... no. I understand its a trap, but its not a trap for which the language is responsible, the user is simply leveraging the language. | |
Maxim: 22-Mar-2013 | you have two functions which share a parent context. | |
Maxim: 22-Mar-2013 | ah... but expectation has nothing to do with implementation or logic. expectation is *SOLELY* related to prior knowledge. so this is not a question of what *it* should do but of what *you* expect it should do. :-) | |
Ladislav: 22-Mar-2013 | Closure is my "child" in a sense. I wrote it because I found it is what people want to have. | |
Ladislav: 22-Mar-2013 | (I wrote only a mezzanine "template", and suggested some tricks, but Carl wrote the actual implementation using my hints) | |
Ladislav: 22-Mar-2013 | ...and I know he used my advice obtaining a noticeable improvement | |
Maxim: 22-Mar-2013 | testing of binding itself on class vs prototype based oop for Rebol was several orders of magnitude when dealing with large objects. both in speed and RAM. I admit my tests are more on the extreme side of things, with the object in question taking up 80kb of RAM for every new instance. but when grouping up the functions of the object into a "sub" object, like face/feel, instead of letting them live within the face itself, speedup was exponential. at 1000 objects it was probably about 10 times faster, at 10000 objects it was about 25 times faster and I couldn't even allocate 100000 prototype objects and it crashed after a full 76 minutes of crunching at 100% CPU. a 1'000'000 object test with "classes" took 4 minutes and 400MB... so you can see that binding is a very significant part of the processing of Rebol, when it is required often. obviously, some peeking into the C sources will allow us to optimize all of this, (especially if it can be memcopied directly) but by default, as in R2, closures would theoretically be quite a hit in performance. | |
Maxim: 22-Mar-2013 | related, tests which show that run-time rebinding must be avoided at all costs. if closures are forced to rebind, there will be a hit. my question was initially to know if you had done tests with closure itself... cause I am curious how well it compares to the default case of doing it all on the interpreter side. | |
Ladislav: 22-Mar-2013 | Here is an example with a complex body: f: func [n x y] [ loop n [ loop n [ loop n [ x + y ] ] ] ] c: closure [n x y] [ loop n [ loop n [ loop n [ x + y ] ] ] ] >> time-block [f 10 10 20] 0,05 == 0.00017675781250000002 >> time-block [c 10 10 20] 0,05 == 0.000158203125 | |
Ladislav: 23-Mar-2013 | See also http://issue.cc/r3/1946 to note that there is almost no limit how much more inefficient can R3 functions be compared to closures. This is unacceptable taking into account that R3 functions purportedly are a "compromise solution" sacrificing correctness, reliability, comfort for speed. | |
SWhite: 4-Apr-2013 | OK, now I know the answer and it is time to confess it. I have complained a number of times about how obscure REBOL is (to me) and how I sometimes can look at ONE LINE of code and not understand it. I wonder, is it REBOL, or is it me. Well, I am learning python for work, and I want to replce the html lt and gt symbols with their character entities or whatever they are called, I found a sample on the internet, wrote up a test program, copied the sample, and it worked. So here I am looking at ONE LINE of python code and I don't understand how it works. So, the answer to, is it REBOL or is it me, is, IT'S ME. I think I'm in the wrong line of work. | |
Arnold: 4-Apr-2013 | In most languages it is possible to do things in one line. Very often the result is that it is hard to understand what happens in that line. In the light of maintainable code I have the attitude that I rather deal with less comlicated code that is possibly a little slower. If that is not an option (most of the time performance stays way within limits even if it is readable) then I leave a big comment what the code is about. For sure the next guy/girl will appreciate this when it is their turn. There have been many occasions that I myself was the assigned the next adaptations and only a few months later these comments really were helpful. | |
Arnold: 4-Apr-2013 | And leaving complicated code without comments because you understand it (at the moment of creating the code) is also bad practice. As a professional coder I comment a lot, maybe because sometimes it is not appealing to come back later for more headaches from bad coding practice from colleagues ;) | |
caelum: 14-Apr-2013 | Yes, I left a message for him. But he has not been here for a couple of months. | |
Artful: 23-Apr-2013 | ok silly newbie question here. I'm trying to run some scripts in rebol/view 2.7.8 which produce just console output. I'm finding the output window automatically closing when the script ends. I know I could fix this with a readline statement, but I'm wondering why the auto-close in prefs.r isn't working for me. I'm also trying to run same script via dos window, using rebol.exe -ws test.r but that opens an output window rather than display to the dos window. I feel such a noob lol. | |
Gregg: 23-Apr-2013 | Not to worry. We were all noobs once. REBOL automatically quits at the end of the script. If you want to keep the cosole open, put a HALT at the end. | |
Gregg: 23-Apr-2013 | But someone is usually here to throw you a life preserver. | |
Endo: 24-Apr-2013 | >> x: next [a b] USE x [a: 1] print a ** Script Error: a has no value Why USE make 'a local on above example while X is [b] ? | |
Endo: 25-Apr-2013 | I know, it is not a big deal, I was just curious if there is a reason.. | |
PatrickP61: 2-May-2013 | Quick Question: I'm having some trouble understanding ANY. I thought it meant that you could state a condition such as IF var = ANY ["val1" "val2"] [do something] But that only becomes true on the first condition, not the second. Example code: >> forever [do cmd: ask "? " if cmd = any ["quit" "q"] [print "done" break]] ? q ? quit done >> what am I missing? | |
MikeL: 2-May-2013 | The first value in your ANY block is "Quit" which is not a TRUE. | |
MikeL: 2-May-2013 | The second is "Q" which is also not a TRUE. | |
PatrickP61: 2-May-2013 | Ok, so ANY is simply a way to pass back a value that is not false? | |
Gregg: 2-May-2013 | So it evaluates each value in the block you give it, and as soon as it hits a value that is not false or none, it returns that value. So, in your case, it will always return "quit". | |
PatrickP61: 2-May-2013 | so in my case ANY ["quit" "q"] will ALWAYS return "quit" since it is a valid expression | |
Gregg: 2-May-2013 | So think of how to solve it other ways. ANY evaluates, so you could put your comparison expressions inside the ANY block. That will get unwieldy very fast though. How else might you do it? What is it you want to do (in a general sense)? | |
PatrickP61: 2-May-2013 | My goal is to simply stay in a loop, accepting all valid rebol commands until I quit the loop For example, I've defined some variables to script names, and so when I enter the variable, it should DO those names, until quit | |
Gregg: 2-May-2013 | And for the case of q and quit, and maybe others, you want to see if they command is in a set of commands you want to process in a special way, correct? | |
Gregg: 2-May-2013 | That is, you want to see if you FIND the command in a set of known commands and act accordingly. | |
PatrickP61: 2-May-2013 | not really, it's just a quick shortcut to allow any REBOL command to be performed while it is in a script that is already executing. ...doing stuff... stopping here to accept various rebol commands and looping until finished ...doing the rest of the script | |
PatrickP61: 2-May-2013 | Its a way to "pause" a running script to enter rebol commands and then when I'm done, get out of the loop and continue with the rest of the script | |
Gregg: 2-May-2013 | Right, so you ask for the command, see if it's a command to exit your loop (q or quit) and DO it if not, correct? | |
Andreas: 2-May-2013 | Was just askin about R3 vs R2 :/ I fear you hit a known bug in R3. | |
Gregg: 2-May-2013 | So I would still hold the result of ASK in a temp var, rather than DOing it directly and relying on the bug's behavior. | |
Endo: 4-May-2013 | May be we should create a "R3 School" and rename this group to "R2 School"? So we do not have to ask for version for every question asked in this group. What do you think? | |
PatrickP61: 7-May-2013 | In R3, I want to be able to request a specific directory quickly and easily. The easiest way I've found is to use REQUEST-FILE since it allows the user to quickly "navigate to" the desired directory. Thing is, it requires the user to pick an existing file , even though I don't care about the file itself. In most cases, this is fine since the user can pick any one of the files, but in cases where a directory is empty of a file, I have a problem. example code: request-file/file to-file join "/" second parse what-dir "/" <-- I use this to default the directory at the highest level is ie %/c Is there a better way to do this in R3? | |
PatrickP61: 7-May-2013 | I'm using 2.100.111 and no REQUEST-DIR, unless it was added in a later version | |
Cyphre: 7-May-2013 | (check the OS_Request_Dir() function in src\os\win32\host-lib.c as a base for the feature) | |
PatrickP61: 7-May-2013 | I am trying to troubleshoot a peculiarity in R3 2.101.0 from Saphirion >> print type? what-dir file! <-- Ok, it's a file, even if has an end slash instead of a specific file path >> print type? request-dir ; select any directory file! <-- Ok, Same thing So it stands to reason that passing the value returned by WHAT-DIR and by REQUEST-DIR will be FILE! | |
Andreas: 8-May-2013 | Patrick, simple fix: if you expect INP-DIR do be a file refering to a directory, sanitise it through DIRIZE: `read-dir dirize inp-dir`. | |
Andreas: 8-May-2013 | The underlying problem indeed is related to a bug in R3. Both directories and files are represented by file! in R3. R3 uses a heuristic that a trailing slash discernes file file!s from directory file!s. Now when you pass a file! without a trailing slash but which actually refers to a directory to READ, READ crashes. (Bug#1675) | |
Andreas: 8-May-2013 | Now if REQUEST-DIR returns a file! without a trailing slash, passing that returned value directly to READ will trigger this bug. | |
PatrickP61: 8-May-2013 | Back again. Thank you Andreas, I had realized that FILE! was used for both directory and files, but I didn't realize that REQUEST-DIR was NOT sending it back as a directory, but as a file (without trailing slash). I was able to confirm by adding a print of WHAT-DIR and INP-DIR and compare, as per your comments. I did not know about DIRIZE Using READ DIRIZE INP-DIR does fix the problem -- though I wonder if REQUEST-DIR should return it with a trailing slash? Thanks again to all! | |
Andreas: 8-May-2013 | Yep, I think REQUEST-DIR should return a dirized file!. | |
PatrickP61: 8-May-2013 | Hey all, I'm having such a good time learning again! I've got some code to generate a print ruler, but I think it could be cleaned up a lot more. If some of you have a quick moment, could you take a quick look and advise me on how to shorten this code. ruler1: copy ruler2: "" idx: 0 loop 110 [ idx: idx + 1 append ruler1 "_" append ruler2 last-digit: last to-string idx if last-digit = #"5" [ clear back tail ruler1 append ruler1 "+" ] if last-digit = #"0" [ either idx < 99 [clear back back tail ruler1] [clear back back back tail ruler1] append ruler1 to-string idx ] ] replace/all ruler2 "0" "_" print ruler1 print ruler2 ____+___10____+___20____+___30____+___40____+___50____+___60____+___70____+___80____+___90____+__100____+__110 123456789_123456789_123456789_123456789_123456789_ 123456789_123456789_ 123456789_123456789_ 123456789_123456789_ | |
PatrickP61: 8-May-2013 | I'll give ++ idx a try | |
PatrickP61: 8-May-2013 | How can I use the LENGTH? of IDX as a way to CLEAR those last positions. ie IDX is 110, length is 3 then clear the last 3 characters from the ruler1 series and replace with to-string idx | |
PatrickP61: 8-May-2013 | Thanks Graham, I'm getting an error with ++ idx, help ++ indicates incrementing a 'word, but I'm not understaning it I'll try your suggestions | |
Bo: 8-May-2013 | I'm not saying to use that format for writing your scripts, but as a visual aide, it may help. Also, you could make it kind of lisp-y like this: copy/part (tail form idx) (-1) | |
Bo: 8-May-2013 | I sometimes do that when I am trying to debug a lot of nested statements, because if you use parens, Rebol will let you know that it didn't receive something it was expecting instead of just pulling the output from the next nested statement. | |
Bo: 8-May-2013 | Actually, the first method I posted above is easier to understand for a lot of nested statements. Compare this real line of script from one of my programs. The way I normally write it: browse probe rejoin copy [http://www.respectech.com/log/show-invoice.cgi?user= username "&pass=" password "&submit=" replace/all client "&" "%26" "&invno=" invnum either amtdue [rejoin ["¬ice=1&amtdue=" to-decimal amtdue "&daysdue=" daysdue]][copy ""]] Lisp-y: browse (probe (rejoin (copy [http://www.respectech.com/log/show-invoice.cgi?user= username "&pass=" password "&submit=" (replace/all (client) ("&") ("%26")) "&invno=" invnum (either amtdue [rejoin ["¬ice=1&amtdue=" (to-decimal amtdue) "&daysdue=" daysdue]][copy ""])]))) Heirarchical (takes a lot more space, but is easier to follow -- however, doesn't have the parameter enforcement of parens): browse probe rejoin copy [ http://www.respectech.com/log/show-invoice.cgi?user= username "&pass=" password "&submit=" replace/all client "&" "%26" "&invno=" invnum either amtdue [ rejoin [ "¬ice=1&amtdue=" to-decimal amtdue "&daysdue=" daysdue ] ] [ copy "" ] ] | |
Bo: 8-May-2013 | I'm glad we don't have to use the Lisp method or the heirarchical method, but it is nice that we can, especially when we are starting out. I usually only use the heirarchical method when I am trying to understand and visualize someone else's really complex scripting. I'll use the Lisp method when I am getting an error that I have narrowed down to a small snippet of code, and I can't figure out why the error is occurring. I also throw in a lot of 'probe statements to see what's really going on. | |
Ladislav: 9-May-2013 | err, I lost a part of the expression: change skip tail ruler1 either idx < 99 [-2] [-3] to-string idx | |
Gregg: 9-May-2013 | Patrick, rather than building up the strings bit by bit, consider how you might do it if you think of them as a buffer you're modifying. e.g., start with something like this: ruler1: copy "" insert/dup ruler1 "_" 110 forskip ruler1 5 [change skip ruler1 -1 "+"] or this ruler1: head insert/dup copy "" "____+" 22 | |
PatrickP61: 9-May-2013 | Thanks to all that helped. Learning all the time. I think I have the code pretty tight now! A lot better than my first attempt. Final solution: ruler-len: 80 ruler-1: head insert/dup (copy "") "----+----." to-integer (ruler-len + 9 / 10) ruler-1: head clear (skip ruler-1 ruler-len) ; trim excess r1: skip head ruler-1 9 ; adv to pos 10 forskip r1 10 [ adj: ((length? idx: to-string (index? r1)) - 1) change skip r1 (-1 * adj) idx ] ruler-1: head r1 ; r1 is at tail ruler-2: head insert/dup (copy "") "123456789." to-integer (ruler-len + 9 / 10) ruler-2: head clear (skip ruler-2 ruler-len) ; trim excess print-ruler: does [print ruler-1 print ruler-2] | |
Henrik: 11-May-2013 | Bo, that's a great quote. |
3401 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 33 | 34 | [35] | 36 | 37 | ... | 643 | 644 | 645 | 646 | 647 |