Avoid interim variable
3 posts
• Page 1 of 1
Avoid interim variable
Dear all,
I have the function leap, that checks if a year is a leap year or not.
Now I would like to calculate all leap years from 2023 till 2030.
leap←{0≠.=400 100 4∘|⍵}
I used this:
(leap¨y)/y←2022↓⍳2030
Could this be done simpler without saving the vector of years in y?
Thank you very much in advance.
Best regards,
Florian
I have the function leap, that checks if a year is a leap year or not.
Now I would like to calculate all leap years from 2023 till 2030.
leap←{0≠.=400 100 4∘|⍵}
I used this:
(leap¨y)/y←2022↓⍳2030
Could this be done simpler without saving the vector of years in y?
Thank you very much in advance.
Best regards,
Florian
- bilekflo
- Posts: 28
- Joined: Wed Mar 12, 2014 10:07 pm
Re: Avoid interim variable
Hi Florian,
You can tweak leap a bit to make it take an array...
And then use:
I hope this helps!
/Brian
You can tweak leap a bit to make it take an array...
leap←{0≠.=400 100 4∘.|⍵}
And then use:
(leap⊢⍤/⊢)2022↓⍳2050
2024 2028 2032 2036 2040 2044 2048
I hope this helps!
/Brian
-
Brian|Dyalog - Posts: 119
- Joined: Thu Nov 26, 2009 4:02 pm
- Location: West Henrietta, NY
Re: Avoid interim variable
Hi Brian,
Thank you very indeed. This was is exactly what I need.
Great.
Best regards.
Florian
Thank you very indeed. This was is exactly what I need.
Great.
Best regards.
Florian
- bilekflo
- Posts: 28
- Joined: Wed Mar 12, 2014 10:07 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group