Inspired by some Conor Hoekstra YouTube videos, I tried doing some baby steps in APL and also convert my small lines to point-free style. But for this (percentage of rolls of 4, 5, or 6 in 1000 die-6 rolls) I can't wrap my head around how to eliminate the omega before the reshape.
Write {(+/3<?⍵⍴6)×100÷⍵}1000 tacitly
199 Views Asked by Felix Dombek At
1
There are 1 best solutions below
Related Questions in POINTFREE
- What is the resulting type of a simple pointfree implentation of dot product in Haskell?
- Haskell point free for more than one argument
- In Haskell how to make a function expression "point-free"
- Point-free function to add 2 elements to the list / double application of (:) list data constructor and (.)
- Can Prolog-like unification be expressed in a point free way?
- Debug Haskell composition chain without converting to point-full representation
- Point-free version of g(f(x)(y))
- Easy-to-read way of function composition in Javascript
- Elegant way to access the value of a record in haskell which is inside a monad
- Ramda — extract two properties and append one to the other pointfree style
- Flattening Tuples in Haskell (pointfree)
- point-free using String.prototype.concat() not working as expected
- Triple to pair point-free way
- Write {(+/3<?⍵⍴6)×100÷⍵}1000 tacitly
- Ramda apply an argument to both functions and compose them point free
Related Questions in APL
- Dyalog Trying to understand a Floating Point rounding issue
- Is there a special meaning to underbar variables names in APL
- What is the Dyalog equivalent of the APL/360 I-beam 26?
- Is there a Dyalog equivalent to DFT function from APL/360 "1 PLOTFORMAT"?
- Merge Vectors In APL
- Best way to import and handle non-rectangular (ragged) data
- How do I render trains as trees in Dyalog APL using dyalogscript?
- How do you find the name of the current namespace
- Dyalog APL, how to have utilitiy functions available in workspace but not mixed in with other functions
- How do I exit GNU APL?
- Dyalog APL: What are the miracles? Trouble with + and range
- Dyalog APL: How to execute a function regardless of errors?
- Apply a list of functions on the same right operand
- Filter a list of list based on data
- Dyalog APL: How to filter an array like filter()
Related Questions in TACIT-PROGRAMMING
- Write {(+/3<?⍵⍴6)×100÷⍵}1000 tacitly
- Check that each adjacent pair of a list is in order (tacit programming) in APL
- How can I extract multiple elements from a matrix in an APL tacit function?
- Write 4 : 'x&{.&.;: y' tacitly
- racket syntax pattern with multiple ...s
- Currying in Haskell with 2+ arguments
- Equivalent tacit expressions
- Point-free for filter function
- How to represent binary logical in Three Address Code
- How to write this function in point-free style?
- How to select with jq in an array of values?
- A way to use conjunctions and adverbs tacitly?
- How can I make a combinator with this type signature?
- Ramda: rewriting to point free style
- How to rewrite in point-free style with a repeating variable?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Let's take it step by step:
{(+/3<?⍵⍴6)×100÷⍵}First we need to express every part of the function that uses the argument, as a function of the argument. The multiplication combines the two main parts:
{+/3<?⍵⍴6}×{100÷⍵}In the rightmost part,
{100÷⍵}, we need the argument. There are a couple of ways we can deal with this:⊢to represent it:100÷⊢100, to the function÷yielding a monadic function:100∘÷Let's take the last approach:
{+/3<?⍵⍴6}×100∘÷In the left part,
{+/3<?⍵⍴6}, we can do the same, but need to watch out for two things, and each can be dealt with in a few different ways:6, as the rightmost part of our function.6⍨⍴and use an identity function:6⍴⍨⊢6, to the function⍴yielding a monadic function:⍴∘6?, in the middle.?atop⍴:?⍤⍴?beside<:<∘?Let's take the last approach for each problem:
(+/3<∘?⍴∘6)×100∘÷This is a fully tacit equivalent to the monadic function
{(+/3<?⍵⍴6)×100÷⍵}. However, there's one more trick we can use to eliminate the parenthesis. Since×is commutative, we can swap its arguments to put the more involved expression on the right:100∘÷×(+/3<∘?⍴∘6)However, now we have the problem of the monadic
+/in the middle. Observe that<sees a vector on the right and a scalar on the left. In the case ofF/s G vfor scalar functionsFandGwith scalarsand vectorvthe inner products F.G vis equivalent, so we can combine the summation with the comparison as follows:100∘÷×3+.<∘?⍴∘6Alternatively, we can observer that summation is equivalent to evaluation in base 1 because the place values in base 1 are (…,12, 11, 10) = (…, 1, 1, 1) so if we have the list (…, c, b, a) and evaluate it as a number in base 1, we get:
(… + c×12 + b×11 + a×10) =
(… + c×1 + b×1 + a×10) =
(… + c + b×1 + a×1) =
(… + c + b + a)
That is, the sum of our list. We can write this as:
100∘÷×1⊥3<∘?⍴∘6