Oh holy shit! I was looking at it for several minutes and it started making sense! Maybe because I thought through problem with @aspittel
, or maybe this APL is more sensible (the last one I saw, someone had spilled a bag of unicode across its source).
I'm using Ruby's comment syntax because IDK how to do it in APL
# Haskell uses arrows for assignment in `do` blocks.
# Whitespace delimited numbers are a thing in lisp.
# The high bar looks a lot like a minus sign, so:
A← # set into the variable A
A←1 2 3 ¯4 ¯5 ¯6 # the list of numbers: [1, 2, 3, -4, -5, -6]
# Haskell iplements + as a function that you can pass around
# The slash looks like and is used like a shell pipeline.
# Tilde is logical negation in many syntaxes.
# `A` in `A<0` is like SQL, which uses the
# table name to refer to that table's current row.
X← # set into the variable X
X←+/ # the sum of
X←+/(~ # the numbers which aren't
X←+/(~A<0)/ # negative
X←+/(~A<0)/A # from the list A
Y← # set into the variable Y
Y←+/ # the sum of
Y←+/(~ # the variables that aren't
Y←+/(~A>0)/ # positive
Y←+/(~A>0)/A # from the list A
O←X Y # set X and Y as the output
maybe this APL is more sensible (the last one I saw, someone had spilled a bag of unicode across its source).
That's the thing with first tries: You mostly write code which is relatively easy to understand. The APL symbol for comments is ⍝, by the way. And I have no idea how to write it without a Unicode table. ;-)
Thank you for your explanation. I finally understand wtf I was doing. (I know that I could probably have obfuscated it even more, "not negative" is longer than "positive", but I think I still won.)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Oh holy shit! I was looking at it for several minutes and it started making sense! Maybe because I thought through problem with @aspittel , or maybe this APL is more sensible (the last one I saw, someone had spilled a bag of unicode across its source).
I'm using Ruby's comment syntax because IDK how to do it in APL
That's the thing with first tries: You mostly write code which is relatively easy to understand. The APL symbol for comments is
⍝
, by the way. And I have no idea how to write it without a Unicode table. ;-)Thank you for your explanation. I finally understand wtf I was doing. (I know that I could probably have obfuscated it even more, "not negative" is longer than "positive", but I think I still won.)