« first day (585 days earlier)      last day (2087 days later) » 

6:15 PM
hi @Adám
 
@NoahCristino Welcome. So you say Jelly is the only programming language you know?
 
@Adám only code golf
 
@NoahCristino Ah, what else, non-golf?
 
I know tons of normal languages not specific to golfing
php, python, c, c#, c++, javascript, html, css
and more
 
OK. Well, APL is different. Kinda like Jelly is. But it is still a real-world production language.
Since you know Jelly, you'll feel right at home with a lot of things. The main feature you probably have not seen before is a very thorough array concept.
 
6:18 PM
okay
its been months since ive last used jelly so im a bit rusty @Adám
 
@NoahCristino OK, no problem. Let me begin with some terminology.
 
Built-ins are called primitives. Corresponding to Jelly atoms are primive functions. Jelly links are user defined functions. APL has a few different types of user defined functions. The ones most similar to Jelly links are called trains.
 
Corresponding to Jelly's quicks are APL's operators.
 
6:24 PM
ok
 
Some things are really the same in Jelly and APL. E.g. + is addition, and / is reduction (or N-wise reduction), so +/ is summation.
 
A big difference between Jelly and APL is that APL symbols are "overloaded" in that they have both a prefix meaning and an infix meaning. E.g. - is both negate (-2) and subtraction (5-2).
As you will see, the context always unambiguously determines valence.
 
Btw, negative numbers are denoted by a high minus (like in TI-BASIC); ¯2.
Also, APL functions are right-associative. Note this is opposite of Jelly.
Operators are never ambivalent. They are either postfix (like /) or infix (like dot-product; +.×).
@NoahCristino Btw, you can already now start playing with APL. You can use this language bar and enter APL expressions for the chatbot by prefixing them with ⎕←
⎕←3-5
 
6:30 PM
@Adám
¯2
 
can you give me a problem to try @Adám
 
@NoahCristino Sure. Given a list, determine if it is identical to its reverse.
 
where are the docs for apl with the operator lists
@Adám
 
@NoahCristino This may help.
@NoahCristino You will need to know something about functions, but let me get you started as follows:
⎕←(⊢+⊢)list←3 1 4 1 5
 
@Adám
6 2 8 2 10
 
6:34 PM
@NoahCristino you can also hover over the characterers in the language bar
 
@NoahCristino The above parenthesised expression is a train; a tacit function. is the identity of the (right) argument. So it means the argument plus the argument.
 
⎕←⊢
 
@NoahCristino
⊢
SYNTAX ERROR
 
⎕list←3 2 3\
⎕←list3 2 3
 
@NoahCristino
VALUE ERROR
 
6:36 PM
⎕←list←3 2 3
 
@Adám
3 2 3
 
⎕←list←3 2 3
 
@NoahCristino
3 2 3
 
⎕←list←3 2 3⊖
 
@NoahCristino
SYNTAX ERROR
 
6:38 PM
@NoahCristino APL is mirrored compared to Jelly:
 
⎕←⊖list←1 2 3
 
@NoahCristino
3 2 1
 
⎕←list←⊖3 2 3
 
@Adám
3 2 3
 
hehe.
 
6:39 PM
⎕←⊖list←1 2 3 = 1 2 3
 
@NoahCristino
1 1 1
 
⎕←⊖list←1 2 3 = list←1 2 3
⎕←⊖list←1 2 3 = list←1 2 3
bot?
@Adám ?
 
@NoahCristino It has personality.
2
 
⎕←⊖list←1 2 3 = list←1 2 3
 
@NoahCristino
1 1 1
 
6:44 PM
⎕←⊖list←3 2 3 = list←3 2 3
 
@NoahCristino So what happened? ⊖(list←(3 2 3 = (list←3 2 3)))
 
⎕←⊖(list←(3 2 3 = (list←3 2 3)))
 
@NoahCristino
1 1 1
 
You only need to assign to the list once. We're looking for something like ⎕←(your code here)list←1 2 3
 
how do I reference the list again?
 
6:46 PM
In fact, you don't even need to give the list a name: ⎕←(you code here)1 2 3
@NoahCristino You can either use its name, or (in a tacit function) .
 
⎕←(⊖=⊢)1 2 3
 
@NoahCristino
0 1 0
 
@NoahCristino Nice. Almost there.
 
why does it print 3 numbers?
oh
each list element
 
