World: r3wp
[Core] Discuss core issues
older newer | first last |
Robert 13-May-2009 [13713] | sorry, I mean this: >> to-tag rejoin [{a href="test">} "Test" "</a"] == <a href="test">Test</a> |
Henrik 13-May-2009 [13714] | Robert, what about BUILD-TAG? |
Robert 13-May-2009 [13715x2] | ;) He, he... to may functions to remember. Yep I think this works too and looks better. |
Money: And way to get rid of the $ sign? I need Û at the end. | |
Sunanda 13-May-2009 [13717] | second $3.4 == 3.4 |
Robert 13-May-2009 [13718x2] | Without REMOVE etc. |
Ah, cool. Didn't know this. Always something new after so many years... | |
Sunanda 13-May-2009 [13720] | Just tried it with R3-alpha ..... It does not work. I'll report it in Curecode. |
Robert 13-May-2009 [13721] | Good, at least it helped to catch a bug. |
Sunanda 13-May-2009 [13722] | :-) to-decimal $3.4 works in R3 but not R2.....So it may be a change of behavior, not a bug. Look out for reponse to curecode #807 |
Robert 13-May-2009 [13723] | But does it give the trailing 0 in R3? |
Sunanda 13-May-2009 [13724] | Does not look like it: >> to-decimal $3.4 == 3.4 |
Sunanda 14-May-2009 [13725] | Looks like to-decimal will be the R3 way: http://curecode.org/rebol3/ticket.rsp?id=807 |
amacleod 14-May-2009 [13726] | How can I track the number of times a word/phrase occurs in a string! I tried this: if find str "a phrase" [print "found phrase"] but it seems to only find the first occurance. |
Steeve 14-May-2009 [13727] | is that a joke ? |
Graham 14-May-2009 [13728x4] | use parse |
There are examples on Rebol.com on how to use parse to count occurences ot tags etc. | |
of course it would be nice to have something like find/all which returns a block of all the occurences | |
Steeve... this is not the humour group! | |
Steeve 14-May-2009 [13732] | hmm... i: 0 while [str: find/tail str "a phrase"][i: i + 1] |
Henrik 14-May-2009 [13733] | parse str [any [thru "a phrase" (print "found phrase")]] |
Steeve 14-May-2009 [13734] | but it would be more relevant to post such request in "i'm new" |
amacleod 14-May-2009 [13735] | I'm using to highlight parts of strings in a face during a text search. so I need to find caret offsets for each and append to the face/effect/draw block |
Graham 14-May-2009 [13736] | findall: func [ st occurrence /local result ][ result: copy [] while [ st: find st occurrence ][ append result st st: next st] result ] >> findall "testing" "t" == ["testing" "ting"] |
Henrik 14-May-2009 [13737] | in that case, would you want the indexes? |
Maxim 14-May-2009 [13738] | graham's solution does exactly that |
Henrik 14-May-2009 [13739] | something like that has also been proposed for R3. |
Graham 14-May-2009 [13740] | findall: func [ st occurrence /local result ][ result: copy [] while [ st: find st occurrence ][ append result index? st st: next st] result ] >> findall "testing" "t" == [1 4] |
Henrik 14-May-2009 [13741] | would it be too clever to return the block at the positions instead of the index? |
Graham 14-May-2009 [13742] | he just needs the offsets |
Steeve 14-May-2009 [13743x4] | a reference or an offset is the same thing to my mind |
whereas a reference fullfills more use cases | |
but can't be molded | |
and loaded back | |
amacleod 14-May-2009 [13747x2] | Thanks Graham, I had something almost like that func but not quite... |
This is an example of the code I used but it only hi-lites first occurance: if find face/text butt [ hs: caret-to-offset face find face/text butt he: caret-to-offset face find/tail face/text butt fsize: face/size/x draw_contents: copy face/effect/draw get_xys ;(Find the shape of the drawn hi-lite) append face/effect/draw compose/deep [(shape)] ] | |
Graham 14-May-2009 [13749] | If you know the length of text "butt" you don't need to find the end .. just calculate it, as it should be faster. |
Anton 14-May-2009 [13750] | amacleod, I wrote some efficient string search functions. The file has simple, first implementations alongside some efficient implementations which use PARSE. http://anton.wildit.net.au/rebol/library/demo-string-search-functions.r |
amacleod 14-May-2009 [13751x2] | I'll check it out. thanks, Anton. |
I got it working... Sort of inserted my hi-lite mapping code into Graham's function... Thanks again, Graham! | |
amacleod 15-May-2009 [13753] | It allowed me to step through the face one find after another. Exactly what I wanted to do. |
Maxim 17-May-2009 [13754x2] | I'm having a problem with call. when I use the /output/error and supply strings , I get a strange error in the stdout holding string: Unable to read from standard input: The handle is invalid. the really strange one is that if I use /console, the expeted out is effectively printed out to the rebol console.... so the cmd does return data and rebol is able to handle it, but not within the /output/ refinement! also, another call, using another command, works as expected... so I don't think I have a error in my code. not that I have tried using /shell and it didn't help has anyone seen /output and /console react this way? |
not=note | |
Gabriele 17-May-2009 [13756] | maybe you also need to provide /input ? (it's hard to guess what the problem is) |
Graham 17-May-2009 [13757] | oddly this group was private but everyone was in it .. made it public. |
Maxim 17-May-2009 [13758x3] | I will try with/input. providing a few "^/" but It definitely doesn't need input on the command-line. |
but sometimes with progamming... logic doesn't prevail, hehehe | |
gabriele, the /input works !!! damn why didn't I think of that.. I lost several hours trying to find other command-line ssh tools which would work... none really do... the putty tools really are the best ones out there. | |
TomBon 18-May-2009 [13761] | what is the fastest way to count the occurence of each numbers within a block containing 5000+ numbers? e.g [1 3 6 2 4 9 33 6 67 2 12 23 34 12 2 4 56 2 ...] calculating the max and min with a simple loop and counter is very time consuming for thousends of these blocks. inserting into mysql and doing a 'group by' also. any ideas for a faster solution? |
Henrik 18-May-2009 [13762] | what if you sort the block first? |
older newer | first last |