Real encode

APL-related discussions - a stream of APL consciousness.
Not sure where to start a discussion ? Here's the place to be
Forum rules
This forum is for discussing APL-related issues. If you think that the subject is off-topic, then the Chat forum is probably a better place for your thoughts !

Real encode

Postby sjt on Wed Apr 16, 2014 5:15 pm

Four decades of APL-ing and it finally occurs to me to wonder if encode takes a real left argument. Why? Listening to Prince sing "A Million Days". How long is that in years and days?

      1e6⊤⍨0 365
2739 265
⍝ what about leap years?
1e6⊤⍨0,365+÷4
2737 310.75
⍝ and the centenaries that aren't leap years?
1e6⊤⍨0,365++/÷400 ¯100 4
2737 331.2775

Of course the answer isn't really a fractional number of days. That's just probability blur from estimating instead of knowing exactly which years are leap years.
sjt
 
Posts: 21
Joined: Fri Nov 05, 2010 6:26 am

Return to APL Chat

Who is online

Users browsing this forum: No registered users and 1 guest