[Jprogramming] Binding x and y to an adverb (]})

Lorenz Köhl rainbowtwigs at gmail.com
Mon Oct 29 17:57:04 UTC 2018


Hi,

I need a verb to turn a list of numbers between zero and nine
into a table where each item is 10$0 except at the place indexed
by the input numbers, for example:

   v 0 1 2

1 0 0 0 0 0 0 0 0 0

0 1 0 0 0 0 0 0 0 0

0 0 1 0 0 0 0 0 0 0

My approach using ammend leaves me puzzled:


v=:1&(]})&(10$0)

v 1 2 3

1 0 0 0 0 0 0 0 0 0

1 1 0 0 0 0 0 0 0 0

1 1 0 0 0 0 0 0 0 0


Here I have to bind two nouns (1 as x and 10$0 as y) to the verb

(]}) but maybe that doesn't do what I think it does? The rank of v

doesn't seem to matter, it gives the same output, but I know I want

it to use 0-cells of the input list.


I'd be happy to see what the idiomatic way to do this is, and maybe

how to fix my approach.


greetings,

Lorenz


More information about the Programming mailing list