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 6363703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:04:14+00:00 2026-05-25T00:04:14+00:00

I’m playing around with adverbs and conjunctions in J, and have run across a

  • 0

I’m playing around with adverbs and conjunctions in J, and have run across a strange problem. I’ve defined a simple adverb called persistence that can be used to view the progression of numbers generated when calculating the digital product or digital sum of a number.

S =: 1 : 'u/@:("."0)@":^:a:"0'

+ S 234 gives us 234 9. I then used this to create another adverb that calculates the persistence of a number.

P =: 1 : '<:@#@(u S)"0'

+ P 234 gives us 1. Now, imagine we want to find all numbers below 30 with additive persistence of 2 and then view the list generated by S for each number, e.g.,

+ S I. 2 = + P i.30

This generates the following list:

19 10 1
28 10 1
29 11 2

So far, so good. Now, I wanted to take this and turn it into a conjunction, the left-hand side of which contains the verb to use for persistence and the right-hand side of which contains the number used to limit the list. (2 in the example above.) Here’s my definition of that conjunction:

Q =: 2 : 'u S I. n = u P'

If I enter the expression + Q 2 into the J console, I get back the following:

+/@:("."0)@":^:a:"0 I. 2 = <:@#@(+/@:("."0)@":^:a:"0)"0

This is exactly correct, and if I run the full expression with an argument such as i.30, it works fine:

+/@:("."0)@":^:a:"0 I. 2 = <:@#@(+/@:("."0)@":^:a:"0)"0 i.30

However, when I enter the expression + Q 2 i.30 into the J console, I get back a ‘length error’. Why?! Isn’t + Q 2 exactly equivalent to +/@:("."0)@":^:a:"0 I. 2 = <:@#@(+/@:("."0)@":^:a:"0)"0?

I’m completely stumped. What am I missing? I’ve played around with rank both inside the definition of the conjunction and outside of it. I just don’t get it.

  • 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-25T00:04:15+00:00Added an answer on May 25, 2026 at 12:04 am

    + Q 2 is exactly equivalent to the expression you provided, but when using it in an expression it is as if it is in parenthesis.

       +/@:("."0)@":^:a:"0 I. 2 = <:@#@(+/@:("."0)@":^:a:"0)"0 i.30
    19 10 1
    28 10 1
    29 11 2
       (+/@:("."0)@":^:a:"0 I. 2 = <:@#@(+/@:("."0)@":^:a:"0)"0) i.30
    |length error
    

    In general f g h y != (f g h) y. In the latter f g h defines a train. For example:

       avg=: +/ % #
       +/ % # 1 2 3
    0.333333
       (+/ % #) 1 2 3
    2
       avg 1 2 3
    2
    

    You can fix your conjunction by adding a reference to y to it like this:

       Q=: 2 : 'u S I. n = u P y'
       + Q 2 i.30
    19 10 1
    28 10 1
    29 11 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I would like to run a str_replace or preg_replace which looks for certain words

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.