[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-apl] A better way to insert characters into a character vector?
From: |
Jay Foad |
Subject: |
Re: [Bug-apl] A better way to insert characters into a character vector? |
Date: |
Fri, 28 Aug 2015 10:56:17 +0100 |
You can use ∊ (Enlist) instead of ⊃,/.
Here's another way from "the good old days, before all this nested
array malarkey" (from Morten Kromberg):
a←'alex'
rep←1+2×m←a='e'
r←rep/a ⋄ m←rep/m
(m/r)←'www'
r
alwwwx
Jay.
On 28 August 2015 at 03:17, <address@hidden> wrote:
> Hi Bug APL,
>
> I find that I frequently will do this:
> a←'alex'
> a[3]←⊂'www'
> Which results in this:
> a
> ┌→─────────┐
> │al ┌→──┐ x│
> │ │www│ │
> │ └───┘ │
> └∊─────────┘
>
> And then I will do this, because I want a character vector:
>
> a←⊃,/a
> a
> alwwwx
>
>
> So I guess more simply put. Is there a way to get from "alex" to "alwwwx"
> without the intermediary nested thing? Am I approaching this problem with
> the wrong functions?
>
> -Alex
>
>
>