AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 56 |
r3wp | 836 |
total: | 892 |
results window for this page: [start: 1 end: 100]
world-name: r4wp
Group: #Red ... Red language group [web-public] | ||
DocKimbel: 5-Jul-2012 | No object! nor series! support planned for Red/System, remember that's supposed to be just a low-level dialect callable from Red meant for system programming. However, as Peter mentioned, it will be possible to access Red values and actions (mainly series and I/O actions) from Red/System when deeper interfacing with Red is needed. OOP is just not necessary to Red/System, only code and data encapsulation is IMO worth adding in the form of a module system. I'm not a big fan of intensive use of OOP, as done in C++ or Java (or I'm probably just repelled by class-based OOP). I find prototype-based OOP (REBOL, Javascript,...) much more appealing and will support it in Red. | |
DocKimbel: 31-Jul-2012 | As you can see, these features are not related to the object model from the user POV, because Red (like REBOL) are not OOL to me (I mean by OOL, languages that force you to use the object model). Anyway, the article looks interesting, so I'm saving the complete reading for the time when I'll work on the Red object! datatype (not implemented yet). | |
BrianH: 11-Aug-2012 | Maybe it could be used for some kind of multiple-prototyping of objects. Something like this: >> resolve/extend context [] reduce [context [a: 1] context [a: 2 b: 3]] == make object! [ a: 1 b: 3 ] | |
DocKimbel: 30-Nov-2012 | BTW, functions support should be finished this weekend, then I will work on object! and error! implementation new week. | |
DocKimbel: 4-Dec-2012 | EXIT and RETURN support have been added. Function! support is now complete. I plan to add closure! support too (and maybe R2-like functions also), but having object! seems like higher priority for now, as I want to implement port! datatype asap. | |
DocKimbel: 4-Dec-2012 | I need to process some pending tickets from the bugtracker, so I will probably start working on object! support tomorrow. | |
DocKimbel: 4-Dec-2012 | it would be strange from you to try to push us to recreate an object just to expand it That is part of the basic semantics of the R2 object! datatype, it follows the prototype-based model. You construct new objects by copying existing ones, it can be just a copy (cloning the source object), or derivation (extending the source object with new words). Changing object context (adding/removing words) without creating a new one is not consistent anymore, so it can look like a big hack. | |
BrianH: 10-Dec-2012 | Yes, that's what I meant. I phrased it that way because there was a big discussion where people were requesting that an option be added to objects to have them be case-sensitive, to distinguish based on case when mapping words to value slots, rather than the case-preserving default. We had to reject that proposal because there was no way to specify that option in the make object! syntax. The only way to do that in Rebol is to have a separate object-like datatype that has case-sensitive word mapping. The same proposal was made for maps, with the same results: a case-sensitive alternate type would be required. For both of those types, SELECT vs. SELECT/case could have some meaningful distinction, though we didn't get far enough for that to be an issue yet. | |
DocKimbel: 2-Mar-2013 | Nobody has proposed me so far to build a R2-level cross-platform console for Red, so I will implement one in the next weeks. Before that, I will probably work on PIC support for Mach-O and ELF and implement object! support. | |
DocKimbel: 7-Mar-2013 | State of Red's PARSE: It's not on the roadmap because it's too low-level for the bird view (maybe I need to add it anyway?). Moreover, PARSE is not (for now) useful for the internal construction of Red/System and Red, so from that perspective, it's quite low-priority. OTOH, it is quite simple to implement in Red/System, and users could see that as a sign of good progress, so I probably need to schedule it for a weekend to implement a R2-level PARSE (with a couple of features from R3's PARSE) and a few more days to test and debug it. Also, Gabriele is interested in implementing a "compiled" PARSE version for Red, but unfortunately, Red has not yet all the features that Gab needs for it (mainly object! support). So, he's waiting on me to get Red ready first. As currently, object! support is much more important to implement (for completing the context/binding model of Red and enabling ports) than PARSE, you might get Gab's version first. Also if it's fast enough, I wouldn't need to make a Red/System version then. Last but not least, I don't agree with 100% of the changes/addition in PARSE for R3, so I would need to review R3 parse and make a "cleaned-up" version for Red. Also, Topaz has some interesting improvements on PARSE what I might want to include in Red's version too, so that needs a bit of preliminary review work. So, as you can see, it's hard to give you a precise timeframe, I guess we would have a first version of it during Q2 2013. | |
DocKimbel: 9-Mar-2013 | I'm counting 27 datatypes implemented so far in Red. The next on the list will be: typeset!, errror!, object!, port!, binary!. Although, I'm not sure in which precise order they will be added (especially for error! and object!, not sure which one I'll do first). For other datatypes, like float!, date! and time!, which are not a requirement for building Red core itself, I would like them to be contributed if possible. I could provide a sample empty datatype file and instructions on how to use Red's current internal API to anyone willing to work on them. | |
DocKimbel: 17-Apr-2013 | I'm afraid my short-term schedule is already full, I've kept postponing very important parts for months, I need to get them implemented now (shared libs, error!, typeset!, object!). | |
PeterWood: 8-May-2013 | I believe that object! datatype and an improved 'LOAD function are pre-cursors to I/O in Red and the reason that i/O isn't top of the priority list. (Of ocurse, I may be wrong) | |
DocKimbel: 9-Jun-2013 | Concurrency: yes, once we add object!, errors handling and I/O. So probably not before fall of this year. I also want to support GPGPU computing, but that will probably be in the selfhosted Red 2.0. | |
DocKimbel: 23-Jun-2013 | I will need to go back to object! implementation in Red before implementing those layers. | |
Group: Rebol School ... REBOL School [web-public] | ||
Sujoy: 21-Apr-2012 | have an issue: >> fact1: 'a/a >> num1: 99.0 >> blk: [greater? to-decimal obj/:fact1 num1] >> objs: [] >> o: make object! [a: make object! [a: "100.0"] >> append objs o >> o: make object! [a: make object! [a: "99.0"] >> append objs o >> foreach obj objs [if equal? do bind blk 'obj true [print obj/a]] **Invalid path value: a/a | |
Steeve: 21-Apr-2012 | copy that, it must work: fact1: 'a/a num1: 99.0 blk: [greater? to-decimal do bind reduce [fact1] obj num1] objs: [] o: make object! [a: make object! [a: "100.0"]] append objs o o: make object! [a: make object! [a: "99.0"]] append objs o foreach obj objs [if equal? do bind blk 'obj true [print obj/a]] | |
Steeve: 21-Apr-2012 | typo again >> o: make object! [a: "100.9"] you need sleeping time | |
Sujoy: 21-Apr-2012 | hmmm...not that i know of...just using the test data i put in here: >> probe objs [make object! [ a: make object! [ a: "100.0" ] ] make object! [ a: make object! [ a: "99.0" ] ] make object! [ a: "199.0" ]] | |
Steeve: 21-Apr-2012 | or you must check in your code when 'a is an object! | |
Gregg: 24-Apr-2012 | set 'format-phone-number func [ num [string! object!] "String or object with /text value" /def-area-code area-code [string! integer!] /local left right mid obj res ] [ left: func [s len][copy/part s len] right: func [s len] [copy skip tail s negate len] mid: func [s start len][copy/part at s start len] if object? num [obj: num num: obj/text] res: either data: parse-phone-num num [ ; discard leader if it's there. if all [11 = length? data/num data/num/1 = #"1"] [ data/num: right data/num 10 ] rejoin [ rejoin switch/default length? data/num [ 7 [ compose [ (either area-code [rejoin ["(" area-code ") "]][]) left data/num 3 "-" right data/num 4 ]] 10 [[ "(" left data/num 3 ") " mid data/num 4 3 "-" right data/num 4 ]] ][[data/num]] reduce either data/ext [[" ext" trim data/ext]] [""] reduce either data/pin [[" pin" trim data/pin]] [""] ] ][num] if obj [ obj/text: res attempt [if 'face = obj/type [show obj]] ] res ] | |
Henrik: 7-May-2012 | A face is an object, so this is no different than saying: a: make object! [text: "foo"] a/text: "boo" | |
Sunanda: 15-May-2012 | You can easily create an object! (ie a set of words) from the CGI input. This articles explaiins how: http://www.rebol.org/art-display-article.r?article=x60w ....Section 3 is the quick guide ....The next few pages describe all the things that can go wrong (probably more than you need to know right now) ....Section 7 points you to a script that handles all the edge cases for you. | |
JohnM: 16-May-2012 | Sunanda: Thanks again for issuing the World invitation. Everyone thanks for the continuing help. I have read the cited document, but it just leaves me with more questions. Is the following literal? cgi-string: read-cgi cgi-block: decode-cgi cgi-string cgi-obj: make object! cgi-block That is to say should I type exactly that? Or is cgi-string for example a theoretical variable assignment that I could call anything? Are they all proper commands, or is any part of that just for example purposes? I am thinking I should copy and paste it verbatium. I am also thinking I mispelt verbatum. I am stuck with GET. Does this mean I can leave out some code that makes up for not knowing if the original data is POST vs GET? These are hypothetical questions for better long term learning. I for now will go with the idea that everything is as straight fowarrd as it seems. I know that my GET stream will have "trnEmailAddress" in it which is a field that will contains an email address. So will the following generate a random number, extract the address and email the same random number to that email address? token: random/seed now/percise cgi-string: read-cgi cgi-block: decode-cgi cgi-string cgi-obj: make object! cgi-block send trnEmailAddress rejoin [ "Thank you. Your number is" token "." ] Graham: Thank you for the extra info on GUID, but Windows is not involved here. I realize that random number generating really isn't unless you have a monkey throwing darts at a numbered board. Regardless extra effort to make a number unique is useful and your advice appreciated. I do not think the corner cases will come up and the people who control the original form assured me that web page issues warnings if the form is not filled out correct which should help. I do realize that people are idiots, systems are not fool proof, etc. What I am saying is my basic needs are basic and I should be OK so I am not fretting over those examples. It is great though to know the solutions are out there when I need them. Tahnks. | |
Sunanda: 16-May-2012 | Yes, the names of the words are arbitrary. -- you can chose your own names. Whether the data came in via GET or POST makes no difference if you issue the READ-CGI just once. If the CGI string was yadda.com?email=[me-:-test-:-com]&token=0 then the cgi-obj will look like this: make object! [ email: "[me-:-test-:-com]" token: "0" ] Note the values are strings, so you need to convert the email value to an email! datatype: send to-email cgi-obj/email rejoin [ "Thank you. Your number is" cgi-obj/token "." ] | |
Sunanda: 16-May-2012 | If the CGI string was yadda.com which is what a lot of indexing bots will use, then the cgi-obj will look like this: make object! [ ] Hence you do need to do some data sanitisation, no matter how much the form people assure you the data will be right. | |
GrahamC: 16-May-2012 | John you have to seed the generator first and then generate your number And you can dispense with the cgi-string by cg-block: make object! decode-cgi read-cgi | |
Sujoy: 3-Jul-2012 | i have a block of objects: each object is constructed like... c: #object! [ name: "wonderwoman" attribs: [ Y1991: #object! [ a: 1 n: 2] Y1992: #object! [ a: 1 n: 2] ] ] i need to sort the series based on fields of the attribs inner object i dont want to create a new series...any ideas? | |
Sujoy: 3-Jul-2012 | h: #hash! [k-a object! [ name: "wonderwoman" attribs: make hash! ["1993-1994" #object! [ rebal-year: 1993 m: 160.018245 ] "1992-1993" #object! [ rebal-year: 1992 m: 104.293 ] "1991-1992" #object! [ rebal-year: 1991 m: 26.628 ]] ...and so on... | |
Sujoy: 3-Jul-2012 | this is the structure i'm using: h: #hash! [k-a object! [ name: "wonderwoman" attribs: make hash! ["1993-1994" #object! [ rebal-year: 1993 m: 160.018245 ] "1992-1993" #object! [ rebal-year: 1992 m: 104.293 ] "1991-1992" #object! [ rebal-year: 1991 m: 26.628 ] ] k-b object! [ name: "wonderwoman" attribs: make hash! ["1993-1994" #object! [ rebal-year: 1993 m: 160.018245 ] "1992-1993" #object! [ rebal-year: 1992 m: 104.293 ] "1991-1992" #object! [ rebal-year: 1991 m: 26.628 ] ] | |
Sujoy: 3-Jul-2012 | here's the hash closer to reality: #[hash!["20Th Century Finance Corpn. Ltd. [Merged]" #[object! [ name: "20Th Century Finance Corpn. Ltd. [Merged]" mcapz: #[hash!["1993-1994" #[object! [ yyyymmdd: 30-Sep-1993 rebal-year: 1993 ln-mcap: 5.07528783998276 mcap: 160.018245 ltmto: 0 ]] "1992-1993" #[object! [ yyyymmdd: 30-Sep-1992 rebal-year: 1992 ln-mcap: 4.64720424566052 mcap: 104.293 ltmto: 0 ]] "1991-1992" #[object! [ yyyymmdd: 27-Sep-1991 rebal-year: 1991 ln-mcap: 3.28196329373846 mcap: 26.628 ltmto: 0 ]] "1996-1997" #[object! [ yyyymmdd: 30-Sep-1996 rebal-year: 1996 ln-mcap: 4.22786241308827 mcap: 68.5705 ltmto: 4.4951 ]] "1995-1996" #[object! [ yyyymmdd: 29-Sep-1995 rebal-year: 1995 ln-mcap: 4.6522555263423 mcap: 104.821146 ltmto: 1.9152 ]] "1994-1995" #[object! [ yyyymmdd: 30-Sep-1994 rebal-year: 1994 ln-mcap: 5.60133608288591 mcap: 270.787961 ltmto: 0 ]] "1999-2000" #[object! [ yyyymmdd: 1-Sep-1999 rebal-year: 1999 ln-mcap: #[none] mcap: #[none] ltmto: 0.3847 ]] "1998-1999" #[object! [ yyyymmdd: 30-Sep-1998 rebal-year: 1998 ln-mcap: 3.26596118430253 mcap: 26.205287 ltmto: 1.8029 ]] "1997-1998" #[object! [ yyyymmdd: 30-Sep-1997 rebal-year: 1997 ln-mcap: 3.70636432395486 mcap: 40.705545 ltmto: 4.0871 ]]]] ]] "3M India Ltd." #[object! [ name: "3M India Ltd." mcapz: #[hash!["1993-1994" #[object! [ yyyymmdd: 30-Sep-1993 rebal-year: 1993 ln-mcap: 5.2695189287062 mcap: 194.322457 ltmto: 0 ]] "1992-1993" #[object! [ yyyymmdd: 30-Sep-1992 rebal-year: 1992 ln-mcap: 5.16365007188814 mcap: 174.80133 ltmto: 0 ]] "1991-1992" #[object! [ yyyymmdd: 27-Sep-1991 rebal-year: 1991 ln-mcap: 5.13698182480598 mcap: 170.201295 ltmto: 0 ]] "1994-1995" #[object! [ yyyymmdd: 30-Sep-1994 rebal-year: 1994 ln-mcap: 5.67980332582336 mcap: 292.89182 ltmto: 0 ]] "1995-1996" #[object! [ yyyymmdd: 29-Sep-1995 rebal-year: 1995 ln-mcap: 5.36086870986747 mcap: 212.909823 ltmto: 2.438 ]] "1996-1997" #[object! [ yyyymmdd: 27-Sep-1996 rebal-year: 1996 ln-mcap: 5.29527142738166 mcap: 199.391739 ltmto: 13.7717 ]] "1999-2000" #[object! [ yyyymmdd: 30-Sep-1999 rebal-year: 1999 ln-mcap: 6.62266108574718 mcap: 751.943423 ltmto: 70.8157 ]] "1998-1999" #[object! [ yyyymmdd: 30-Sep-1998 rebal-year: 1998 ln-mcap: 5.59892693888198 mcap: 270.136379 ltmto: 12.1941 ]] "1997-1998" #[object! [ yyyymmdd: 30-Sep-1997 rebal-year: 1997 ln-mcap: 5.41116944722567 mcap: 223.893266 ltmto: 10.31 ]] "2002-2003" #[object! [ yyyymmdd: 30-Sep-2002 rebal-year: 2002 ln-mcap: 5.87169433363346 mcap: 354.849705 ltmto: 18.495901 ]] "2001-2002" #[object! [ yyyymmdd: 28-Sep-2001 rebal-year: 2001 ln-mcap: 5.70261800358953 mcap: 299.650862 ltmto: 17.817 ]] "2000-2001" #[object! [ yyyymmdd: 29-Sep-2000 rebal-year: 2000 ln-mcap: 6.51937914011665 mcap: 678.157214 ltmto: 39.9108 ]] "2003-2004" #[object! [ yyyymmdd: 30-Sep-2003 rebal-year: 2003 ln-mcap: 6.14402101757279 mcap: 465.923295 ltmto: 22.518454 ]] "2004-2005" #[object! [ yyyymmdd: 30-Sep-2004 rebal-year: 2004 ln-mcap: 6.36648735824138 mcap: 582.009842 ltmto: 18.47743 ]] "2005-2006" #[object! [ yyyymmdd: 30-Sep-2005 rebal-year: 2005 ln-mcap: 6.89448778574422 mcap: 986.820132 ltmto: 76.96006 ]] "2007-2008" #[object! [ yyyymmdd: 28-Sep-2007 rebal-year: 2007 ln-mcap: 7.61782530207882 mcap: 2034.13369 ltmto: 565.232151 ]] "2006-2007" #[object! [ yyyymmdd: 29-Sep-2006 rebal-year: 2006 ln-mcap: 7.29216005157061 mcap: 1468.739827 ltmto: 326.743221999999 ]] "2008-2009" #[object! [ yyyymmdd: 30-Sep-2008 rebal-year: 2008 ln-mcap: 7.3914506403371 mcap: 1622.057429 ltmto: 244.97382 ]] "2010-2011" #[object! [ yyyymmdd: 30-Sep-2010 rebal-year: 2010 ln-mcap: 8.40720356304076 mcap: 4479.217133 ltmto: 123.100087 ]] "2009-2010" #[object! [ yyyymmdd: 30-Sep-2009 rebal-year: 2009 ln-mcap: 7.58070461394744 mcap: 1960.009529 ltmto: 91.0568390000001 ]] "2011-2012" #[object! [ yyyymmdd: 30-Sep-2011 rebal-year: 2011 ln-mcap: 8.45073201719186 mcap: 4678.496222 ltmto: 282.168385 ]]]] ]] | |
Sujoy: 3-Jul-2012 | i cant seem to reference the object! | |
Maxim: 3-Jul-2012 | when you use /all, you get two BLOCKS. one for each record of length /skip so your function is called like so: sort-func [ "2009-2010" #[object! [ ... ]] ] [ "2011-2012" #[object! [ ... ]] ] | |
Sujoy: 3-Jul-2012 | am getting somewhere (i think) >> sort/skip/compare/all comps 2 func [a b][o: a/2/mcapz probe o] === make hash! ["2003-2004" make object! [ yyyymmdd: 30-Sep-2003 rebal-year: 2003 ...]] etc | |
DocKimbel: 23-Jul-2012 | This function should help you: form-error: func [err [object!]][ foreach w [arg1 arg2 arg3][ set w either unset? get/any in err w [none][ get/any in err w ] ] reform [ "***" system/error/(err/type)/type #":" reduce system/error/(err/type)/(err/id) newline "*** Where:" mold/flat get in err 'where newline "*** Near: " mold/flat get in err 'near newline ] ] | |
Sunanda: 30-Jul-2012 | Anyone want to have a try at this little puzzle? I have a working solution, but I am sure there is way more REBOLish way. I have two objects that each contain simple REBOL values (ie imagine they've just been created from some serialised data, so no recursive blocks or anything tricky): obj1: make object! [aaa: 1 bbb: "xx"] obj2: make object! [bbb: "XX" aaa: 1] All I want to do is confirm that they contain identical words and values under normal REBOL comparison rules -- so obj1 and obj2 should be treated as identical, while the next few are not identical to obj1 or obj2: obj3: make object! [bbb: "xx"] ;; no 'aaa word obj4: make object! [bbb: "XX" aaa: 1 ccc: 3] ;; extra word obj5: make object! [bbb: "XX" aaa: -1] ;; different 'aaa word value I am sure there is a simple one-line 'parse solution .... Isn't there always!? Thanks! | |
Endo: 30-Jul-2012 | Sunanda: I wrote this function a few months ago for the same task: It may not a very good solution but its ok (I think) similar?: func [ {Returns true if both object has same words in same types.} o [object!] p [object!] /local test ][ test: [if not equal? type? get in o word type? get in p word [return false]] foreach word sort first o test foreach word sort first p test true ] | |
Sunanda: 30-Jul-2012 | Endo -- thanks....That's a useful starting point for a function that is capable of listing what the differences are. Steeve -- 'difference on third was my first design ....But it fails on (say) obj1: make object! [a: 1 b: 2] obj2: make object! [a: 2 b: 1] Maxim .... Nice! | |
GrahamC: 14-Aug-2012 | >> do http://reb4.me/r/altjson.r connecting to: reb4.me Script: "REBOL <-> JSON" (15-Jul-2011) >> j: to-json make object! [ b: none ] == {{"b":null}} | |
BrianH: 27-Aug-2012 | Functions and objects aren't copied, but everything else seems to be: >> a: reduce ["" #{} 'a/b [] quote () make list! [] make hash! [] does [] context []] == ["" #{} a/b [] () make list! [] make hash! [] func [][] make object! [ ]] >> b: bind/copy a 'a == ["" #{} a/b [] () make list! [] make hash! [] func [][] make object! [ ]] >> map-each [x: y] b [same? :y first at a index? x] == [false false false false false false false true true] | |
Steeve: 3-Oct-2012 | Notice the weird sequence >> to-block form first object! That is because the local context returned from a function is not well formed. If the specs of the function are [a [block!] /local b], it will return a strange objetc! where: >> first object! == [a /local b] So to correct its format, I do >> to-block form first object == [a local b] | |
Ladislav: 5-Oct-2012 | Rebol [ Title: "Catch" File: %catch.r Date: 5-Oct-2012/17:49:58+2:00 Author: "Ladislav Mecir" Purpose: { Catches local throw' Ignores non-local throws } ] ; Error definition system/error: make system/error [ throw': make object! [ code: system/error/throw/code + 50 type: "throw' error" not-caught: ["throw' not caught"] ] ] catch': func [ {Catches a throw' from a block and returns the value.} [throw] block [block!] "Block to evaluate" /local err disarmed ] [ use [throw'] copy/deep compose/only [ ; "localize" 'throw' in the block block: (block) throw': func [[catch] value [any-type!]] [ disarmed: disarm err: make error! [throw' not-caught] set/any in disarmed 'arg1 get/any 'value disarmed/arg2: 'throw' throw err ] get/any either all [ error? set/any 'err try block ( disarmed: disarm err disarmed/type = 'throw' ) disarmed/id = 'not-caught disarmed/arg2 =? 'throw' ] [ in disarmed 'arg1 ] [ 'err ] ] ] | |
caelum: 31-Jan-2013 | So I have a block account: make object! [ name: "James" balance: $100 ss-number: #1234-XX-4321 deposit: func [amount] [balance: balance + amount] withdraw: func [amount] [balance: balance - amount] ] and I save it save %account-object account then I read it back in new-account: load %account-object account is an object, whilst new-account is a block. My question is, how do I load the object into new-account as an object? So I end up with another object, not a block | |
Endo: 1-Feb-2013 | you can also use SAVE/ALL to save in serialized form: >> o: context [a: 1] save/all %file.r o p: load %file.r type? p == object! | |
Endo: 1-Feb-2013 | Yes, here is an example: >> save/all %file.txt o context [a: self] >> load %file.txt ** Syntax Error: Missing ] at end-of-script file.txt file is: #[object! [ a: #[object! [...] ;<--- ]] | |
Group: !REBOL3 ... General discussion about REBOL 3 [web-public] | ||
GrahamC: 9-Jan-2013 | >> write http://www.rebol.com/index.html[ HEAD ] make object! [ name: none size: none date: none type: 'file response-line: "HTTP/1.1 200 OK" response-parsed: none headers: make object! [ Content-Length: "7407" Transfer-Encoding: none Last-Modified: "Sat, 15 Dec 2012 07:02:21 GMT" Date: "Wed, 09 Jan 2013 09:24:53 GMT" Server: "Apache" Accept-Ranges: "bytes" Content-Type: "text/html" Via: "1.1 BC5-ACLD" Connection: "close" ] ] | |
BrianH: 10-Jan-2013 | Chris, the easiest way to do what you are trying to do is to use sys/load-header, which returns a block of the decoded header object, the position of the script after the header (after decompressing it if need be), and the position after the whole script (useful for embedded scripts. If the script is embedded in a block it will decode the whole script and return the decoded block at the position after the header, but that can't be helped. R3 scripts are binary, not text, so the returned script position is binary. >> sys/load-header "#!/some/path 1foo^/REBOL []^/script here" == [make object! [ title: "Untitled" name: none type: none version: none date: none file: none author: none needs: none options: none checksum: none ] #{7363726970742068657265} #{}] >> to-string second sys/load-header "#!/some/path 1foo^/REBOL []^/script here" == "script here" Note that it will skip past one trailing newline after the header, if one exists. | |
BrianH: 10-Jan-2013 | Here's an example of that script-in-a-block embedding I mentioned: >> sys/load-header "#!/some/path 1foo^/[REBOL []^/script here] other stuff" == [make object! [ title: "Untitled" name: none type: none version: none date: none file: none author: none needs: none options: none checksum: none ] [ script here ] #{206F74686572207374756666}] | |
GrahamC: 18-Jan-2013 | what exactly does mode do? ) >> query/mode %tiger.png none == make object! [ name: %/E/r3gui/tiger.png size: 6515 date: 26-Apr-2009/9:12:54+13:00 type: 'file ] >> query %tiger.png == make object! [ name: %/E/r3gui/tiger.png size: 6515 date: 26-Apr-2009/9:12:54+13:00 type: 'file ] | |
GrahamC: 18-Jan-2013 | >> query/mode %tiger.png 'size == make object! [ name: %/E/r3gui/tiger.png size: 6515 date: 26-Apr-2009/9:12:54+13:00 type: 'file ] | |
BrianH: 8-Feb-2013 | Also SET object! block!, since it has the same bug. | |
BrianH: 8-Feb-2013 | If you have any code that uses SET block! block! or SET object! block!, and the values block might possibly have unset values in it, then *your code is buggy*. If you want the unset values to be assigned, you should be using SET/any. If you want the unset values to trigger errors (a fair assumption, since you're using SET instead of SET/any), those errors are currently *not* being triggered because of a bug in R3. Either way, check your code. | |
BrianH: 8-Feb-2013 | If you're using SET block! block! or SET object! block! in cases where you can get unset values and are expecting errors to be triggered, then your code is buggy until this is fixed. If you are expecting it to *not* trigger errors, then your code will be buggy until you change to using SET/any - it's just accidentally working until this is fixed, and then will properly not work after it is fixed. | |
AdrianS: 11-Feb-2013 | has much changed wrt bind for Rebol 3? I see, for example that this line (under 'Variables') in the Bindology section on rebol.net returns true whereas it used to return false with R2. Is that article variable? /rebol Just a bit lower this: o: make object! [a: none] o-context: bind? in o 'a same? o o-context ; == false -> now returns true Is there an R3 specific explanation of binding? | |
GrahamC: 23-Feb-2013 | This is a tip for where you have those pesky @s in a username. You still can't get past that by using %40 in a url as Rebol converts those when it evaluates the url but you can do this >> cmd: open decode-url "ftp://user%40rebol.com:[password-:-ftp-:-rebol-:-com]" make object! [ title: "FTP Protocol" scheme: 'ftp ref: [scheme: 'ftp pass: "password" user: "user%40rebol.com" host: "ftp.rebol.com"] path: none host: "ftp.rebol.com" port-id: 21 pass: "password" user: "user%40rebol.com" ] port opened ... | |
Sunanda: 1-Mar-2013 | Is this an R3 bug or feature? Duplicate word in a single object.... ob: object [] append ob [b: 2 b: 3 b: 4] == make object! [ b: 2 b: 3 b: 4 ] foreach w words-of ob [print get w] ;; they are actually different 2 3 4 |
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
Sunanda: 13-Jan-2005 | Thanks for the strict-greater? idea. I was hoping there was a built-in ability somewhere. One tiny tweak to the function -- you need to restrict the two values to series or you can get strange results: >> strict-greater? make object! [1] make object! [0] == false >> greater? make object! [1] make object! [0] ** Script Error: Cannot use greater? on object! value So: strict-greater?: func [value1 [series!] value2 [series!]] [(to-binary value1) > (to- binary value2)] | |
shadwolf: 14-Jan-2005 | >> a: make object! SMD2Header ** Script Error: Invalid argument: make struct! [ m_iMagicNum [int] m_iVersion [int] m_iSkinWidthPx [int] m_iSkinHeightPx [int] m_iFrameSize [int] m_iNumSkins [int] m_iNumVertices [int] m_iNumTexCoords [int] m_iNumTriangles [int] m_iNumGLCommands [int] m_iNumFrames [int] m_iOffsetSkins [int] m_iOffsetTexCoords [int] m_iOffsetTriangles [int] m_iOffsetFrames [int] m_iOffsetGlCommands [int] m_iFileSize [int] ] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] | |
Group: Script Library ... REBOL.org: Script library and Mailing list archive [web-public] | ||
Maxim: 14-Sep-2006 | sunanda I am getting an error from the server itself! whenever I press download, it starts the download (shows the green xfer data on the bottom, and then pops up an error: here is the error as reported by LDS: make object! [ status: [100 20 "bad cgi data"] data: none diagnostics: [9003 9003 9.8084E-2] supply-date: 15-Sep-2006/1:03:41 ] have any idea where that is comming from? I try to check it out from the code I have... but its been sooo long, A nudge on your part will help me get this working much faster IMHO! | |
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
Anton: 10-Mar-2005 | *Then* CONTEXT starts building a new object! of its own, from the spec block of binded words. But it only puts the set-words (eg. chars: non-chars: but *not* 'copy-word) into the new object. | |
Henrik: 10-Mar-2005 | is it possible to use an object variable for a VID item, such as obj: make object! [t: none] where I would like view layout [obj/t: button "hello"] in some way? it doesn't work... | |
Sunanda: 28-Apr-2005 | As far as I know it is not possible to define new types. Not sure that would solve your problem anyway. A word can point to a value that has only *one* type (ignoring the heirarchy -- eg block! is also series!). So complex assertions about something would not be easy. Maybe rethink the need.....Use objects to hold both a value and a type: >> item: make object! [value: 'salt type: 'seasoning] >> item/type == seasoning >> 'seasoning = item/type == true You could encapsulate that in a couple of functions and expand the scope (maybe make type a block with multiple values) | |
Sunanda: 30-Apr-2005 | Adding or deleting fields in objects can be tricky if you have multiple references to the object: obj: make object! [a: 1 b: 2] block: copy [] append block obj obj/a: 9 probe block ; shows the object in the block is the same as obj obj: [a: 7] ; attempt to update obj to remove b probe block ; the object in the block still has a 'b -- it's still the original Otherwise, the technique is fine. | |
Ingo: 30-Apr-2005 | Or in other words, you can't add/remove fields in objects, but you can clone objects, and add/remove during cloning >> a: make object! [b: 1 c: 2] >> b: make a [d: 3] >> probe b make object! [ b: 1 c: 2 d: 3 ] >> c: make object! head remove/part find third b to set-word! 'c 2 >> probe c make object! [ b: 1 d: 3 ] Just as a little helper ... >> third b == [b: 1 c: 2 d: 3] | |
Group: Linux ... [web-public] group for linux REBOL users | ||
[unknown: 10]: 22-Mar-2006 | Its strange.. I should not be needing to run a fontserver..My desktop is already anti-aliased with fonts and so it the rest..But rebol still does not display it... mmm It does load the font though..(also when i look with an Strace during the execute rebol does read the font..) it simply does not display it ..yet! ;-) >> probe fnt1 make object! [ name: "/usr/X11R6/lib/X11/fonts/TTF/VeraMono.ttf" style: none size: 32 color: 0.0.0 offset: 2x2 space: 0x0 align: 'center valign: 'center shadow: none ] | |
Group: CGI ... web server issues [web-public] | ||
Henrik: 22-Apr-2005 | (local machine) and it returns: make object! [ server-software: none server-name: none gateway-interface: none server-protocol: none server-port: none request-method: none path-info: none path-translated: none script-name: none query-string: none remote-host: none remote-addr: none auth-type: none remote-user: none remote-ident: none Content-Type: none content-length: none other-headers: [] ] | |
François: 25-Jul-2005 | With Apache 2.x (normal CGI), we have: make object! [ server-software: "Apache/2.0.54 (Fedora)" server-name: "localhost" gateway-interface: "CGI/1.1" server-protocol: "HTTP/1.1" server-port: "80" request-method: "GET" path-info: "/sample01.rhtml" path-translated: "/var/www/html/sample01.rhtml" script-name: "/cgi-bin/magic.cgi" query-string: "" remote-host: none remote-addr: "127.0.0.1" auth-type: none remote-user: none remote-ident: none Content-Type: none content-length: none other-headers: [ "HTTP_HOST" "localhost" "HTTP_USER_AGENT" {Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050720 Fedora/1.0.6-1.1.fc4 Firefox/1.0.6} "HTTP_ACCEPT" {text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5} "HTTP_ACCEPT_LANGUAGE" "en-us,en;q=0.5" "HTTP_ACCEPT_ENCODING" "gzip,deflate" "HTTP_ACCEPT_CHARSET" "ISO-8859-1,utf-8;q=0.7,*;q=0.7" "HTTP_KEEP_ALIVE" "300" "HTTP_CONNECTION" "keep-alive" "HTTP_COOKIE" "PHPSESSID=7f84fd7766f23e1462fed550ecbbfda4" ] ] | |
François: 25-Jul-2005 | With LiteServer and lighttpd (normal CCI and FastCGI) i have: make object! [ ... path-info: "" path-translated: none script-name: "/sample01.rhtml" ... ] | |
François: 25-Jul-2005 | And with lighttpd: make object! [ ... path-info: none path-translated: none script-name: "/sample01.rhtml" ... ] | |
Group: Cookbook ... For http://www.rebol.net/cookbook/requests.html [web-public] | ||
Sunanda: 7-Jul-2005 | DideC -- your method is similar to Henrik's, and has the same limitation: sub-objects fields do not propagate as you'd expect.....No f2-2 field in 'config here: standard-config: make object! [f1: 1 f2: make object! [f2-1: 21 f2-2: 22] f3: 3] config-file: make object! [f1: 88 f2: make object! [f2-1: 99]] probe config: construct/with third config-file standard-config | |
Group: XML ... xml related conversations [web-public] | ||
Chris: 28-Oct-2005 | Likely because in the code, it says -- parser: make object! [[ ... parse-xml: ...]] | |
Chris: 30-Oct-2005 | I understand the need for efficiency, I am also mindful of completeness. The DOM is a complete standard for accessing XML (and I appreciate that the 'O' in DOM does not necessarily mean Rebol object! :o) | |
Christophe: 1-Nov-2005 | About the choice of the right internal data-keeping structure: because we are manipulating big XML files (> 2MB), we had to find the most performant way to retrieve our data into a nested structure. The choice was block! / hash! / list! / or object! . after a few tests, it appears that block! is the most suitable in terms of retrieval time. Note that this is true only for nested structures. In case of one-level structures, the hash! is the most performant (see http://www.rebol.net/article/0020.html). | |
Christophe: 7-Nov-2005 | I was fighting today to find the best internal data format. Out of the tests seems object! the most performant when using nested data structure. hash! when not nested. but the problem with object! is that we cannot have a recurrent element in the structure, like: <aaa> <bbb>content</bbb> <bbb bbb_attrib="attrib1"></bbb> </aaa> because, of course, when evaluated the last definition of bbb overrides the others. So, we are trying to work with hash! We got a little diminution of the overhead comparing to XML, but the processing time compare to block! seems from 10 to 20% more. I need some more tests about data retrieving in the structure to find the right combination; Any suggestion is welcome ! | |
Graham: 26-Oct-2008 | How are people creating large xml documents where there are large numbers of elements and where the data is being drawn from a database. Model the document first as a Rebol object!, and then generate the xml from the object? | |
PeterWood: 4-Nov-2008 | obj-xml: make object! xml-to-object parse-xml+ read %my.xml | |
Graham: 4-Nov-2008 | soapenv:Envelope: make object! is not valid | |
Chris: 4-Dec-2008 | Ok, another revision. This has a few more methods, I may strip them down to read-only, as I don't need to manipulate the object though I left them in for completeness. >> do http://www.ross-gill.com/r/qdom.r connecting to: www.ross-gill.com Script: "QuickDOM" (none) >> doc: load-dom {<some><xml id="foo">to try</xml></some>} >> foo: doc/get-by-id "foo" >> foo/name == <xml> >> foo/value == [ /id "foo" # "to try" ] >> kids: foo/children == [make object! [ name: # value: "to try" tree: [ # "to try" ] position: [ ... >> kids/1/value == "to try" >> doc/tree/<some>/<xml>/(#) == "to try" | |
Graham: 22-Jun-2009 | This seems to work for me ... obj2xml: func [ obj [object!] out [string!] /local o ][ foreach element next first obj [ repend out [ to-tag element newline ] either object? o: get in obj element [ obj2xml o out ][ repend out [ o newline ] ] repend out [ to-tag join "/" element newline ] ] ] | |
Graham: 22-Jun-2009 | using this obj2xml: func [ obj [object!] out [string!] /local o ][ foreach element next first obj [ repend out [ to-tag element newline ] either object? o: get in obj element [ obj2xml o out ][ repend out [ o newline ] ] repend out [ to-tag join "/" element newline ] ] ] | |
Graham: 22-Jun-2009 | >> probe obj make object! [ a: "testing" b: "again" c: make object! [ d: "testing2" e: "again2" f: make object! [ g: "testing3" h: "again3" ] ] i: "finished" ] | |
Graham: 22-Jun-2009 | format-xml: func [ xml /local out space prev ][ out: copy "" spacer: copy "" prev: copy </tag> foreach tag load/markup xml [ either tag = find tag "/" [ ; we have a close tag ; reduce the spacer by a tab unless the previous was an open tag either not tag? prev [ ; not a tag remove/part spacer 4 ][ ; is a tag if prev = find prev "/" [ ; last was a closing tag remove/part spacer 4 ] ] ][ either tag? tag [ ; current is tag ; indent only if the prev is not a closing tag if not prev = find prev "/" [ insert/dup spacer " " 4 ] ][ ; is data insert/dup spacer " " 4 ] ] repend out rejoin [ spacer tag newline ] prev: copy tag ] view layout compose [ area (out) 400x400 ] ] obj2xml: func [ obj [object!] out [string!] /local o ][ foreach element next first obj [ repend out [ to-tag element ] either object? o: get in obj element [ obj2xml o out ][ repend out any [ o copy "" ] ] repend out [ to-tag join "/" element ] ] ] | |
Graham: 24-Jun-2009 | Perhaps I'm not clear on this .... If I create a pharmacy object like this pharmacy: make object! [ name: none init: func [ n ][ self/name: n ] ] is the init function shared by all the subsequent pharmacy instances? | |
Graham: 24-Jun-2009 | so if I have pharmacy: make object! [ address: make addressobj [ ] ] and the address object has objects in it ... they will be shared?? | |
BrianH: 24-Jun-2009 | Every MAKE object! takes a spec block that is an init function, in effect. | |
Sunanda: 24-Jun-2009 | One way to do init is as open code in the object....That only "inits" the original object, not anything MAKEd from it. But it may be useful in some cirumstances, and it does not become part of the object: o: make object! compose [print "init" (a: 99) a: 1 b: 2] | |
Maxim: 24-Jun-2009 | so graham... instead of doing: ; note this is an object, context is a shortcut for make object! , like func is a shortcut for make function! addressobj: context [ number: 666 street: "styx lane" city: "pandemonium" ] pharmacy: context [ address: make addressobj [ ] ] you do: ; note this is a block addressobj: [ number: 666 street: "styx lane" city: "pandemonium" ] pharmacy: context [ address: context addressobj ] | |
Maxim: 24-Jun-2009 | >> probe load replace {#[object! [a: #[object! [b: #[object! [c: "%VALUE%"]]]]]]} "%VALUE%" "tadam!" make object! [ a: make object! [ b: make object! [ c: "tadam!" ] ] ] | |
Maxim: 24-Jun-2009 | ex: load mold/all make object! [ a: make object! [ b: make object! [ c: "tadam!" ] ] ] will effectively create a complete duplicate of the whole object tree. | |
Graham: 24-Jun-2009 | seems not :( >> pharmacy: make object! [ [ name: none [ init: func [ n ][ [ self/name: n [ ] [ ] >> a: load mold/all make pharmacy [] >> probe a make object! [ name: none init: func [n][ self/name: n ] ] >> a/init "testing" ** Script Error: self has no value ** Where: init ** Near: self/name: n | |
Sunanda: 24-Jun-2009 | Why not remove the self ? [not a metaphysical question in this context] ph: make object! [ name: none init: func [n][ name: n ] ] | |
Graham: 28-Jun-2009 | fix-object: func [ obj [object!] /local prev ][ foreach element next first obj [ if object? o: get in obj element [ ; is object, so check to see if has value? either "value?" = form next first o [ set in obj element trim/head/tail get in o 'value? ][ fix-object o ] ] ] ] this fixes up the object created by xml-to-object | |
Graham: 5-Jul-2009 | so, this is an attempt to remedy this fix-object: func [obj [object!] /local o value? ] [ foreach element next first obj [ if object? o: get in obj element [ ; is object, so check to see if has value? either value?: in o 'value? [ set in obj element trim/head/tail get value? ] [ fix-object o ] ] if block? o [ foreach ob o [ fix-object ob ] ] ] ] | |
Graham: 2-Aug-2009 | >> do %xml-parse.r Script: "A more XML 1.0 compliant set of XML parsing tools." (4-Dec-2001) >> do %xml-object.r Script: {Convert an XML-derived block structure into objects.} (29-Sep-2001) >> obj: first reduce xml-to-object parse-xml+ read %test.xml >> data: second obj == [make object! [ xts:sports-content-set: make object! [ sports-content: make object! [ sports... >> type? data == block! >> probe data/2/sports-content/sports-event/team/1/player/1 make object! [ player-metadata: make object! [ name: make object! [ value?: "" first: "Matt" last: "Kemp" ] position-event: "8" player-key: "l.mlb.com-p.11965" status: "starter" ] player-stats: make object! [ player-stats-baseball: make object! [ stats-baseball-offensive: make object! [ value?: "" runs-scored: "0" at-bats: "4" hits: "1" rbi: "2" bases-on-balls: "0" strikeouts: "0" singles: "1" doubles: "0" triples: "0" home-runs: "0" grand-slams: "0" sac-flies: "0" sacrifices: "0" grounded-into-double-play: "0" stolen-bases: "0" stolen-bases-caught: "1" hit-by-pitch: "0" average: ".271" ] stats-baseball-defensive: make object! [ value?: "" errors: "0" errors-passed-ball: "0" ] ] ] id: "b.11965" ] | |
Chris: 12-Aug-2009 | >> do http://www.ross-gill.com/r/altxml.r connecting to: www.ross-gill.com Script: "AltXML" (7-Jun-2009) >> all-stats: load-xml/dom your-xml-data >> player: stats/get-by-id "b.11965" >> his-stats: first player/get-by-tag <stats-baseball-offensive> >> his-stats/get #hits == "1" >> remove-each code codes: all-stats/get-by-tag <sports-content-code> ["league" <> code/get #code-type] == [make object! [ name: <sports-content-code> space: none value: [ #code-type "league" ... >> foreach code codes [probe code/get #code-name] Major ^/ League Baseball == "Major ^/ League Baseball" | |
Chris: 14-Aug-2009 | >> google-xml: load-xml/dom clipboard:// ; copied from page >> entries: google-xml/get-by-tag <entry> == [make object! [ name: <entry> space: none value: [ #etag {"BxAUSh5RAyp7ImBq"} <... >> foreach entry entries [probe entry/get <resourceId>] spreadsheet:key == "spreadsheet:key" | |
Oldes: 13-Oct-2010 | It depends what's your input and how should look the output, but you can use something like that: context [ xml: copy "" tabs: copy "" set 'to-xml func[node /init][ if init [ xml: copy "" tabs: copy "" ] switch/default type?/word node [ object! [ append tabs #"^-" foreach child next first node [ append xml rejoin [tabs "<" child ">^/"] to-xml node/(child) append xml rejoin [tabs "</" child ">^/"] ] remove tabs ] ][ append xml rejoin [ tabs "<" type? node ">" node "</" type? node ">^/" ] ] xml ] ] o: context [ person: context [ name: "bla" age: 1 ] ] print rejoin [ "<o>^/" to-xml o "</o>" ] | |
Group: Rebol School ... Rebol School [web-public] | ||
BrianH: 11-Apr-2006 | Currently, object! and function! types have contexts associated with them, and some natives (such as USE) create contexts internally as part of their operation. | |
Group: RT Q&A ... [RT Q&A] Questions and Answers to REBOL Technologies [web-public] | ||
Gabriele: 11-Dec-2005 | one solution is: >> f: rebcode [] [add.i x x] >> f': func [obj] [bind second :f obj f obj] >> probe f' context [x: 3] make object! [ x: 6 ] | |
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public] | ||
Louis: 12-Oct-2006 | For Text CGI script I get: #!/usr/bin/rebol --cgi REBOL [ Title: "show" File: %show.r ] print "Content-type: text/html^/" print {Back } print ["Script path :" system/script/path " ] print CGI Object :" print " foreach name next first system/options/cgi [ either :name = 'other-headers [ print [ name : ] foreach [n v] list: system/options/cgi/:name [ print [ n : " mold select list n ""] ] print " ][ print [ name : " mold system/options/cgi/:name ""] ] ] print " if system/options/cgi/request-method = POST" [ vars: make object! decode-cgi make string! input if not empty? next first vars [ print " Variables passed : foreach name next first vars [ print [ name : " mold vars/:name ""] ] print " ] ] print |
1 / 892 | [1] | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |