AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 33 |
r3wp | 259 |
total: | 292 |
results window for this page: [start: 101 end: 200]
world-name: r3wp
Group: RAMBO ... The REBOL bug and enhancement database [web-public] | ||
Anton: 1-May-2007 | Serialised function! not loadable in Rebol/View 2.7.5.3.1 on WinXP >> load {#[function! [][]]} ** Syntax Error: Invalid construct -- #[ ** Near: (line 1) #[function! [][]] >> load/all {#[function! [][]]} ** Syntax Error: Invalid construct -- #[ ** Near: (line 1) #[function! [][]] The above are loadable on View 1.3.2 | |
Group: Core ... Discuss core issues [web-public] | ||
Graham: 22-Oct-2005 | It is the responsibility of the mail client. You control the mail client. If you construct a BCC field in your header, Rebol will ignore that when using send. | |
Graham: 27-Nov-2005 | Ladislav's PIF function appears to be functionally similar to the new case construct The old domain still seems to work http://www.fm.vslib.cz/%7Eladislav/rebol/pif.r | |
Gabriele: 24-Jan-2006 | THIRD *does* work for words, as long as you use CONSTRUCT to rebuild the object. | |
Allen: 24-Jan-2006 | To illustrate for those who may not know what the issue is with third / make >> c: make object! [a: 'print b: "hi"] >> ? c C is an object of value: a word! print b string! "hi" >> spec: third c == [a: print b: "hi"] ;Using make object! fails >> e: make object! spec hi ** Script Error: a needs a value ** Near: a: print b: "hi" ;Contruct works >> f: construct spec >> ? f F is an object of value: a word! print b string! "hi" | |
Pekr: 2-Jul-2006 | rebol does not recognise filetype .... so it uses application/octec-stream .... too many gotchas here, maybe it would be better to construct complete headers. Will look into some alternative attachment sending scripts on rebol.org .... | |
Sunanda: 23-Feb-2007 | If I understand your question, Charles, you may be looking for construct/with......It's a way of using an existing object as a template for a new one, eg: my-obj1: make object! [a: 99 b: 2 c: "string"] my-obj2: construct/with [b: 9999] my-obj | |
Sunanda: 23-Apr-2007 | a: make object! [b: 445 c: 444] b: make object! [b: 999] b: construct/with third a b ;; set b to a's values and fields | |
Jerry: 10-Jul-2007 | >> blk: [ delete none ] == [delete none] >> type? blk/1 == word! >> type? blk/2 == word! ; ; none is not of the none! type, unless it's been evaluated. ; none is so-called indirect value in the REBOL/CORE doc at ; http://www.rebol.com/docs/core23/rebolcore-4.html ; ; In http://www.rebol.net/r3blogs/0034.html, ; there is a so-called "Scant Evaluation" ; >> obj: construct [ n: none d: delete ] >> type? obj/d == word! >> type? obj/n == none! ; ; WHY obj/n IS NOT OF THE WORD! TYPE ??? ; The "Scant Evaluation" should not evaluate none here. | |
Louis: 10-Jul-2007 | in headers (and in the construct function) both word lookup and function evaluation are disabled, but set-word (assignment) is not. | |
Louis: 10-Jul-2007 | I see what you mean. The actuality seems to contradict those documents. >> obj: construct [ n: none d: delete ] >> probe obj make object! [ n: none d: 'delete ] It seems that only potentially dangerous evaluation is prevented, and not all evaluation. Scant Evaluation: A minimal form of evaluation used for headers and other data blocks that do not allow any level of deep evaluation. Perhaps the evaluation of none is not considered "deep." | |
Louis: 10-Jul-2007 | Jerry, I found this: The CONSTRUCT function will perform evaluation on the words TRUE, FALSE, NONE, ON, and OFF to produce their expected values. Literal words and paths will also be evaluated to produce their respective words and paths. For example: obj: construct [ a: true b: none c: 'word ] The obj/a value would be logical TRUE, obj/b would be NONE, and obj/c would be WORD. file:///C:/SDK/docs/changes.html | |
Jerry: 11-Jul-2007 | >> obj: construct [ a: on b: yes ] >> probe obj make object! [ a: true b: 'yes ] | |
Jerry: 11-Jul-2007 | Nothing should be evaluated in CONSTRUCT, except SET-WORD!, which is an inconsistency. NONE, TRUE, FALSE, ON, and OFF are not SET-WORD!, but they are evaluated in CONSTRUCT, which is another inconsistency in an inconsistency. YES and NO are not evaluated in CONSTRUCT, which is yet another inconsistency in another inconsistency in an inconsistency. Inconsistency is no good. | |
Gabriele: 11-Jul-2007 | Jerry, this is a "feature" of construct. the words NONE, TRUE and FALSE are converted to the respective values. it is done to allow construct to work correctly when /all is not used with mold. | |
Gabriele: 11-Jul-2007 | in general, it is much better to use mold/all instead, but i know construct can give you headaches if you really want to have a word in there. | |
Geomol: 8-May-2008 | Ah yes, there is a 24 hour cycle problem with my approach. I could construct a more unique decimal taking year, month and day into account. Hm, random/seed returns a value, if called with a decimal!? Called with an integer, it doesn't. A reason for this? >> random/seed 100 >> random/seed 100.0 == 41.0 | |
Geomol: 8-May-2008 | Yes, random/seed with a decimal doesn't use the seed: >> loop 10 [random/seed 1 random/seed to decimal! now/time/precise prin [random 100 ""]] 52 52 52 52 52 52 52 52 52 52 So I need to construct an integer from the time. | |
Geomol: 9-May-2008 | Yes, valid points, but it's not what I described at first. If I should construct a random password given the rules, my output will land in a pool of 60 ** 8 possible passwords. I don't have to actual do it. The statement holds anyway. If a computer should construct a random password given the rules (using any deterministic computer and any algorithm, but only with a 32-bit integer input, as in the case of REBOL random/seed), the output will land i a pool of 2 ** 32 possible passwords at most. Of course we can change the frame and get a better result from the computer, but then we change the 'experiment'. In general, I would say the pool from human thoughts and decisions is infinite. It's not from a deterministic computer. So we need true random input and true analog computing with infinite states, if we want our computers to be as good as our brains. | |
Chris: 19-Dec-2008 | A 'bind question: how do I construct an object containing blocks without changing the blocks' contexts? This bad: >> id: #foo == #foo >> blk: [id] == [id] >> reduce blk == [#foo] >> ctx: context append/only [id: #bar bk:] blk >> reduce ctx/bk == [#bar] This good: >> id: #foo == #foo >> blk: [id] == [id] >> reduce blk == [#foo] >> ctx: magic-context append/only [id: #bar bk:] blk >> reduce ctx/bk == [#foo] How to 'magic-context ? | |
Chris: 19-Dec-2008 | I was hoping 'construct would do it, but alas not. | |
Steeve: 20-Dec-2008 | fun: func [spec body /local me][ me: construct append copy/deep [ clear-all: [set bind copy next next first self self none] ] body me/clear-all: does me/clear-all clear find spec /local func spec bind body me ] f: fun [/local c d ][ c: d: 1 probe self print [c d ] clear-all print [c d]] f | |
Steeve: 29-Dec-2008 | so you can't use the construct function on the primary bock... | |
BrianH: 21-Jan-2009 | BACKPORTS! Hot off the presses! Get your new R3 functions, now here for R2! Available now, before the next release! funct: make function! [ [catch] "Defines a user function assuming all set-words are locals." spec [block!] "Help string (opt) followed by arg words (and opt type and string)" body [block!] "The body block of the function" /local r ws wb a ][ spec: copy/deep spec body: copy/deep body ws: make block! length? spec parse spec [any [ set a [word! | refinement!] (insert tail ws to-word a) | skip ]] wb: copy ws parse body r: [any [ set a set-word! ( unless find wb a: to-word a [insert tail wb a] ) | hash! | into r | skip ]] unless empty? wb: difference ws wb [ remove find wb 'local unless find spec /local [insert tail spec /local] insert tail spec wb ] throw-on-error [make function! spec body] ] functor: make function! [ [catch] "Defines a user function with all set-words collected into a persistent object (self)." spec [block!] "Help string (opt) followed by arg words (and opt type and string)" body [block!] "The body block of the function" /local r wb a ][ ; Note: Words in the spec override the bindings of the object words. wb: copy [] parse body r: [any [ set a set-word! (unless find wb a [insert tail wb a]) | hash! | into r | skip ]] remove find wb [self:] throw-on-error [make function! copy/deep spec bind/copy body construct wb] ] | |
TomBon: 19-Feb-2009 | paul, I never used construct. can it serve nested constructs also? | |
[unknown: 5]: 19-Feb-2009 | TomBon, here is the construct docs http://www.rebol.com/docs/changes.html#section-4.1 | |
[unknown: 5]: 19-Feb-2009 | TomBon, here is the purpose of a construct: >> ct: construct [int: (1 + 1)] >> ct/int == (1 + 1) >> do ct/int == 2 >> Notice that it doesn't automatically evaluate /int as an object would do. | |
Robert: 13-May-2009 | Next one: I need to construct a HREF="..." with some dynamic code. | |
Steeve: 17-Oct-2009 | you mea, you want to construct a block with ANY unbound to a context ? | |
Steeve: 18-Dec-2009 | I don't know how the values evaluated are stacked by the VM. But i see the advantage of having a POP function. We could easly create postfix functions. e.g: CONCAT: func [v][join pop v] >> "a" concat "b" =="ab" All sort of new operators would be easy to construct | |
Graham: 21-Jan-2010 | I'd like users to construct their own sql as well and send it to the server ... but I don't | |
Steeve: 23-Feb-2010 | when i construct ports with a spec block, i would rather prefer to use dialect (using delect) instead of passing a prototype of the spec object | |
ChristianE: 23-Mar-2010 | There is another aspect of this. Questions on functions names probably occur too often to not answer them by a proper language construct. I was always thinking that something like a SELF word in functions would suffice. A function would then be able to envoke itself, and only itself, without worrying about it's "name", whatever that is. | |
Graham: 6-Jul-2010 | Is this a bug? >> o: construct [ a: true b: yes c: yes ] >> probe o make object! [ a: true b: 'yes c: 'yes ] http://www.rebolforum.com/index.cgi?f=printtopic&topicnumber=47&archiveflag=new | |
Graham: 6-Jul-2010 | >> o: construct [ a: true b: yes c: on ] >> probe o make object! [ a: true b: 'yes c: true ] | |
Maxim: 6-Jul-2010 | replied there... I usually mold/all for such things... o: construct [ a: true b: yes c: on ] >> print mold/all o #[object! [ a: #[true] b: yes c: #[true] ]] | |
Graham: 6-Jul-2010 | construct should not evaluate .. but it is | |
Maxim: 6-Jul-2010 | construct exiplictely looks for the words none, true, false, yes, no and replaces them with their value equivalents. | |
Maxim: 6-Jul-2010 | probably because Carl forgot to include yes/no into the construct special case... its possible he did it on purpose. | |
Graham: 6-Jul-2010 | this is r3 >> a: construct [ a: true b: on c: yes ] == make object! [ a: true b: true c: true ] | |
Endo: 6-Jul-2010 | yep, it is still there, I use 2.7.7. I use this function to test: f: func ['w] [type? get in construct compose [t: (:w)] 't] >> f yes == word! >> f off == logic! forum topic is "Careful when Construct an object" on http://rebolforum.com, above link goes another topic. (a bug on forum, topic numbers changing) | |
BrianH: 6-Jul-2010 | The yes and no keywords of R3's CONSTRUCT were added at my request. We'll have to see whether the enhanced function can be backported to R2 safely. There are other changes as well, mostly safety changes, and a CONSTRUCT/only option that turns all of the tricks off. | |
BrianH: 6-Jul-2010 | Bug#651 details the changes - yes and no keywords, and unset-to-none translation - and bug#687 explains CONSTRUCT/only. | |
BrianH: 6-Jul-2010 | We'll have to see if there is any R2 code that will be broken by the change; if so, it won't happen. As a rule, backwards-incompatible changes are only made to R2 when they can be proven to not harm legacy code. There have been a few exceptions, and at least one mistake that predated (and inspired) the rule, but the exceptions have all been added functionality that doesn't change old functionality that is relied on in code. If nothing relies on yes and no not being keywords, or unset! values not being translated to none, then we're cool. As a counter-example, CONSTRUCT/only could be backported without question because it's a new option. | |
Graham: 3-Aug-2010 | This is the construct I saw which I don't like either true [ tail s ][s ] which I could then replace with if/only true [ tail ] s | |
Graham: 3-Aug-2010 | It's less verbose and possibly clearer than using the 'either construct | |
Graham: 15-Sep-2010 | some people prefer this construct all [ find blk val append blk val ] | |
Group: View ... discuss view related issues [web-public] | ||
Pekr: 16-May-2005 | I know - but RebGUI will not explain me how to construct styles, no? Those thigs like init method description etc. IIRC there was some attempt to write it down, so, links apreciated :-) | |
Pekr: 15-Sep-2005 | then use /header refinement and construct header yourself ... | |
Steeve: 3-Dec-2007 | hi all ! i try to detect move events in a feel/over func. But i receive a flow of move events in my face instead of only 2 events (1 when entering, 1 when leaving). I precise: I did'nt put the option [all-over] in the window. I don't use VID but i construct my own layout with a serie of make face. | |
Graham: 4-Mar-2008 | Basically you have to construct the whole row as 3 separate faces and keep appending them to a much larger face. | |
Graham: 25-May-2008 | I fetch the text asynchronously ie. I don't have the text at the time I construct the layout .. oh well... | |
Steeve: 23-Mar-2009 | layout [a: text b: button] v1: context [a: b: none] set bind copy next first v1 v1 reduce [a b] now you can construct v2, v3, V4 using the same layout | |
TomBon: 23-Apr-2009 | ; I need 100 rows like these both samples with unshared data access for each row. ; I have also tried with stylize/master (panel with) to construct/compose a master ; row like this but doesn't succeed. any change to make this work? list-func: func [] [ layout/tight [across x: text "x" y: text "y" z: progress 0.5 w: box 40x20 effect [ draw arrow blue rotate 60 ] ] ] view layout [ a: box 300x50 b: box 300x50 do [a/pane: list-func] do [b/pane: list-func] btn "set a" [a/data: [x/text: "1" y/text: "2" z/data: 0.8 w/effect: [ draw arrow red rotate 180 ] ] show a ] btn "set b" [b/data: [x/text: "1" y/text: "2" z/data: 0.8 w/effect: [ draw arrow red rotate 180 ] ] show b ] btn "set" [x/text: "1" y/text: "2" z/data: 0.8 w/effect: [ draw arrow red rotate 180 ] show b ] ] quit | |
Steeve: 24-May-2009 | you're starting from some points i guess, and you want to construct a smouth curve with them... | |
Henrik: 13-Feb-2010 | This is not obvious with VID, because you might build such a layout in a special setup, but in the VID Extension Kit, you have face constructs. A face construct is simply a style that accepts a particular dialect as input. The dialect is parsed into VID which then in turn generates an internal face tree. This means you can build styles that do something like: view layout [ paper [ size a4 dpi 300 at 20x20 image bay.jpg ] ] The point is that every time you feed the paper new data, using SET-FACE, it's re-rendered from scratch using VID. You can also build very complicated list views that dramatically change appearance and number of faces, every time you feed it new data. | |
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
Ladislav: 3-May-2009 | (you have to tell Parse what the alternatives are *before* using any cycle construct like TO, SOME, etc.) | |
mhinson: 15-May-2009 | I have done this template: make object! [ i2: reduce [[vlan 0][disabled " "][name " "]] i1: reduce [[i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2][i2]] data: reduce [[i1][i1][i1][i1][i1][i1][i1][i1][i1][i1][i1][i1][i1]] ] record: make template [] probe record/data/13/48 returns none ol but >> probe record/data/13/48/vlan ** Script Error: Cannot use path on none! value do I need to do somthing to make it construct deeper levels? | |
mhinson: 21-May-2009 | I think I need to learn more before I can use this to the effect I need. I was expecting your construct to all me to do this: foreach [key val] b1 [print b1/:val/1] | |
mhinson: 23-Jun-2009 | Thanks PeterWood. I like to think I am ok with the most basic concepts, so now I am trying to learn things that will help me some my real life probelms in a better way. I use parse pretty much every day & always have a rebol console up on my work PC, but ANY SOME & OPT & | I do not understand in context. I understand them in abstract terms, but not how to apply them in conjuction with [] . I do understand your examples of some & any (these examples are usefull to me). skipping an un-known number of chars to get to the next match is the bit I find hard to understand how to construct, paticularly if it needs to be done in the context of a previous match. | |
BrianH: 23-Jun-2009 | [ and ] are a grouping construct. | |
Endo: 1-Dec-2011 | I'm also working on very similar to your case right now. I don't know if its useful for you but here how I do (on Windows) command: {csvde -u -f export.ldap -d "ou=myou" -r "(objectClass=user)" -s 10.1.31.2 -a "" "" -l "DN,sn,uid,l,givenName,telephoneNumber,mail"} call/wait/console/shell/error command %export.err ;export all users, bind annonymous if 0 < get in info? %export.err 'size [print "error" editor %export.err halt] lines: read/lines %export.ldap ;create an object from the first line (field names, order may differ from what you give in the batch) ldap-object: construct append map-each v parse first content none [to-set-word v] 'none foreach line lines [ ( set words-of o: make ldap-object [] parse/all line {,} append users: [] o ) ] ;append all valid users as an object to a block probe users I hope it gives some idea. | |
Group: Parse ... Discussion of PARSE dialect [web-public] | ||
[unknown: 5]: 4-Mar-2008 | >> parse ["something" #[datatype string!]] [string! datatype!] ** Syntax Error: Invalid construct -- #[ ** Near: (line 1) parse ["something" #[datatype string!]] [string! datatype!] | |
BrianH: 22-Nov-2008 | eFishAnt, the {} nesting rules only apply to strings entered in {}, not "". They are also only a REBOL syntax trick. Strings that you construct or read from somewhere don't have any special escaping rules or syntax. | |
Steeve: 16-May-2009 | Assuming SRC: contains the source text, it seems to work too: header-char: complement charset "^/:" EOL2: rejoin [newline newline] parse/all src [ some [ some [pos: #" " (change pos #"-") | header-char] #":" pos: newline (change/part pos " {" 1) [to EOL2 | to end] pos: (change pos "} ") skip skip ] ] probe construct to block! src | |
shadwolf: 3-Jul-2009 | Gregg well ... i'm not against contributing but I think one of the good way is for lower ranked programmer to express their problems and try to construct a doc helped by gurus to answers their ask then if it's readable and understandable by me I assum anyone could understand it My point is once people end rading the doc they will say "yeah i understoud what it's all about so now lets play with parse :P" if that only goal can be achieve I think a big step will be done. | |
Steeve: 30-Sep-2009 | But we still have a problem with break not being able encapable in a block. We can't construct reusable rules with such logic. | |
Steeve: 6-Oct-2009 | I can have a look, but the purpose of NOT is not to have better perfs than complemented charset, but to allow some simplification when writing rules. Actually, It's the case of most other improvements, easier to write, not inevitably faster. And don't forget that safe complemented charset in R3 are a pain in the ass to construct, because of UTF-8 | |
Steeve: 5-Sep-2010 | Actually, DO is really easy to simulate, both in R2 and R3. Just construct the rule on the fly. >> parse [2][(rule: do [1 + 1]) 1 1 rule] ==true | |
Steeve: 20-Sep-2010 | Much easier with R3. assuming, >> src: {Number : 10017 Name : Disable Message Partner Application: MXS Severity : Info Type : Alarm Event Date-Time : 20/09/10 12:39:43 GMT : Mon Sep 20 10:39:43 2010} then, >> construct parse copy src [return while[and[some #" " #":"] remove[some #" "]| skip]] == make object! [ Number: "10017" Name: "Disable Message Partner" Application: "MXS" Severity: "Info" Type: "Alarm Event" Date-Time: "20/09/10 12:39:43" GMT: "Mon Sep 20 10:39:43 2010" ] | |
Group: AGG ... to discus new Rebol/View with AGG [web-public] | ||
Steeve: 21-Nov-2008 | but to intercativly move or deform a draw block, i need to construct a serie of handles (gobs) at some calculated points. and so it's currently a tragedy to have to simulate the draw engine to get th | |
Group: !RebGUI ... A lightweight alternative to VID [web-public] | ||
Ashley: 25-May-2006 | Why? The main dialect parser of RebGUI can now be expressed in one simple parse construct: parse reduce/only spec words [ any [ opt [... evaluate () to return a REBOL value...] [ parse rules to handle REBOL values ... ] ] ] compared to the relatively complex parsing logic in VID (which, to be fair, has to handle styles amongst other things). The main functional difference between what this allows in VID and RebGUI is that you don't need to parenthesize your expressions in VID (and I kind of like the idea of having to parenthesize them anyway, it makes expressions stand out just like they do in compose). Having said that, if someone can show me a RebGUI parser built along the lines of VID that is clean and lean I'll willing to be convinced otherwise. ;) | |
Ashley: 6-Jul-2006 | Tab (and shift-tab) changes focus. 'with is a VID construct, not RebGUI (unless Cyphre's changes are more far reaching than I'm aware of ;) ) The area in tour.r is the only tabable widget so it re-tabs to end of text. Try: display "" [area area area] to see how it works when more than one tabable widget is/are present. | |
Graham: 12-Jul-2006 | I thought there was supposed to be a switch in display to allow you to construct a layout without viewing it. | |
Pekr: 8-Apr-2007 | As RebGUI is aproaching 1.0 release, I would like to know your opinion on following - how do you construct and optimise your GUI? So far, if you look at tour.r, it reminds me of one big dialog configuration box. Not sure what to do about it, maybe it is a given, as widgets we have do suggest such layouting. This debate could open discussion about eventual addition of potentially missing widgets. My questions are: - are you missing kind of MDI application scheme? Parent window, containing one or more child windows, which are not able to being moved away from its parent. We used that design much, but I am not sure anymore it is vital, as with latest system, we use two monitor set-up, and by simple accelerator key we can navigate window being moved between displays. Having MDI available, we would probably need rebol/view native windowing system. So - is anyone missing something like that? - do you somehow optimise your display? Isn't it like following? - with using tabs, everything is in memory, whereas it eventually is not needed? How do you divide your application, if you would like to have kind of load-on-demand aproach? What styles do we miss, to further help us have more complete GUIs? I created screenshot of potentially two usefull widgets: http://www.xidys.com/widget-drop-tab.jpg http://www.xidys.com/widget-vertical-tab.jpg Especially with the second one, I think it could be usefull. It is used by many applications. It is kind of mixture of tab and tree, but not necessarily with multi-level aproach, just one level of nesting, mostly represented by icons, text, or icons plus text. I would like to know your opinion. | |
Graham: 25-Dec-2007 | Hmm.. bit complicated. Is there a way we can construct a layout and point the existing layout to the new one? this is how panels are done in Vid I think. | |
Pekr: 28-Aug-2008 | yeah ... I mean - I run - do %rebgui.r, and then? do I have to construct 'display, or does it contain runnable example? | |
Henrik: 22-Jan-2009 | yes... I have an app that works in a similar way. the answer was to construct a dialect that describes each screen with well-defined parts. | |
Group: Rebol School ... Rebol School [web-public] | ||
Graham: 4-Jan-2009 | I could construct a block of functions, a block of parameters, and a data variable . and feed them to the first function, gradually removing them from the blocks and passing them in the callbacks? | |
Geomol: 8-Feb-2009 | Taking some time to read and understand the chapter, I would guess, it wouldn't be too hard to construct an algorithm, that did the job. | |
Steeve: 16-Feb-2009 | Vlad, Good to know that there is other people involved in old computers revival. I'm always coding for MSX computers . Last year, with Rebol, i tried to simluate the PSG AY family (sound processor of MSX) and an old game (GALAGA). I think Rebol is perfect to construct toolsets for that purpose (graphics/maps/patterns/sprites editors, asm preprocessor). (see http://www.rebol.org/search.r?find=guest2&form=yes) | |
kib2: 23-Feb-2009 | Hi. Is there a build-in function do do something like this : given the number 5 and the string "abc" construct the string "abcabcabcabcabc" (equal 5 times "abc")? | |
Geomol: 26-Feb-2009 | construct doesn't work in this case, because then input-file just become the word READ. | |
Davide: 21-Mar-2010 | Just for fun (it's a slow sunday today) I've wrote a rebol version of the code used as benchmark in this page http://tinyurl.com/5nezt9 here's the code: REBOL [] person: make object! [ _count: none _prev: none _next: none _construct: func [n] [_count: n] get-prev: does [_prev] set-prev: func [pr] [_prev: pr] get-next: does [_next] set-next: func [nxt] [_next: nxt] shout: func [shout nth /local aux] [ if shout < nth [ return shout + 1 ] aux: get-prev aux/set-next get-next aux: get-next aux/set-prev get-prev 1 ] ] chain: make object! [ _first: none _last: none _construct: func [size /local current] [ repeat i size [ current: make person [] current/_construct i if none? _first [_first: current] if not none? _last [ _last/set-next current current/set-prev _last ] _last: current ] _first/set-prev _last _last/set-next _first ] kill: func [nth /local current shout] [ current: _first shout: 1 while [not equal? current current/get-next] [ shout: current/shout shout nth current: current/get-next ] _first: current ] ] start: now/precise iter: 100000 loop iter [ current-chain: make chain [] current-chain/_construct 40 current-chain/kill 3 ] print ["Time per iteration =" (difference now/precise start) / iter ] halt which give me: Time per iteration = 0:00:00.00080234 802 microsecond that is the slower time of the benchmark, but not SO slow, php is near with 593 microsecond, jython 632 ... .(the test system is pretty like mine so i can compare the result) There's a way to improve the performance? | |
Group: Tech News ... Interesting technology [web-public] | ||
Janko: 20-Mar-2011 | or just construct the pipes and pumps that would use seawater near to constantly water it? They transport oil across continets in pipes no matter how far the water is, they sould be able to make a constant suply in there. | |
Group: !REBOL3-OLD1 ... [web-public] | ||
Ladislav: 18-Sep-2006 | Moreover, it looks to me, that we are able to "simulate" such a construct using PARSE in REBOL2 | |
JaimeVargas: 5-Apr-2007 | So this new lazy LOAD is kind of a PARSER of REBOL values + foreign. I think it maybe easier to provide *rebol value rules*, so you can construct your PARSER as desired instead of triggering exceptions. | |
JaimeVargas: 5-Apr-2007 | Nah. That is easy to handle if you know how to construct your parsers properly. As easy an extra rule. | |
Pekr: 22-May-2007 | but what is definitely issue to me is that it is not imo consistent with how we construct scripts ... | |
Pekr: 22-May-2007 | and task for me is kind of higher level construct as script or modules are ... well, kind of "instance" of "environment" | |
Gabriele: 25-Jul-2007 | also, FOLD is a generic construct, as opposed to having special handling in all the natives. | |
BrianH: 7-Jan-2009 | Here's the current source for LOAD: load: func [ {Loads a file, URL, or string.} source [file! url! string! any-block! binary!] /header {Includes REBOL header object if present. Preempts /all.} ; /next {Load the next value only. Return block with value and new position.} ; /library {Force file to be a dynamic library. (Command version)} ; /markup {Convert HTML and XML to a block of tags and strings.} /all {Load all values. Does not evaluate REBOL header.} /unbound {Do not bind the block.} /local data tmp ][ ; Note: Avoid use of ALL func, because of /all option if any-block? :source [return :source] data: case [ string? source [to-binary source] binary? source [source] ; Check for special media load cases: (temporary code) find [%.jpg %.jpeg %.jpe] suffix? source [ return load-jpeg read/binary source ] url? source [read source] ; can this possibly return not binary! ? file? source [read source] ; binary! or block of file! ] ; At this point, data is binary!, a block of file!, or something weird. if binary? :data [ unless find [0 8] tmp: utf? data [ cause-error 'script 'no-decode ajoin ['UTF tmp] ] ; Only load script data: if any [header not all] [ ; Note: refinement /all if tmp: script? data [data: tmp] ] ] unless block? :data [data: to block! :data] ; reduce overhead ; data is a block! here, unless something really weird is going on tmp: none ; Is there a REBOL script header: if any [header not all] [ ; /header preempts /all tmp: unless any [ ;not any [file? source url? source] ; removed: hdr in string is same unset? first data ; because <> doesn't work with unset! 'rebol <> first data not block? second data ][ ; Process header: attempt [construct/with second data system/standard/script] ] ; tmp is header object or none here case [ tmp [ remove data either header [change data tmp][remove data] tmp: tmp/type = 'module ; tmp true if module ] header [cause-error 'syntax 'no-header data] ] ] ; tmp is true if module, false or none if not ; data is a block!, with possible header object in first position ; Bind to current global context if not a module: unless any [ unbound tmp ; not a module ][ bind/new data system/contexts/current ] ; data is a block! here, unless something really weird is going on ; If appropriate and possible, return singular data value: unless any [ ; avoid use of ALL all header ; This fixes a design flaw in R2's LOAD ;not block? :data ; can this ever happen? empty? data ; R2 compatibility not tail? next data ][data: first data] ; If /all or /header, data is a block here :data ] | |
Steeve: 13-Feb-2009 | i guess names msg are here to construct file trees | |
Steeve: 23-Mar-2009 | if you construct linked gobs for the same line of text (one gob = one style), i say good luck to manage wrapped lines. | |
BrianH: 3-Apr-2009 | load: func [ {Loads a file, URL, or string.} source [file! url! string! binary! block!] {Source or block of sources} /header {Includes REBOL header object if present. Preempts /all.} /next {Load the next value only. Return block with value and new position.} ; /library {Force file to be a dynamic library. (Command version)} ; /markup {Convert HTML and XML to a block of tags and strings.} /all {Load all values. Does not evaluate REBOL header.} /unbound {Do not bind the block.} /local data content val rst tmp ][ ; Note: Avoid use of ALL and NEXT funcs, because of /all and /next options content: val: rst: tmp: none ; In case people call LOAD/local ; Retrieve the script data data: case [ block? source [ ; Load all in block return map x source [apply :load [:x header next all unbound]] ] string? source [source] ; Will convert to binary! later binary? source [source] ; Otherwise source is file or url 'else [ ; See if a codec exists for this file type tmp: find find system/catalog/file-types suffix? source word! ; Get the data, script required if /header content: read source ; Must be a value, not unset case [ binary? :content [content] ; Assumed script or decodable string? :content [content] ; Assumed script or decodable header [cause-error 'syntax 'no-header source] block? :content [content] 'else [content: reduce [:content]] ] ; Don't LOAD/header non-script data from urls and files. ] ; content is data if content doesn't need copying, or none if it does ] ;print [1 "data type?" type? :data 'content true? :content] if string? :data [data: to-binary data] ; REBOL script is UTF-8 assert/type [data [binary! block!] content [binary! string! block! none!]] assert [any [binary? :data not header]] if tmp [ ; Use a codec if found earlier set/any 'data decode first tmp :data ; See if we can shortcut return the value, or fake a script if we can't case [ block? :data [if header [insert data val: make system/standard/script []]] header [data: reduce [val: make system/standard/script [] :data]] (to logic! unbound) and not next [return :data] ; Shortcut return any [next any-block? :data any-word? :data] [data: reduce [:data]] 'else [return :data] ; No binding needed, shortcut return ] assert/type [data block!] ; If we get this far ] ;print [2 'data mold to-string :data] if binary? :data [ ; It's a script unless find [0 8] tmp: utf? data [ ; Not UTF-8 cause-error 'script 'no-decode ajoin ["UTF-" abs tmp] ] ; Process the header if necessary either any [header not all] [ if tmp: script? data [data: tmp] ; Load script data ; Check for a REBOL header set/any [val rst] transcode/only data unless case [ :val = [rebol] [ ; Possible script-in-a-block set/any [val rst] transcode/next/error rst if block? :val [ ; Is script-in-a-block data: first transcode/next data rst: skip data 2 ] ; If true, val is header spec ] :val = 'rebol [ ; Possible REBOL header set/any [val rst] transcode/next/error rst block? :val ; If true, val is header spec ] ] [ ; No REBOL header, use default val: [] rst: data ] ; val is the header spec block, rst the position afterwards assert/type [val block! rst [binary! block!] data [binary! block!]] assert [same? head data head rst] ; Make the header object either val: attempt [construct/with :val system/standard/script] [ if (select val 'content) = true [ val/content: any [:content copy source] ] ] [cause-error 'syntax 'no-header data] ; val is correct header object! here, or you don't get here ; Convert the rest of the data if necessary and not /next unless any [next block? data] [data: rst: to block! rst] if block? data [ ; Script-in-a-block or not /next case [ header [change/part data val rst] ; Replace the header with the object not all [remove/part data rst] ; Remove the header from the data ] rst: none ; Determined later ] ] [rst: data] ; /all and not /header ] ; val is the header object or none, rst is the binary position after or none assert/type [val [object! none!] rst [binary! none!] data [binary! block!]] assert [any [none? rst same? head data head rst] any [val not header]] ;print [3 'val mold/all :val 'data mold/all :data "type?" type? :data] ; LOAD/next or convert data to block - block either way assert [block? data: case [ not next [ ; Not /next unless any [block? data not binary? rst] [data: to block! rst] data ] ; Otherwise /next block? data [reduce pick [[data] [first+ data data]] empty? data] header [reduce [val rst]] ; Already transcoded above binary? rst [transcode/next rst] ]] ; Bind to current global context if not a module unless any [ ; Note: NOT ANY instead of ALL because of /all unbound (select val 'type) = 'module ][ bind/new data system/contexts/current ] ;print [6 'data mold/all :data 'tmp mold/all :tmp] ; If appropriate and possible, return singular data value unless any [ all header next ; /all /header /next empty? data 1 < length? data ][set/any 'data first data] ;print [7 'data mold/all :data] :data ] | |
BrianH: 28-May-2009 | Yeah, and it doesn'tt make sense to ignore unset! with REDUCE because that is a value context. With CONSTRUCT it is treated as no-value and not inserted. Both of these are the right choice in their respective cases. | |
Chris: 2-Jun-2009 | Might be easier to do with parens instead of do/next, but the case-like construct is more readable... | |
Ladislav: 3-Jun-2009 | the error message is: "** Syntax Error: Invalid construct -- #[**" how does that tell it is a method? | |
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public] | ||
Maxim: 13-May-2009 | I realise that an on-connection-error callback (in the service) would also be required to construct a proper reply, based on the service being called. | |
Dockimbel: 17-Aug-2009 | I sometimes use the following safe construct to avoid reloading some longer code on each RSP script call : <% if not value? 'my-object [ my-object: context [ ;--loaded on each new worker process only once, then available in global context ... ] ] %> |
101 / 292 | 1 | [2] | 3 |