This problem was inspired by Counting DNA Nucleotides found on the excellent bioinformatics website rosalind.info.
Write a function that:
Hint: The key operator f⌸ or the outer product operator ∘.g could be helpful.
(your_function) 'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC' 20 12 17 21 (your_function) '' 0 0 0 0 (your_function) 'G' 0 0 1 0
This problem is inspired by the Counting Point Mutations problem found on the excellent Bioinformatics education website rosalind.info.
Write a function that:
Hint: The plus function X+Y could be helpful.
'GAGCCTACTAACGGGAT' (your_function) 'CATCGTAATGACGGCCT' 7 'A' (your_function) 'T' 1 '' (your_function) '' 0 (your_function)⍨ 'CATCGTAATGACGGCCT' 0
Write a function that:
Hint: The without function X~Y could be helpful.
'DYALOG' (your_function) 'APL' DYOGP 'DYALOG' (your_function) ⊂'APL' ┌─┬─┬─┬─┬─┬─┬───┐ │D│Y│A│L│O│G│APL│ └─┴─┴─┴─┴─┴─┴───┘ (2 2⍴'Hello'(⊂'World')(2 2⍴⍳4)42) (your_function) 42 'Have a nice day' ┌─────┬───────┬───┬───────────────┐ │Hello│┌─────┐│1 2│Have a nice day│ │ ││World││3 4│ │ │ │└─────┘│ │ │ └─────┴───────┴───┴───────────────┘ 1 1 1 (your_function) 2 2 1 1 1 2 2
Write a function that:
Hint: The partition function X⊆fY could be helpful.
(your_function) 1 1 1 0 1 1 0 0 1 1 1 1 0 4 (your_function) ⍬ 0 (your_function) 1 1 (your_function) 0 0 (your_function) 12/0 1 0 1 12
(with apologies to Led Zeppelin)
Write a function that:
Hint: The index generator function ⍳Y could help with solving this problem.
(your_function) 10 ⎕ ⎕⎕ ⎕⎕⎕ ⎕⎕⎕⎕ ⎕⎕⎕⎕⎕ ⎕⎕⎕⎕⎕⎕ ⎕⎕⎕⎕⎕⎕⎕ ⎕⎕⎕⎕⎕⎕⎕⎕ ⎕⎕⎕⎕⎕⎕⎕⎕⎕ ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕ (your_function) 0 ⍝ returns a 0×0 matrix
Write a monadic function that:
Hint: The functions minimum X⌊Y and reverse ⌽Y, and the outer product operator X∘.gY could be helpful.
(your_function) 3 1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1 (your_function) 5 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 1 1 2 3 3 3 3 3 2 1 1 2 3 4 4 4 3 2 1 1 2 3 4 5 4 3 2 1 1 2 3 4 4 4 3 2 1 1 2 3 3 3 3 3 2 1 1 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 (your_function) 1 ⍝ should return 1 1⍴1 1 (your_function) 0 ⍝ should return 0 0⍴0
Apologies to the code golfers out there, but this problem has nothing to do with code golf! Instead, it addresses the problem of assigning places in a golf tournament. In regular golf, lower scores place higher – the lowest score places first and the highest score places last.
Write a function that:
Hint: This problem has several viable approaches including using key f⌸, or partition X⊆Y, or interval index X⍸Y.
(your_function) 1 2 3 4 5 1 2 3 4 5 (your_function) 68 71 71 73 1 2.5 2.5 4 (your_function) 67 68 68 69 70 70 70 71 72 1 2.5 2.5 4 6 6 6 8 9 (your_function) 6⍴70 3.5 3.5 3.5 3.5 3.5 3.5 (your_function) ⍬ ⍝ this should return an empty vector (your_function) 67 ⍝ should work with a scalar argument 1
Write a function that:
Hint: The take X↑Y and drop X↓Y functions, or the partitioned enclose function X⊂Y, could be helpful.
'do' (your_function) 'Hello World' ┌────┬───────┐ │Hell│o World│ └────┴───────┘ 'KEI' (your_function) ⎕A ⍝ ⎕A is the system constant that contains the characters A-Z ┌────┬──────────────────────┐ │ABCD│EFGHIJKLMNOPQRSTUVWXYZ│ └────┴──────────────────────┘ (⌽⎕A) (your_function) ⎕A ┌┬──────────────────────────┐ ││ABCDEFGHIJKLMNOPQRSTUVWXYZ│ └┴──────────────────────────┘ ⎕D (your_function) ⎕A ⍝ ⎕D is the system constant that contains the characters 0-9 ┌──────────────────────────┬┐ │ABCDEFGHIJKLMNOPQRSTUVWXYZ││ └──────────────────────────┴┘ ⎕D (your_function) 'Q' ┌─┬┐ │Q││ └─┴┘ ⎕A (your_function) 'Q' ┌┬─┐ ││Q│ └┴─┘
Write a function that:
Hint: The Reduce N-Wise operator Xf/Y could help with solving this problem.
0 (your_function) 1 2 3 4 5 6 ⍝ 0 neighbors on each side 1 2 3 4 5 6 1 (your_function) 1 2 3 4 5 6 ⍝ 1 neighbors on each side 1.333333333 2 3 4 5 5.666666667 2 (your_function) 1 2 3 4 5 6 ⍝ 2 neighbors on each side 1.6 2.2 3 4 4.8 5.4 6 (your_function) 1 2 3 4 5 6 2.538461538 2.923076923 3.307692308 3.692307692 4.076923077 4.461538462 10 (your_function) 42 42
Write a function that:
Note that the number of digits in the character representation might exceed the number of digits that can be represented as a 32-bit integer.
Hint: The at operator @ could be helpful.
',' (your_function)¨'1' '10' '100' '1000' '10000' '100000' '1000000' '10000000' '100000000' '1000000000' '10000000000' ┌─┬──┬───┬─────┬──────┬───────┬─────────┬──────────┬───────────┬─────────────┬──────────────┐ │1│10│100│1,000│10,000│100,000│1,000,000│10,000,000│100,000,000│1,000,000,000│10,000,000,000│ └─┴──┴───┴─────┴──────┴───────┴─────────┴──────────┴───────────┴─────────────┴──────────────┘ '.' (your_function) 60⍴⌽⎕D 987.654.321.098.765.432.109.876.543.210.987.654.321.098.765.432.109.876.543.210 '/' (your_function) ,'9' ⍝ scalars and 1-element character vectors are equivalent 9