« first day (2158 days earlier)      last day (507 days later) » 

1:00 PM
Welcome to APL Quest 2017-7! Today's quest is Counting DNA Nucleotides:
> Write a function that takes a character vector representing a DNA string and returns 4 integers of the number of occurrences for each of the symbols ‘A’, ‘C’, ‘G’, and ‘T’ respectively.
Wouldn't it be nice if Key had been a dyadic operator, taking as additional operand the "vocabulary"? ≢⍤⊢⌸'ACGT' would have done the trick.
With the current definition of Key, we'd have to amend the data: {¯1+⊢⍤≢⌸'ACGT',⍵}
Hm, now I wonder if Key could be overloaded to take an array operand which is the vocabulary, and then it'd return the groups, with the function defaulting to . Then the solution would be (≢⍤¯1)'ACGT'⌸
No, wait, it should be ⊂⍤⊢ instead of and our solution would be ≢¨'ACGT⌸
Anyway, this is easy enough without Key: {'ACGT'∘.=⍵} gives us the four masks, and {+/'ACGT'∘.=⍵} gives us the counts.
See you next week for 2017-8: Be the First 1!
 
1:47 PM
Sorry, forgot the time ... :(
But had exactly your solution
Pretty and easy...
 
 
5 hours later…
7:04 PM
0
Q: Porting APL*PLUS PC workspaces to Dyalog APL or GNU APL

MLSI would like to use my old APL*PLUS PC functions on Dyalog or GNU APL. Is there a way to convert workspaces (preferred) or functions without having to retype the functions? I have tried reformatting the functions as a character matrix in APLPLUS PC (control A in the edit window) and saving in a ....

 

« first day (2158 days earlier)      last day (507 days later) »