World: r4wp
[Rebol School] REBOL School
older newer | first last |
Arnold 22-Jun-2012 [430x2] | And knowing even this small community has less members then the diacrits they are using in everyday living it is a requirement to deal with UTF-8 UCS or other encodings. |
Why isn't there to-dir when there is to-file? Would adding to-dir: :dirize do the trick of making a to-dir function? Why isn't it implemented as a standard? | |
BrianH 22-Jun-2012 [432x2] | Because all of the to-somedatatypeword functions are specifically only for datatype conversion, and we don't have a dir! or directory! type. |
It doesn't really matter though; these aren't keywords. If you want to-dir: :dirize in your own code, put it in. Or put it in your rebol.r file. | |
Evgeniy Philippov 22-Jun-2012 [434] | I've decided to start hacking about a GPL REBOL written in Squeak Smalltalk. The goal is to start crafting a REBOL's copy maximally close to the original REBOL2. Another goal is to study REBOL2 :) |
GrahamC 22-Jun-2012 [435x2] | You're kidding! |
We're going to have more forks than users | |
Evgeniy Philippov 22-Jun-2012 [437x2] | Children's adventures :) |
Who is writing another strict rebol copy? I could join in | |
PeterWood 22-Jun-2012 [439] | Brian (Hostile Fork) was interested in developing a strict REBOL clone though his proposal was to use a "modern" cross platform approach such as QT/C++ 11. |
Evgeniy Philippov 22-Jun-2012 [440x3] | That is an OK approach. I could join Brian if he is working on that. |
Brian, are you here? | |
What are your status re: strict rebol clone and plans about it? | |
GrahamC 22-Jun-2012 [443] | Brian left after a disagreement ... |
Evgeniy Philippov 22-Jun-2012 [444] | I currently read his blog. I am also liker of Robert Piersig's books, and that's fantastic about Brian... |
PeterWood 22-Jun-2012 [445] | Evegeniy: I will contact Brian and give him your email address. |
Evgeniy Philippov 22-Jun-2012 [446x2] | Peter, that would be good. If I will have his e-mail I will probably write him. |
That's a very good Brian's comment: "REBOL's rejection of the multi-markup madness is a very good thing." (Here: http://hostilefork.com/2008/09/08/is-rebol-actually-a-revolution/ ) | |
PeterWood 22-Jun-2012 [448] | I've emailed Brian your emal address. |
Evgeniy Philippov 22-Jun-2012 [449] | His blog is highly interesting read.... |
Arnold 23-Jun-2012 [450x3] | I have a problem renaming files. rename does not change the filename on MacOSx. In the terminal it is no problem but in my script the filenames are not changed. fileo: to-file rejoin [what-dir add-suffix naam-oud-z-ext extensie] filen: to-file add-suffix naam-oud-z-ext extensie rename fileo filen I have tested with probe that the types are ok and with the resulting values for fileo and filen the rename command worked like a charm. Any more ideas what is happening and how to debug this further? Thanks. |
A found it! typo! I should have used the new name ;-) naam-new-z-ext | |
Would have searched for hours if I hadn't posted this :-D | |
BrianH 23-Jun-2012 [453x2] | Petr, if you need a quick command line codepage converter program, try txtcnv32 here: http://www.ltr-data.se/files/txtcnv32.zip It lets you specify code pages by number. The documentation of the code page numbers is here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx |
It's just a 3KB wrapper around the Windows code page conversion functions. There's source too. | |
Gregg 23-Jun-2012 [455] | Arnold, for the dir issue: >> ?? dirize dirize: func [ {Returns a copy of the path turned into a directory.} path [file! string! url!] ][ either #"/" <> pick path length? path [join path #"/"] [copy path] ] >> ?? undirize undirize: func [ {Returns a copy of the path with any trailing "/" removed.} path [file! string! url!] ][ path: copy path if #"/" = pick path length? path [clear back tail path] path ] |
Arnold 23-Jun-2012 [456x2] | In the original script I use a change-dir to get into the right directory. Then renaming is just the rename filename newname. I stuffed the renaming into a function and changed the variable names. Everywhere but in this place where I wanted to rename the file for real and I forgot to change old to new.... so here I tried debugging it while using the complete path and filename, because I was afraid there could be an issue there. |
The positive side of things is I am starting to make real errors in stead of messing about with the functions in REBOL. | |
Arnold 26-Jun-2012 [458] | Is there any other way to make an iterated label or text item in VID then the way stated in http://www.rebolforces.com/zine/rzine-1-03/#sect5. or http://www.rebol.com/docs/view-face-other.htmlbecause this seems to me to be too complicated for REBOL. At least for me. |
Henrik 26-Jun-2012 [459] | it depends on what you want to do. LIST is not very flexible. |
Arnold 26-Jun-2012 [460] | Well I found a more promising way here http://www.codeconscious.com/rebol/view-notes.html What I want to do is have a number of text/labels that I want to show a short text from a block of values. So I prefer to do it in a loop like loop 8 [mylabel/index/text: myblock/index] |
Henrik 26-Jun-2012 [461x2] | If the number of texts doesn't vary, it might be simpler to make the fields manually instead of using an iterated face. The reason for this is that you need to write the SUPPLY code yourself, which will run every time you run the code and will run on every mouse move, if your text has a FEEL object with ENGAGE, OVER or DETECT functions, whereas simply making 8 texts once with VID is both faster and requires less code. |
iterated faces are best for large arrays of faces. | |
Arnold 26-Jun-2012 [463] | I'll stick to the keep it simple strategy then, only 32 labels in my little app. I am recreating my Java mirror-game applet using REBOL Thank you very much Henrik! |
Henrik 26-Jun-2012 [464] | NP. I don't usually mess around with iterated faces unless I really need to, so I have some standard styles for lists that abstracts this stuff away. |
Endo 27-Jun-2012 [465x2] | Anyone has a good idea to count number of values in a block? Ofcourse it is not difficult to write, but I want to ee some clever ideas :) >> b: ["a" k 99 k k 99 55 "a" 1] >> count-values b == ["a" 2 k 3 99 2 55 1] ;value-count |
* ee = see | |
Sunanda 27-Jun-2012 [467] | I'm a regular user of Joel's 'tally function: http://www.rebol.org/ml-display-message.r?m=rmlKDDS |
MaxV 27-Jun-2012 [468] | WOW! |
Endo 27-Jun-2012 [469x2] | I wrote another function which returns in the above format, so I can SELECT/SKIP 2, to get the number of occurence of the value, and it doesn't use SORT, uses REMOVE-EACH instead. it: >> f: func [b /local c r n1 n2] [r: copy [] foreach v unique b [c: copy b n1: length? c remove-each w c [v = w] n2: length? c append r reduce [v n1 - n2]] r] >> a: [a b c c a a b b c d d e e e f f h f f g h] >> f a == [a 3 b 3 c 3 d 2 e 3 f 4 h 2 g 1] |
Oh small mistake, no need to COPY each time: this is much better: f: func [b /local c r n1 n2] [r: copy [] foreach v unique b: copy b [n1: length? b remove-each w b [v = w] n2: length? b append r reduce [v n1 - n2] ] r ] | |
Maxim 27-Jun-2012 [471] | that is a massively interesting mail from Joel Neely. He is one of the old-time rebolers I miss most. He has a very good sense of how to explain his points. |
Endo 27-Jun-2012 [472] | Interesting, my tally function and Joel's, work almost in same speed, 53 sec. for 1 million execution for both. |
Maxim 27-Jun-2012 [473] | just found a very handy idiom ( not new, just rarely discussed and possibly missed by many ): help function! this lists all known functions in the global scope (same for help native! help action!) obviously you can do this for all datatypes, so its very handy to get the names of stuff you often forget, like the internal color names (help tuple! ) |
Ladislav 27-Jun-2012 [474x4] | Interesting, my tally function and Joel's, work almost in same speed, 53 sec. for 1 million execution for both. - I guess that the version using SORT should be much faster. |
As far as I remember, it should be available from the ML as well. | |
Aha, I checked and Joel's code actually *is* using SORT, which means it is O(n * log n) algorithm. While, at the same time, the above REMOVE-EACH is O(n * n), which is *much* slower as far as I am concerned. | |
Sorry, I meant that the above REMOVE-EACH based algorithm can be roughly O(n * n) | |
Steeve 27-Jun-2012 [478x2] | (Search for fast-tally in Altme groups) using the unique trick: fast-tally: func [b [block!] /local u i] [ b: sort b u: unique b i: 1 until [ b: any [find b u/2 tail b] u/1: as-pair u/1 negate i - i: index? b tail? u: next u ] head u ] And also, the radix algo is pretty good (if the max value is not too large) radix: func [b [block!] /local u maxv] [ maxv: 0 foreach v b [maxv: max maxv v] u: head insert/dup make block! maxv 0 maxv foreach v b [ u/:v: u/:v + 1 ] u ] |
in R2, use maximum-of instead of: >> foreach v b [maxv: max maxv v] | |
older newer | first last |