Hello,
I’m having difficulty flipping dictionaries that have strings. I always get a length error. Here is a simple example.
q)(!) . (
address
versionhex;(
1ASD7SJDK;2;(5;2;1;2;4;1;1)))
address| `1ASD7SJDK
version| 2
hex | 5 2 1 2 4 1 1
When I flip this dictionary with unequal length, the columns address
and version
automatically conform. I like this!
q)flip (!) . (
address
versionhex;(
1ASD7SJDK;2;(5;2;1;2;4;1;1)))
address version hex1ASD7SJDK 2 5
1ASD7SJDK 2 2
1ASD7SJDK 2 1
1ASD7SJDK 2 2
1ASD7SJDK 2 4
1ASD7SJDK 2 1
1ASD7SJDK 2 1
With the dictionary below I get a length error.
q)((!) . enlist@'(`imAQbie;“Helpmeplz”)),select txid,version:“i”$version from p
imAQbie | “Helpmeplz”
txid | “3dfcdffbc53f04f9f7139942e786c1ec26694ac973822e4e919f71580c48e3a6”
version| 1i
Here is another example (the one I’m actually working on). Take a look at this dictionary.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff; background-color: #2b66c9}span.s1 {font-variant-ligatures: no-common-ligatures}q)(flip (first l[`vout])),exec txid,version:“i”$version,size:“j”$size,vsize:“j”$vsize,locktime:“j”$locktime from l
value | 7.664098 0.005165 0.00073 0.017 0.002205 0.000281 0.006913 0.079418 0.000905 0.001047 0.000817 0.0013 0.003996 6e-05 0.00021 0.002034
n | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15f
scriptPubKey| (asm
hexreqSigs
typeaddresses!("OP_DUP OP_HASH160 fd8017c2ac5f56b554312cab973089596eddf93c OP_EQUALVERIFY OP_CHECKSIG";"76a914fd8017c2ac5f56b554312cab973089596eddf93c88ac";1f;"pubkeyhash";,"1Q7PQaWurNiBuzdjxwR7njkhtWB9e92wqW");
asmhex
reqSigstype
addresses!(“OP_DUP OP_HASH160 3b67fd818d1f830113d2bda1b9903be93ef8efc3 OP_EQUALVERIFY OP_CHECKSIG”;“76a9143b67fd818d1f830113d2bda1b9903be93ef8efc388ac”;1f;“pubkeyhash”;,“16R7SgtjfewCHfhEFniTpux6uU286Cuuo5”);asm
hexreqSigs
typeaddresses!("OP_HASH160 d61fec2da4cdfbf582ab8351d481e89e338bb416 OP_EQUAL";"a914d61fec2da4cdfbf582ab8351d481e89e338bb41687";1f;"scripthash";,"3MDCmcbpB22PMovjTKkArze9UgeqVxr4Dm");
asmhex
reqSigstype
addresses!(“OP_DUP OP_HASH160 46d9b0aa75e69902dbebc9fd762a8547d5dcd489 OP_EQUALVERIFY OP_CHECKSIG”;"76..
txid | ,“ff62724b96b8424670e178283f63d80cebc7ccdc1922cf19e2ea2548268df8ff”
version | ,1i
size | ,696
vsize | ,696
locktime | ,0
Here is a count.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #ffffff; background-color: #2b66c9}span.s1 {font-variant-ligatures: no-common-ligatures}value | 16
n | 16
scriptPubKey| 16
txid | 1
version | 1
size | 1
vsize | 1
locktime | 1
When I flip it I want Locktime, txid, version, ize, and vsize to be duplicated 16 times so that I don’t get a length error. I also don’t know why they’ve enlisted themselves (see highlighted yellow above).
Sorry for this long question, and thanks for your help.
Bonus points if you realised I have a dictionary in a dictionary (scriptPubKey) and if you have an elegant way to resolve this.
Cheers