@NoahCristino Yes = is a normal function, just like +.
@NoahCristino So you can either use a different function instead of =, or you can use the part-way result for further computation.
 
6:49 PM
⎕←(⊖=⊢^)1 2 3
 
@NoahCristino
SYNTAX ERROR
 
⎕←(⊖^⊢)1 2 3
 
@NoahCristino
3 2 3
 
@NoahCristino Wrong way! But you're on the right track. However, is an infix function, so you need to reduce with it.
@NoahCristino That's something entirely different. is extended to be LCM.
 
⎕←(⊖∨⊢)1 2 3
 
6:51 PM
@NoahCristino
1 2 1
 
@NoahCristino That's GCD.
 
I saw this online "The logical functions (logical ^, ∨ and the rest of that family) work on a subset of the number domain. They recognise two states only, true or false as represented by the numbers 1 and 0. If any other numbers or characters are submitted to them, a domain error results."
so I was trying to do taht
 
@NoahCristino That was in the old days. Today, and work on all numbers.
 
so I need to check the whole list not each value
 
You were all correct with (⊖=⊢) You just need to -reduce the result. Remember that all functions are right associative. I.e. they take everything on their right as their argument.
 
6:53 PM
⎕←(⊖=^⊢)1 2 3
 
@NoahCristino
SYNTAX ERROR
 
⎕←∧/1 0 1
 
⎕←(⊖=⊢)^1 2 3
 
@Adám
0
 
⎕←(⊖=^⊢)1 2 3
 
6:53 PM
@NoahCristino
SYNTAX ERROR
 
⎕←(⊖=⊢)^/1 2 3
 
@NoahCristino
1
 
@NoahCristino Uh you need to apply after ⊖=⊢, i.e. on the far left.
 
⎕←^(⊖=⊢)1 2 3
 
@NoahCristino
SYNTAX ERROR
 
6:54 PM
oh I get it now
nvm
⎕←^((⊖=⊢)1 2 3)
⎕←(⊖=^⊢)1 2 3
 
@NoahCristino And don't forget to reduce. is infix.
 
what does ^ do again?
 
@NoahCristino x AND y
 
⎕←/(⊖^⊢)1 2 3
 
@NoahCristino
SYNTAX ERROR
 
6:55 PM
do I need ^?
⎕←/(⊖=⊢)1 2 3
 
@NoahCristino Yes you do. Compare:
⎕←2+3
 
@Adám
5
 
⎕←+/2 3
@DyalogAPL C'mon, really?
⎕←+/2 3
 
@Adám
5
 
⎕←/^((⊖=⊢)1 2 3)
 
6:57 PM
@NoahCristino
SYNTAX ERROR
 
how is that not working?
 
@NoahCristino Almost! / (as all monadic operators) is post-fix. Look at my summation example.
So, in +/ we have / take + as its operand and derives a new monadic (i.e. prefix) function which is summation.
 
⎕←^.(⊖=⊢)1 2 3
 
@NoahCristino
SYNTAX ERROR
 
⎕←^/(⊖=^⊢)1 2 3
 
6:59 PM
@NoahCristino Stray in the parenthesis.
 
@Adám So regular monadic functions are prefix, but operators are postfix?
 
@Pavel Yes.
 
⎕←^/(⊖=⊢)1 2 3
 
@NoahCristino
0
 
⎕←^/(⊖=⊢)3 2 3
 
6:59 PM
@NoahCristino
1
 
iverson y u do dis ;-;
 
@Pavel What?
 
post-fix operators
 
@Pavel Because then it aligns with adverbs in English. run vs run quickly
 
7:00 PM
@Adám i did ittt
 
@NoahCristino You sure did. Congrats! You can also put the ∧/ inside:
⎕←(∧/⊖=⊢)1 2 3
 
@Adám
0
 
@NoahCristino Or you could use that generalised dot product:
⎕←(⊖∧.=⊢)3 2 3
 
@Adám
1
 
Or even the non-mapping (i.e. looks at the entire arguments) "match" function:
⎕←(⊖≡⊢)1 2 3
 
7:02 PM
@Adám
0
 
@Adám Aren't both ways valid English?
I'm pretty sure you can say quickly run
 
@Pavel I guess.
@NoahCristino I have to go now, but I suggest you try go through the APL arrays lesson on the Learn tab at TryAPL.org.
 
@Adám ok thx
 

« first day (585 days earlier)      last day (2087 days later) »