I've CC'ed the gnu-apl list with my answer to Christian's question, since I
think this is an interesting discussion. For the newcomers, this is about
the solution to this Codejam question:
https://code.google.com/codejam/contest/6254486/dashboard#s=p1
It's quite simple actually. The idea is simply
No, I really mean ⎕FIO['fopen'] as native function.
Xtian.
On 2016-06-21 23:40, Elias Mårtenson wrote:
This already exists. Just load FILE_IO from workspace 5 and you can use things
like FIO∆fread
Regards,
Elias
On 22 June 2016 at 11:36, Christian Robert mailto:christian.rob...@polymtl.ca>>
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
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
This already exists. Just load FILE_IO from workspace 5 and you can use
things like FIO∆fread
Regards,
Elias
On 22 June 2016 at 11:36, Christian Robert
wrote:
> Jürgen,
>
> While we are at it,
>
> Can ⎕FIO[something_integer] can be made to understand also things like:
>
> ⎕FIO['fopen']
> ⎕FIO['
Jürgen,
While we are at it,
Can ⎕FIO[something_integer] can be made to understand also things like:
⎕FIO['fopen']
⎕FIO['fclose']
⎕FIO['popen']
⎕FIO['read']
and so on ? Would simplify coding time a LOT and help readability !
my 2 cents,
Xtian.
On 2016-06-21 22:39, Elias Mårtenson wrote:
W
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
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
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
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
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
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
⍝ --
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
An alternative (from hans-peter sorge from this list, april 13, 2016).
Careful though, this does have some edge conditions which will bite:
⍝replace with ( is 2 elements) in string
⍝.k text-editing
⍝.n hans-peter sorge
⍝.t 2016.4.13.0.0.0
⍝.v 1.0 / 13apr16
r←((0=⍴z)/a),z←∊((e×⍴v)↑¨⊂v),¨((⍴
Christian Robert
For this, try the "toronto toolkit" in our bits&pieces.
There is a function "condense"
' ' condense ' a b c d '
a b c d
Which is what you want (I think). Uses ∆db (delete blanks). Preferable
to get from the toolkit -- functions reproduced below.
∇y←d condense v;b
⍝remove
Hi Xtian,
how about this:
s←"444This4is4atest44with4lot4of4blanksat4beginning4and444end44"
from←"444"
to←"5"
↑⍎')HOST echo "',s,'" | sed s/',from,'/',to,'/g'
5This4is4a54test44with544lot4of4blanks5
Hi
coming back to an earlier discussion, I have added ⎕EB
("Execute Both") to GNU APL.
A ⎕EB B
is similiar to A
⎕EA B in that it first executes B. However,
unlike
⎕EA which
executes A only when B fails, ⎕EB always
executes A regardless
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
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
19 matches
Mail list logo