Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Answer:</strong> <code>a.τwτ</code>, but you have to install <a href="https://rubygems.org/gems/pyper" rel="nofollow">Pyper</a> first...</p> <p><strong>Pyper intro:</strong> Do you know Lispy <code>car</code> and <code>cdr</code> returning "first" and "rest" of the array? Just for the needs like yours, I made an extension of this Lispy mechanism. It's called <code>pyper</code>, and it allows you to access also 2nd, rest from 2nd, 3rd, rest from 3d, and also last, everything except last etc. That wouldn't be much to write about, but it also allows letter composition, just like <code>caar</code>, <code>cadr</code>, <code>cdadar</code> etc. known from Lisp:</p> <pre><code># First, gem install pyper require 'pyper' include Pyper a = %w/lorem ipsum dolor sit amet/ # To avoid confusion with other methods, and also because it resembles a rain gutter, # Greek letter τ is used to delimit Pyper methods: a.τaτ #=&gt; "lorem" a.τdτ #=&gt; ["ipsum", "dolor", "sit", "amet"] a.τbτ #=&gt; "ipsum" a.τeτ #=&gt; ["dolor", "sit", "amet"] a.τcτ #=&gt; "dolor" (3rd) a.τzτ #=&gt; "amet" (last) a.τyτ #=&gt; "sit" (2nd from the end) a.τxτ #=&gt; "dolor" (3rd from the end) </code></pre> <p>and finally, the answer to your question:</p> <pre><code>a.τwτ #=&gt; ["lorem", "ipsum", "dolor", "sit"] (all except last) </code></pre> <p>There is more:</p> <pre><code>a.τuτ #=&gt; ["lorem", "ipsum", "dolor"] (all except last 2) a.τ1τ #=&gt; ["lorem", "ipsum"] (first 2) a.τ8τ #=&gt; (last 2) a.τ7τ #=&gt; (last 3) </code></pre> <p>Compositions:</p> <pre><code>a.τwydτ #=&gt; "olor" (all except 1st letter of the last word of all-except-last array) </code></pre> <p>There are also more command characters than just <code>a..f</code>, <code>u..z</code> and <code>0..9</code>, most notably <code>m</code>, meaning map:</p> <pre><code>a.τwmbτ #=&gt; ["o", "p", "o", "i"] (second letters of all-except-last array) </code></pre> <p>But other command characters are too hot and not very easy to use at the moment.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload