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: 11501 end: 11600]
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
Guest: 8-Feb-2005 | how to: create a array of objects ? (like arrays of udt's) | |
Sunanda: 8-Feb-2005 | blk: copy [] loop 10 [append blk make object! [a: 1]] | |
Guest: 8-Feb-2005 | wow, fast reply. thx sunanda. last question: what syntax I need to access e.g. object array no. 5 or 8 to write values like blk/a: recordset ? | |
Guest: 8-Feb-2005 | I have a object with - name, street, and country and a database with 50 records. I would like to store the records into a dynamic object array for later reading... | |
Anton: 8-Feb-2005 | equivalent to above, but a bit faster in execution (maybe you have a large block): | |
Anton: 8-Feb-2005 | That is putting a GET-WORD! in the path. (eg. :record-num ) | |
JaimeVargas: 14-Feb-2005 | ;Isn't this a bug? >> parse #{000102} [#"^@" #"^A" #"^B"] == false >> parse #{000102} ["^@^A^B"] == true | |
JaimeVargas: 14-Feb-2005 | >> parse #{000102} [#"^@" #"^A" #"^B"] == false >> parse #{000102} ["^@^A^B"] == true | |
JaimeVargas: 14-Feb-2005 | ;Ah. Never mind I forgot about parse/all >> parse/all #{000102} [#"^@" #"^A" #"^B"] == true | |
Ladislav: 16-Feb-2005 | is there a way how to "simplify" this? (queue is a list!) if any [error? try [tail? queue] tail? queue] [ queue: head queue ; start at a "meaningful" position in the queue ] | |
Dockimbel: 16-Feb-2005 | If queue is a list!, why would [tail? queue] fail ? Can 'queue refer to other kind of value than a list! value ? | |
Louis: 22-Feb-2005 | Is there a command to give the path to the presently used user.r file? | |
Louis: 22-Feb-2005 | But I guess each directory might need a different user.r. | |
Anton: 22-Feb-2005 | Louis, I think: system/options/path is the current directory of the shell environment where rebol was started from. system/options/home is the rebol starting directory, where it looks for user.r etc. In WinXP this value is taken from the registry at HKCU\Software\Rebol\View\HOME, but only for full release versions (like Rebol/View 1.2.1.3.1). I imagine there is a HOME environment var set in *nix. | |
Geomol: 23-Feb-2005 | Does REBOL miss a way to go up one level of blocks within blocks? Example: >> blk: [[a b c] [d e f]] == [[a b c] [d e f]] >> p: first blk == [a b c] Now I would like to have p go up one level, so I can continue to the next block (the [d e f] block) within blk. Using blk to do it is not a solution, because we could have blocks within blocks within blocks ... to any level. What about a parent function like: >> p: parent p | |
Sunanda: 23-Feb-2005 | Not really possible without an extra data structure. Why not simply make the parent the 1st entry in the block? >> blk: copy [] == [] >> append/only blk blk == [[...]] >> append blk "a" == [[...] "a"] (One drawback is that this sort of recursive structure cannoy easily be molded and later loaded_ >> | |
DideC: 23-Feb-2005 | Use a block and Push reference to the parent when you go into the child. Then Pop the reference when you want to go up one level. | |
Geomol: 23-Feb-2005 | Volker is right! Which one is the parent? Ergo we can't have a parent function. And then again, we have to use a trick, where we store the block at any level. (You other guys are right too, and I think the actual design is the best way, I just have to keep in mind, why it is like this.) :-) | |
Chris: 23-Feb-2005 | DideC, do you have an example? I've seen the terms 'push and 'pop before, but have not seen a comprehensive example of it... | |
DideC: 23-Feb-2005 | There was a discussion about stack implementation the 27-jan in this group. Go up, there is the code from Robert and others | |
Geomol: 23-Feb-2005 | I find this a bit strange and problematic: >> blk: [/] == [/] >> type? blk/1 == word! >> parse blk [/] == false How do I parse a slash within a block? | |
Geomol: 23-Feb-2005 | Well, I'm not 100% satisfied. Look at these: >> parse [a] ['a] == true >> parse [/] ['/] ** Syntax Error: Invalid word-lit -- ' ** Near: (line 1) parse [/] ['/] Shouldn't '/ be a valid lit-word? | |
JaimeVargas: 24-Feb-2005 | ;I find this amazing. >> o: make object! [sub-o: make object! [name: 'sub-o f: func [v][2 * v]]] >> ? o O is an object of value: sub-o object! [name f] >> var: in o 'sub-o == sub-o >> ? var VAR is a word of value: sub-o >> value: get var >> ? value VALUE is an object of value: name word! sub-o f function! [v] ;What I find amazing is that you can get the content of the object SUB-O by doing GET VAR ;Some how the context where 'SUB-O is defined gets attached to VAR or SUB-O by IN O 'SUB-O ;just to check, the global context doesn't know anything about SUB-O >> ? sub-o No information on sub-o (word has no value) >> sub-o ** Script Error: sub-o has no value ** Near: sub-o | |
Ammon: 24-Feb-2005 | It is because the VALUE not the word contains the CONTEXT information meaning that VAR (as you defined it) referenced the value SUB-O which happened to be a word with the context of O | |
Ammon: 24-Feb-2005 | ...a word WITHIN the context of the object that the WORD O refers to... | |
Anton: 24-Feb-2005 | Each word "knows" which context it lives in. When you make a new object, the top-level set-words are BINDed to it. So each word knows its binding. | |
Anton: 24-Feb-2005 | I think Ladislav used to have a nice example where each of the words in this block could refer to different values, because they were bound to different contexts: [word word word word] | |
BrianW: 24-Feb-2005 | sounds kinda cool but scary from a code maintenance perspective. | |
Anton: 24-Feb-2005 | Bah.. We use this feature all the time without thinking about it. Take a look at this: | |
Anton: 24-Feb-2005 | (it prints "12" to the console :) Now luckily for us, 'print was not bound to the new context. It "remembers" its context is the global context. That's how we can get its value (a function) to actually do something. The set-word, v: , on the other hand was bound to the new context, so we know it won't affect anything outside. | |
Gabriele: 25-Feb-2005 | you can think of a word as if it was a block that could only keep one element. so each word keeps its value, in a similar way as each block keeps its values. (this is not 100% correct, but maybe it helps understanding) | |
Robert: 25-Feb-2005 | I always wanted a way to dump all contexts a word is defined in: like "dump-context myword" and get a list of named and unnamed contexts. Anamonitor can do this. | |
Romano: 25-Feb-2005 | and yes Robert, i do not like split-path behaviour in many cases (see RAMBO discussions about this), but i do not think that your request is good, from my pov %a/b/ should give %a/ %b/ = the dir b inside the dir a or %a/b/ %./ = the current dir inside the dir %a/b/ this is inconsistent with: >> split-path %./ ; == [%./ none] but i think the last behavior should change in this %./ %./ | |
Romano: 25-Feb-2005 | none should never appear in a splith-path result | |
Anton: 26-Feb-2005 | Well, maybe split-path is not so useful sometimes, but at least it says what it is doing :) I think what we want most of the time is the dir-part and the file-part of a path (actually these are functions I use). I think they are more useful in general. The problem is in coming up with a good name to describe this behaviour..... maybe: to-dir-file-parts %my/path ;== [%my/ %path] ? | |
JaimeVargas: 1-Mar-2005 | Does rebol has some form of inheritance? Well not according to the docs. But when intializing within context there seems to be an initialization chain that look like a bit like inheritance to me. | |
JaimeVargas: 1-Mar-2005 | o: context [ a: 0 b: none o1: context [ a: 1 c: 3 set 'b 2 o2: context [ set 'b 4 set 'c 5 set 'd 6 ] ] ] | |
JaimeVargas: 1-Mar-2005 | O is an object of value: a integer! 0 b integer! 4 o1 object! [a c o2] >> ? o/o1 O/O1 is an object of value: a integer! 1 c integer! 5 o2 object! [] >> ? o/o1/o2 O/O1/O2 is an object of value: >> d == 6 | |
Anton: 2-Mar-2005 | A new object begins to be created. | |
Ammon: 2-Mar-2005 | I should say, it is context that allows sub-contexts. It's more of a hierarchy... | |
Anton: 2-Mar-2005 | The top-level of the spec block is scanned for set-words; in this case, there are three ( a: b: o1: ). These three words are added to the newly forming object. The spec block is now scanned *deeply* and where one of those three words ( a b o1 ) is found, they are bound to the object. | |
Anton: 2-Mar-2005 | Using "set notation" (eg. context [ set 'b 4 ] ) does not attach 'b to the object. It must be a set-word (eg. context [ b: 4 ] ) | |
Anton: 2-Mar-2005 | So, in the creation of your object o2, 'b and 'c are found to have been previously bound to o and o1, respectively. Setting them does not modify the binding. 'd was found not to be bound to anything so it was set in the global context. (people use this last trick to "export" functions or values from a context). | |
Brett: 2-Mar-2005 | ; Jaime try comparing your example with this: o: context [a: 0 b: o1: none] o/o1: context bind [a: 1 c: 3 set 'b 2 o2: none] in o 'a o/o1/o2: context bind (bind [set 'b 4 set 'c 5 set 'd 6] in o 'a) in o/o1 'a ; I think you'll find they are equivalent. | |
Brett: 2-Mar-2005 | Imagine context as a "colour" of a word (btw would be nice to see in an ide). Then, in your example, the first context function changes the colour of all the a,b and o1 words to "red" say. Then the next inside context function changes a,c, and o2 to green. And finally the inmost context function doesn't get to change anything because there are no set-words to process - if there were they would have been made blue of course ;-) | |
Brett: 2-Mar-2005 | I don't think there is a hierarchy of contexts. In Jaime's example there is a hierarchy of blocks (nested). As evaluation proceeds, the words in those blocks get "painted" different colours. That's why my code using bind ends up with the same binding of words even though I didn't have the same hierarchy of blocks - I simulated the same order of binding. | |
Anton: 2-Mar-2005 | I think that is correct, remembering a discussion with Carl Sassenrath a long time ago. | |
Volker: 2-Mar-2005 | Not a chain, a "compiletime" replacement. | |
Volker: 2-Mar-2005 | red: context[a: 'red blue: context[a: 'blue]] | |
Volker: 2-Mar-2005 | 'a is first bound to 'global, then to 'red, then to 'blue (going from outer to inner block). then it stays blue until you bind it again. | |
Volker: 2-Mar-2005 | (the 'a in [a: 'blue] not the others. better remove them.. red: context[ blue: context[a: 'blue] ] | |
Ammon: 2-Mar-2005 | Yes, but you're using a set-word! which doesn't properly demonstrate what we are talking about. Change [a: 'blue] to [set a 'blue] and then you have it. ;-) | |
Volker: 2-Mar-2005 | What did i not get? Jaime: "that rebol implements context internally using some sort OO technique to keep track of the assignments. In this case the OO technique is lookup chain." in your case 'a is never recolored. | |
Volker: 2-Mar-2005 | and for demo my first example was right. trying again: loading: all 'a in [red: context[a: 'red blue: context[a: 'blue]] ] are colored global creating outer context: all 'a in [a: 'red blue: context[a: 'blue]] are colored red creating inner context: all 'a in [a: 'blue] are colored blue. now all 'a have their right colors :) | |
Ammon: 2-Mar-2005 | 1. It has to be happening during runtime there is no compiling. 2. I don't understand your second attempt there. 3. If you use a set-word in a context then that word becomes part of that context. If you use SET then it reverts to the context's "parent context" or the context in which the context itself is defined. If the word exists in that context then it is set there, if not then it grabs that context's parent until it has made it to the global or top level. If the word doesn't exist globally then it is created... | |
Ammon: 2-Mar-2005 | I missed a step there... If you use SET then it first checks the context of the word if the word has a context then it attempts to assign the word there. If the word doesn't have a context then it uses the current context. | |
Brett: 2-Mar-2005 | Jaime, yes I agree that rebol implements context internally. You mention the idea of a lookup chain or initialisation chain, if you mean that such a chain maintains some relationship between your ancestor and descendent objects then no I don't think so. Once the context function has finished being evaluated then the idea of ancestor and descendent is finished. The two objects stand equally at the same level, no relationship between them exists even internally, except that you might consider them to be associated because they share some function value or other values. As Anton has said, words know their context. I tried to put it visually by saying they have a colour and that colour identifies their context. | |
Brett: 2-Mar-2005 | I guess what I'm saying is that the idea of a lookup chain is not needed to understand rebol. We only need to know that a rebol word is a member of some context and that association between a word and its context can be changed by functions like Context, Bind, Func and Use when they are evaluated. | |
Brett: 2-Mar-2005 | Have a look at the In function. The In function returns a word. The word that it returns still has its original association with the object context. | |
Brett: 2-Mar-2005 | name: "black" red-ctx: context [ name: "red" green-ctx: context [ name: "green" blue-ctx: context [name: "blue"] ] ] names: reduce [ name in red-ctx 'name in red-ctx/green-ctx 'name in red-ctx/green-ctx/blue-ctx 'name ] ; Names is now a block that contains four words of different colour (context binding) probe reduce names | |
Brett: 2-Mar-2005 | name: "black" red-ctx: context [name: "red"] green-ctx: context [name: "green"] blue-ctx: context [name: "blue"] names: reduce [ name in red-ctx 'name in green-ctx 'name in blue-ctx 'name ] ; Names is now a block that contains four words of different colour (context binding) probe reduce names | |
Brett: 2-Mar-2005 | Except of course for that fact that red-ctx does not have a field green-ctx! | |
Brett: 2-Mar-2005 | Ammon. On your point 3 above. "If the word exists in that context then it is set there, if not then it grabs that context's parent until it has made it to the global or top level." No, it doesn't work this way. There does not need to be runtime searching. It is more like this... Look at my nested context example, and focus just on the 'name words. (1) When the first context function is encounted during evaluation, it has a single argument a block - which happens to contain 5 values. A set-word, a string, a set-word a word and a block. (2) Now when this first context function is evaluated it creates a new context, and binds to this context the all 'name words it can find in the block and nested blocks. To visualise this imagine all the 'name words including within the nested blocks have just changed Red. (3) After this colouring of the words, the block is evaluated (as in DO) so that at some point the second reference to the Context function is evaluated. (4) Like the first, it colours the name words in its block and nested blocks - let's say to green. (5) The final level is blue of course. (6) By the time all evaluation is finished the 'name words have the appropriate bindings (colours). Conceptually, maybe even actually, the innermost 'name word has had its binding (colour) changed three times, the second level one twice, and the highest once. In this way there does not need to be any runtime searching for "parent" contexts, because the words themselves maintain the references to the appropriate contexts. The Set function does not need to search it can see the binding (colour) already. | |
Ammon: 2-Mar-2005 | This particular subject has come up a number of times since I started playing with REBOL in 2000 but for some reason I can't seem to make the point that I am attempting to make everytime it comes up. I think I'll leave it alone now... | |
Volker: 2-Mar-2005 | Ammon: "1. It has to be happening during runtime there is no compiling." load-time and loop-time then? ;) ammon: "3. If you use a set-word in a context then that word becomes part of that context. If you use SET then it reverts to the context's "parent context" or the context in which the context itself is defined." Thats the important point: there is no reverting :) and so there is no need to keep track of parent-contexts.which is quite clever :) | |
DideC: 3-Mar-2005 | What is the quickest way to transform this : [ ["a" 11 #toto] ["b" 28 #titi] ["c" 3 #pim] ] into this : [ "a" 11 #toto "b" 28 #titi "c" 3 #pim ] ??? | |
Sunanda: 3-Mar-2005 | Fastest, I don;t know. But this works: xx: [ ["a" 11 #toto] ["b" 28 #titi] ["c" 3 #pim] ] loop length? xx [append xx xx/1 remove xx] head xx == ["a" 11 #toto "b" 28 #titi "c" 3 #pim] | |
Geomol: 3-Mar-2005 | Close to being fastest: xx: [ ["a" 11 #toto] ["b" 28 #titi] ["c" 3 #pim] ] x: copy [] loop length? xx [insert tail x xx/1 xx: next xx] x | |
Geomol: 3-Mar-2005 | A time function to measure the speed of code: time: func [:f /local t0] [t0: now/time/precise do f now/time/precise - t0] Now you can do e.g.: time [loop 40000 [ xx: [ ["a" 11 #toto] ["b" 28 #titi] ["c" 3 #pim] ] x: copy [] loop length? xx [insert tail x xx/1 xx: next xx] ]] | |
sqlab: 3-Mar-2005 | foreach b [ ["a" 11 #toto] ["b" 28 #titi] ["c" 3 #pim] ] [append [] b ] If you want faster execution you should initialize the block [] outside the loop | |
PhilB: 3-Mar-2005 | Has onyone manged to use Core with an iSeries (AS400) FTP server. I have had no success at work .... it trying to read a folder in the IFS (Integrat File System) but the server returns a FTP error 250. (I dont have all the details on me at home). Now looking at the FTP error numbers 250 is a normal return code, so I dont understand why I am not getting any information back. | |
PhilB: 3-Mar-2005 | I am using core 2.6 under winXP .... and connecting to a Linux server is working OK. | |
PhilB: 3-Mar-2005 | I will give your handler a try tommorow ... thanks Romano | |
BrianW: 3-Mar-2005 | Is there a load path for the 'do function? | |
Anton: 3-Mar-2005 | You mean like a PATH variable in a dos or unix shell environment ? | |
BrianW: 4-Mar-2005 | It would be easy to roll my own "include" function. I might try that as a little project. | |
Anton: 4-Mar-2005 | Actually, I don't know what you have in mind exactly so I shouldn't comment. But I and a few others have systems of our own, so feel free to ask how they work. | |
Gregg: 5-Mar-2005 | And, if using a beta with AS-STRING, it's kind of a raw cast that's fast. | |
Izkata: 5-Mar-2005 | >> A: [%23%67%68%69] == [%23ghi] >> dehex A ** Script Error: dehex expected value argument of type: any-string ** Near: dehex A ;dehex doesn't work with blocks >> to-string A == "23ghi" ;to-string converted it to a string and de-hex only some of the characters. >> A: {%23%67%68%69} == "%23%67%68%69" >> dehex A == "#ghi" ;dehex works on all parts of the string No idea about as-string, dun have that beta. | |
Izkata: 5-Mar-2005 | Hey that looks like a bug - it won't auto-dehex the first part of a block, but works on the rest no problem: >> A: [%70%70] == [%70p] | |
DideC: 5-Mar-2005 | I think it's because rebol think its a file! due to the first percent sign | |
DideC: 5-Mar-2005 | > A: [%70%70] == [%70p] >> type? a/1 == file! | |
Vincent: 5-Mar-2005 | >> A: [%%70%70] == [%pp] | |
Graham: 5-Mar-2005 | anyone got a parse rule that tells me whether the text constitutes a fully qualified domain? | |
Graham: 6-Mar-2005 | There is a difference between the IMAP protocol itself (RFC 2060) and the imap:// URL scheme (RFC 2192). At this time REBOL only supports the imap:// URL scheme, which has a subset of the full IMAP protocol functionality. It handles mailbox lists, message lists, retrieving and deleting of messages, and message searches, i.e. it is API-compatible to pop://, with added support for multiple mailboxes and searches. Move/copy/rename and other administrative IMAP functions are not specified in RFC 2192 and not supported by REBOL's imap:// scheme at this time. | |
BrianW: 6-Mar-2005 | Thanks, folks. I know that IMAP itself is a bit of a muddle (based on profanities that I overheard from somebody who was trying to write a complete IMAP client for another language), but a subset of functionality is more than I knew about. | |
Graham: 6-Mar-2005 | there's a bug in imap as released in the current stable and beta versions which Scott and I fixed. | |
Graham: 8-Mar-2005 | Anyone got a function to reduce a ip-address to a tuple ? | |
Graham: 8-Mar-2005 | I'm writing a greylisting implementation for my smtp server .. and I needed to drop the last digits of an ip address to form the triplet | |
JaimeVargas: 8-Mar-2005 | Graham do you want to compare the spammer ip address against a range? | |
Graham: 8-Mar-2005 | I need to construct what is called a "triplet". The triplet in greylisting parlance is a unique set of three facts about an email. These are IP-address+smtp envelope from+smtp envelope to The idea is that you construct a database of triplets from smtp clients. If you have never seen such a triplet before, you send a smtp delay back to the client. Most well constructed MTA's honor the delay and try again. You set a block period .. from 10 seconds to 1 hour during which you do not accept any mail from that triplet. Spamming engines generally ignore this delay, and just give up. It's too expensive for them to log such delays and retry again. | |
Graham: 8-Mar-2005 | If you have seen mail from such a triplet before, you then allow that mail to go thru without any delays. In my testing, I found that my ISP sent me three consecutive emails to my smtp server using three different ip addresses all within the same subnet. So, this meant that all three emails were subjected to a delay. | |
Graham: 9-Mar-2005 | need some other checksum that can be calculated by loading parts of a file at a time. | |
Romano: 9-Mar-2005 | Vincent: almost, it is not easy: you must 1) read a chunk of data, parse it 2) when parse stop remember the position where it stops 3) delete parsed data 4) read a ne chunk of the file 5) append it to the old data 6) restart parse from the right rule (this is the hardest part) | |
JaimeVargas: 9-Mar-2005 | After all a file is just a binary! series | |
Vincent: 9-Mar-2005 | Romano: thanks, I will try it - I have a version of rebzip decompressing a file while it's downloaded, but the code isn't pretty (two nearly same funcs.) | |
BrianW: 9-Mar-2005 | Is there a way to get the name, file, or line number of a function's caller? | |
Graham: 9-Mar-2005 | I want to find the mail server for a given email address... | |
BrianW: 9-Mar-2005 | finger? whois? I'm behind a firewall, so I don't know which (if either) | |
Graham: 9-Mar-2005 | leave me a message here if you find anything :) |
11501 / 64608 | 1 | 2 | 3 | 4 | 5 | ... | 114 | 115 | [116] | 117 | 118 | ... | 643 | 644 | 645 | 646 | 647 |