AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 3 |
r3wp | 5 |
total: | 8 |
results window for this page: [start: 1 end: 8]
world-name: r4wp
Group: #Red ... Red language group [web-public] | ||
DocKimbel: 5-Aug-2012 | Red: I'm still working on both the compiler and the minimal runtime required to run simple Red programs. I have only the very basic datatypes working for now, no objects (so no ports) yet. I not yet at the point where I can give an accurate ETA for the first alpha, but I hope to be able to provide that ETA in a week. Red string! datatype will support Unicode (UTF-8 and UTF-16 encoding internally). I haven't implemented Unicode yet, so if some of you are willing to provide efficient code for supporting Unicode, that would greatly speedup Red progress. The following functions would be needed (coded in Red/System): - UTF-8 <=> UTF-16 LE conversion routines - (by order of importance) length?, compare (two strings), compare-case, pick, poke, at, find, find-case - optinally: uppercase, lowercase, sort All the above functions should be coded both for UTF-8 and UTF-16 LE. | |
Group: Announce ... Announcements only - use Ann-reply to chat [web-public] | ||
MaxV: 25-Oct-2012 | Rebol [Purpose: {make wikibook entry} Author: "Max Vessi" version: 1.0.0 ] my?: func [ "Prints information about words and values." 'word [any-type!] /local value args item type-name refmode types attrs rtype temp ][ temp: copy "" if all [word? :word not value? :word] [word: mold :word] if any [string? :word all [word? :word datatype? get :word]] [ types: dump-obj/match system/words :word sort types if not empty? types [ print ["Found these words:" newline types] exit ] print ["No information on" word "(word has no value)"] exit ] type-name: func [value] [ value: mold type? :value clear back tail value join either find "aeiou" first value ["an "] ["a "] value ] if not any [word? :word path? :word] [ append temp reduce [mold :word "is" type-name :word] exit ] value: either path? :word [first reduce reduce [word]] [get :word] if not any-function? :value [ append temp reduce [uppercase mold word "is" type-name :value "of value: "] append temp either object? value [ reduce ["^/" dump-obj value] ] [mold :value] exit ] args: third :value append temp "= USAGE: = ^/ " if not op? :value [append temp reduce [ uppercase mold word " "] ] while [not tail? args] [ item: first args if :item = /local [break] if any [all [any-word? :item not set-word? :item] refinement? :item] [ append temp reduce [append mold :item " "] if op? :value [append temp reduce [append uppercase mold word " "] value: none] ] args: next args ] append temp "^/" args: head args value: get word append temp "^/= DESCRIPTION: = ^/" either string? pick args 1 [ append temp reduce [first args] args: next args ] [ append temp "^/''(undocumented)''^/" ] append temp reduce [ "^/^/"uppercase mold word " is " type-name :value " value."] if block? pick args 1 [ attrs: first args args: next args ] if tail? args [exit] while [not tail? args] [ item: first args args: next args if :item = /local [break] either not refinement? :item [ all [set-word? :item :item = to-set-word 'return block? first args rtype: first args] if none? refmode [ append temp "^/= ARGUMENTS: =^/" refmode: 'args ] ] [ if refmode <> 'refs [ append temp "^/= REFINEMENTS: =^/" refmode: 'refs ] ] either refinement? :item [ append temp reduce ["*'''" mold item "'''"] if string? pick args 1 [append temp reduce [" -- " first args] args: next args] append temp "^/" ] [ if all [any-word? :item not set-word? :item] [ if refmode = 'refs [append temp "*"] append temp reduce ["*'''" :item "''' -- "] types: if block? pick args 1 [args: next args first back args] if string? pick args 1 [append temp reduce [first args ""] args: next args] if not types [types: 'any] append temp rejoin [" (Type: " types ")"] append temp "^/" ] ] ] if rtype [append temp reduce ["^/RETURNS:^/^-" rtype]] if attrs [ append temp "^/= (SPECIAL ATTRIBUTES) =^/" while [not tail? attrs] [ value: first attrs attrs: next attrs if any-word? value [ append temp reduce ["*'''" value "'''"] if string? pick attrs 1 [ append temp reduce [" -- " first attrs] attrs: next attrs ] append temp "^/" ] ] ] editor temp exit ] | |
Group: Ann-Reply ... Reply to Announce group [web-public] | ||
MaxV: 25-Oct-2012 | Rebol [Purpose: {make wikibook entry} Author: "Max Vessi" version: 2.0.0 ] my?: func [ "Prints information about words and values." 'word [any-type!] /local value args item type-name refmode types attrs rtype temp ][ temp: copy "" if all [word? :word not value? :word] [word: mold :word] if any [string? :word all [word? :word datatype? get :word]] [ types: dump-obj/match system/words :word sort types if not empty? types [ print ["Found these words:" newline types] exit ] print ["No information on" word "(word has no value)"] exit ] type-name: func [value] [ value: mold type? :value clear back tail value join either find "aeiou" first value ["an "] ["a "] value ] if not any [word? :word path? :word] [ append temp reduce [mold :word "is" type-name :word] exit ] value: either path? :word [first reduce reduce [word]] [get :word] if not any-function? :value [ append temp reduce [uppercase mold word "is" type-name :value "of value: "] append temp either object? value [ reduce ["^/" dump-obj value] ] [mold :value] exit ] args: third :value append temp "= USAGE: = ^/ " if not op? :value [append temp reduce [ uppercase mold word " "] ] while [not tail? args] [ item: first args if :item = /local [break] if any [all [any-word? :item not set-word? :item] refinement? :item] [ append temp reduce [append mold :item " "] if op? :value [append temp reduce [append uppercase mold word " "] value: none] ] args: next args ] append temp "^/" args: head args value: get word append temp "^/= DESCRIPTION: = ^/" either string? pick args 1 [ append temp reduce [first args] args: next args ] [ append temp "^/''(undocumented)''^/" ] append temp reduce [ "^/^/"uppercase mold word " is " type-name :value " value."] if block? pick args 1 [ attrs: first args args: next args ] if tail? args [exit] while [not tail? args] [ item: first args args: next args if :item = /local [break] either not refinement? :item [ all [set-word? :item :item = to-set-word 'return block? first args rtype: first args] if none? refmode [ append temp "^/= ARGUMENTS: =^/" refmode: 'args ] ] [ if refmode <> 'refs [ append temp "^/= REFINEMENTS: =^/" refmode: 'refs ] ] either refinement? :item [ append temp reduce ["*'''" mold item "'''"] if string? pick args 1 [append temp reduce [" -- " first args] args: next args] append temp "^/" ] [ if all [any-word? :item not set-word? :item] [ if refmode = 'refs [append temp "*"] append temp reduce ["*'''" :item "''' -- "] types: if block? pick args 1 [args: next args first back args] if string? pick args 1 [append temp reduce [first args ""] args: next args] if not types [types: 'any] append temp rejoin [" (Type: " types ")"] append temp "^/" ] ] ] if rtype [append temp reduce ["^/RETURNS:^/^-" rtype]] if attrs [ append temp "^/= (SPECIAL ATTRIBUTES) =^/" while [not tail? attrs] [ value: first attrs attrs: next attrs if any-word? value [ append temp reduce ["*'''" value "'''"] if string? pick attrs 1 [ append temp reduce [" -- " first attrs] attrs: next attrs ] append temp "^/" ] ] ] append temp "^/= Source code =^/" append temp reduce ["<pre>" join word ": "] if not value? word [print "''undefined''" exit] either any [native? get word op? get word action? get word] [ append temp reduce ["native" mold third get word] ] [append temp reduce [ mold get word "</pre>"] ] editor temp ;write clipboard:// temp exit ] |
world-name: r3wp
Group: Core ... Discuss core issues [web-public] | ||
JaimeVargas: 7-Apr-2005 | I hope this is useful for someone REBOL [] rest: func [s [series!]][skip s 1] define-object: func [ spec [block!] /local arg-spec ctx-spec object-name constructor-name predicate-name attributes spec-rule type-spec continue? w ][ arg-names: copy [] continue?: [none] ;used to stop parsing name-rule: [set w word! (insert tail arg-names w)] type-rule: [set w word! (unless datatype? attempt [get w] [continue?: [end skip]])] spec-rule: [name-rule some [name-rule opt [into [some [type-rule continue?]]]]] if any [ not parse spec spec-rule arg-names <> unique arg-names ][ make error! "invalid spec" ] object-name: to-string first arg-names constructor-name: to-word join 'make- object-name predicate-name: to-word join first arg-names '? attributes: rest arg-names arg-spec: copy [] foreach itm attributes [ insert tail arg-spec reduce [ to-word join itm '-value either block? w: select spec itm [w][[any-type!]] ] ] ctx-spec: copy [] arg-names: extract arg-spec 2 1 repeat i length? attributes [ insert tail ctx-spec reduce [to-set-word attributes/:i to-get-word arg-names/:i] ] ;create constructor function set constructor-name make function! compose [(reform ["Makes a new" uppercase object-name "object with attributes" mold attributes]) (arg-spec)] compose/only [make object! (ctx-spec)] ;body ;create predicate function set predicate-name make function! compose [(reform ["Determines if value is a" uppercase object-name "object"]) value [object!] /local types] compose/deep/only [ either (attributes) = rest first value [ foreach itm (attributes) [ unless any [ [any-type!] = types: select (arg-spec) to-word join itm '-value find types type?/word value/:itm ][return false] ] true ][ false ] ] ] | |
Janko: 21-Jan-2010 | I will give another example where I claim doing a dialect for it all is useless option. So you have a rebol server that holds a big block of users in ram you send it 2 functions a filter >> function [ U ] [ all [ greater? U/age 20 lesser U/age 30 equal? U/gender 'female ] << and a mapping function >> function [ U ] [ uppercase rejoin [ U/name " " U/surname ] ] << server will accept the code and collect items where first returns true then process them vith mapping function join them with reducing >> function [ U ACC ] [ rejoin [ ACC ", " U ]<< function and return the result. | |
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
Janko: 8-Jan-2009 | I have another question about parse, if I may.. I am trying to make a parse block that will uppercase all letters after the . ! or ? . I did it just for dots, but I can't make it for all 3 ( one alternative is to call parse 3 times each time with different separator char. The problem can be observed here, and happens because [ A | B | C ] pattern first looks for A and if it doesn't find a checks B , which means it will skip B if A is after B. Is there any way to say "use any of those chars - *whichever comes first" ? .. example where you can see the problem: | |
Group: Parse ... Discussion of PARSE dialect [web-public] | ||
JaimeVargas: 27-Jun-2006 | I think I missunderstood the problem. I thought the the emphasis was not for words all in uppercase. Just ther first char. | |
Group: SQLite ... C library embeddable DB [web-public]. | ||
Ashley: 13-Feb-2006 | sqlite3-protocol.r has a minor bug whereby locals/cols are not cleared. Fix is to add a "clear cols" at the beginning of the ' sqlite-exec func. Two other changes I made to this function were: 1) Changing “SQLITE_TEXT [any [attempt [load val: sqlite3/column_text stmt j] val]]” so as REBOL values are returned, and 2) Removing the /only clause from "system/words/insert/only tail result col" for those that prefer flat data structures (i.e. non-blocked records) Finally, a simple wrapper makes the whole thing more usable: context [ db: none set 'open-db func [name [file!]] [ db: open join sqlite://localhost/ name ] set 'close-db does [ close db ] set 'describe func ['table [word!]] [ insert db rejoin ["select type, name, sql from sqlite_master where upper(tbl_name) = '" uppercase form table "' order by rootpage"] db/locals/sqlresult ] set 'sql function [arg [string! block!]] [statement] [ case [ string? arg [insert db arg] string? first arg [ statement: copy first arg repeat i -1 + length? arg [ replace/all statement join ":" i pick arg i + 1 ] insert db statement ] ] db/locals/sqlresult ] ] which lets you do stuff like: >> open-db %test.db >> sql "create table t1 (col1 INTEGER, col2 TEXT)" == [] >> describe t1 == [table t1 "CREATE TABLE t1 (col1 INTEGER, col2 TEXT)"] >> sql reduce ["insert into t1 values (1,':1')" now/date] == [] >> sql "select * from t1" == [1 13-Feb-2006] >> close-db |