Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-28 Thread Jay Foad
On 23 June 2016 at 15:28, Xiao-Yong Jin wrote: > > > On Jun 23, 2016, at 7:07 AM, Louis Chretien wrote: > > > > R←{X} (A ⎕R B) Y > > The line on the title? It’s not really the language syntax. It’s their > way to tell you that ⎕R is an operator that receives required left and > right operands

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-23 Thread Xiao-Yong Jin
> On Jun 23, 2016, at 7:07 AM, Louis Chretien wrote: > > R←{X} (A ⎕R B) Y The line on the title? It’s not really the language syntax. It’s their way to tell you that ⎕R is an operator that receives required left and right operands A and B, and creates a ambivalent function that applies on r

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-23 Thread Elias Mårtenson
As strange as it may seem, the parenthesed expression returns an operator, which is then applied to the function on the left. GNU APL does not support first-class functions (and operators) so this syntax is not an option for us. Regards, Elias On 23 Jun 2016 8:08 pm, "Louis Chretien" wrote: > S

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-23 Thread Louis Chretien
Since Dyalog has created those ⎕R and ⎕S, it might be a good starting point. But i am always baffled by the syntax of using parenthesis to group on the function on the left and have it applied to the right argument, like Dialog shows on their webpage: R←{X} (A ⎕R B) Y > On Jun 22, 2016, at 14

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-22 Thread Juergen Sauermann
Hi, I believe regular expressions would be a useful and reasonable thing and I would not object to making it a ⎕-function. I can provide the framework for the ⎕-part of it (class definition, parser etc) if somebody wants to fill in the rest.

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Christian Robert
On 2016-06-21 23:30, Xiao-Yong Jin wrote: Here is the dyalog ⎕R (replace), you can find ⎕S too. It’s a nice interface, but not easy to remember everything. http://help.dyalog.com/14.1/Content/Language/System%20Functions/r.htm That's a *lot* more than what we need. I think. But a good ending

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Elias Mårtenson
Sure, that shouldn't be a problem at all. Regards, Elias On 22 June 2016 at 11:10, Christian Robert wrote: > Oh yes, would be nice. (pcre would be as nice as regex, may be more) > > make it a ⎕regex or ⎕pcre so, no need to load a specific .so file or )lib > to use it ;-) > > Ideal would be to b

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Xiao-Yong Jin
Here is the dyalog ⎕R (replace), you can find ⎕S too. It’s a nice interface, but not easy to remember everything. http://help.dyalog.com/14.1/Content/Language/System%20Functions/r.htm > On Jun 21, 2016, at 10:10 PM, Christian Robert > wrote: > > Oh yes, would be nice. (pcre would be as nice a

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Christian Robert
Oh yes, would be nice. (pcre would be as nice as regex, may be more) make it a ⎕regex or ⎕pcre so, no need to load a specific .so file or )lib to use it ;-) Ideal would be to be able to not only scan but be able to compile a pcre, find patterns, search & replace ... I am dreaming, but still a

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Elias Mårtenson
Would anyone be interested if I actually implemented support regex by calling into the C library? I'm envisioning something like this: * "^([a-z]+):([0-9]+)$" regex∆scan "foo:123"* ┏→━━┓ ┃"foo" "123"┃ ┗∊━━┛ Regards, Elias On 22 June 2016 at 10:35, Xiao-Yong Jin wrote: > A

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Xiao-Yong Jin
At some point I really wanted to implement the simplest editor, namely ed (it would be much better than any APL system has offered), in APL, but I never finished the regex part. Perhaps it would be a nice exercise for someone who’s interested in learning APL to actually implement some of the mo

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Christian Robert
Well, that was not exactly what I was seeking (condense), but, that "toronto toolkit" looks like a very interesting piece of code/functions ... deciphering/decoding/understanding each one should enlighten me on apl operators/data and usage. I will look at it. thanks, Xtian. On 2016-06-21 14

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Christian Robert
Hi, A more general purpose search&replace (some bug fixed), take (2), was "snr". )sic )erase replace ∇z←s replace p;fr;to;P;i;⎕io ⍝ - →(2≤≡s)/ForEach →(2≤⍴⍴s)/Matrix →Vector ⍝ - ForEach: z←{⍵ replace p}¨s ◊ →0 Matrix: z←⊃ {⍵ replace p}¨ ⊂[2]s ◊ →0 ⍝ --

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Christian Robert
I think I wrote it right ... "snr" == "Search'N Replace" )save 2016-06-21 15:11:40 (GMT-4) CONTINUE s Ceci est du texte s snr " " "." .Ceci...est..du.texte s snr " " " " Ceci est du texte s snr " " " " Ceci estdu texte

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Juergen Sauermann
Hi Xtian, how about this:   s←"444This4is4atest44with4lot4of4blanksat4beginning4and444end44"   from←"444"   to←"5"   ↑⍎')HOST echo "',s,'" | sed s/',from,'/',to,'/g' 5This4is4a54test44with544lot4of4blanks5

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Elias Mårtenson
I have been thinking of writing a native integration of regex which can be integrated in GNU APL. I haven't needed to yet though. Regards, Elias On 21 Jun 2016 22:24, "Louis Chretien" wrote: > Looks like a job for regexp… > > Too bad APL doesn’t have one. > > > > On Jun 20, 2016, at 23:12, Chri

Re: [Bug-apl] Not a bug, need help coding search&replace on a vector

2016-06-21 Thread Louis Chretien
Looks like a job for regexp… Too bad APL doesn’t have one. > On Jun 20, 2016, at 23:12, Christian Robert > wrote: > > Hi, it's not a bug but a request for help, > > > suppose > s="^^^This^is^atest^^with^lot^of^blanksat^beginning^and^^^end^^" > suppose from="^^^" > suppose t