Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7504011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:25:30+00:00 2026-05-29T21:25:30+00:00

How come that ⌽(⍒’Hello’) is 1 2 4 3 5 when ⍋’Hello’ is 1

  • 0

How come that

⌽(⍒'Hello')

is

1 2 4 3 5

when

⍋'Hello'

is

1 2 3 4 5

?

I’m new to APL and stumbled on it by accident. I just wonderes why the second l comes before the first.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:25:33+00:00Added an answer on May 29, 2026 at 9:25 pm

    You are using both the grade up ⍋ and grade down ⍒ as monadic primitives.

    By definition grade up returns an integer array of indices which specify the sorted order of the expression following it, in ascending order. If any elements are equal (in your example the two letter l’s) , they will appear in the result in the same order that they appeared in the input expression.

    So, ⍋'Hello' returns 1 2 3 4 5. The two l’s are in the same order, i.e., the 3rd character (1st letter l) precedes the 4th character (2nd letter l).

    By definition grade down also returns an integer array of indices which specify the sorted order of the expression following it, in descending order. If any elements are equal (in your example the two letter l’s) , they will also appear in the result in the same order that they appeared in the expression.

    So, ⍒'Hello' returns 5 3 4 2 1. The two l’s remain in the same order because they are equal.
    When you apply rotate ⌽ the integer array gets reversed to 1 2 4 3 5 as you witnessed.

    The outcome you are seeing is precisely what is expected given the way the functions are defined and how they deal with equal values.

    If you want to see a more extreme example compare the output for the following two arrays. Create an array with 10 elements each having the same value of 1. 10⍴1 and then try the grade up function and then try the grade down function:

    ⍋10⍴1
    

    and

    ⍒10⍴1
    

    They will both yield the same result:

    1 2 3 4 5 6 7 8 9 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How are statements that come before any case labelled statement in a switch-case block
I'm encountering a stupid problem which I just cannot understand. How come that following
There are two instances that come to mind in the new iOS 5 where
The merge tool that come with smartgit is very confusing. I am not able
after reading all posts that come close to this, I still find no solution
I have source XMLfiles that come in with multiple root elements and there is
I've seen a couple pages that come close to this, but I'm looking for
I plan to build a websites that come to target specific countries and each
I have a bunch of html files that come with my app and are
I have a MessageInspector which logs the messages that come through? What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.