APL because it makes you think about the whole problem at once instead of looping through one number at a time. Most programs are much shorter than in other languages.
Multiplication table up to 20: ∘.×/2/⊂⍳20
10 lines where the Nth line has N asterisks: ⊃(⍳10)∘.⍴'*'
All possible two-character pairs: ⎕AV∘.,⎕AV
Draw 52 different random numbers from 1 to 52: 52?52
It's often easier to rewrite the program than try to debug someone else's code, because there are so many ways to do the same thing.
It's often easier to rewrite the program than try to debug someone else's code
Readability?
Name:
Anonymous2012-10-15 2:54
>>13
This is a typical example of APL, a library function for reading a file. → is branch and ⍎ is execute, the only forms of control flow in APL. Z←READFILEV N;A;B;C;D;E;F
⍝ Read file N and return records as vector of arrays.
⍝ N has a syntax of '["][path]filename["][ ,code]'
⍝ code defaults to code D(ASCII), but code A(APL2) and code T(Translate)
⍝ may be specified.
(F←1)OPEN N←((⌽∨\⌽' '≠N)/N),(~','∊N)/',D'
B←',A'≡¯2↑N
Z←'' ⍝ Initialise result
C←0 ⍝ Record counter for ASCII file
D←128 ⍝ Initial scan length
L0:⍎'CZ',(⍕F),'←6'
L4:¯44 ¯45 ¯46 ∆CHK E←⍎'CZ',⍕F
→(((~B)^E=¯44),E=¯45)/L2,L3
A←⍎'DZ',⍕F
→B/L1
C←C+1
L1:Z←Z,⊂A
→L0
L2:
→L4,⍎'CZ',(⍕F),'←6,C,D←2×D' ⍝ Double scan length
L3:CLOSE F
→B/0 ⍝ Exit if not ASCII file
Z←(-(⎕AF 26)=↑↑¯1↑Z)↓Z ⍝ Remove EOF record (if there)
What's your girlfriend and how do you justify it? It used to be my left hand but I haven't done any sex in the 4 years since dropping it.
Name:
Anonymous2012-10-15 11:34
>>15
There are no references in APL, so you need to use ⍎ on a string containing a variable name. However, you can't assign to the result of an evaluated string because it's data, not a variable, so you have to convert the data to a string and generate an assignment expression to evaluate with ⍎. This also means there is no referential transparency. If a variable has the same name as a local variable, the evaluated string will alter the local variable and not the one in the outer scope. Another thing is that the string passed in may not be a variable name, but an arbitrary expression that can include system functions (capable of modifying/deleting files or calling arbitrary external DLL/so functions) or syntax errors. APL also has a ⎕FX function to convert a string to a function, but it returns a string containing the function name, not a function. Evaluating it results in a syntax error, not a function reference, so if you want to use it in an expression, you need to either use a known name or evaluate the whole expression as a string.
>>16,18
See? Even >>25 knows this is a thread for irony and bad jokes.
Name:
Anonymous2012-10-15 14:33
logo: because it is ENTERPRISE READY.
Name:
Anonymous2012-10-15 15:28
Are you guys fucking kidding me?
ONE WORD: TCC SUPPORTS C SCRIPTING
Just add '#!/usr/local/bin/tcc -run' at the first line of your C source, and execute it directly from the command line.
Your other bullshit scripting languages can't compete with the speed of TCC and the elegance of the C programming language.
Name:
Anonymous2012-10-15 15:37
>>28
C is a terrible language for scripting, too much verbose code needs to be added.
If I can write something in awk in 2 minutes and it takes a full minute to run, that's still better than spending 5 minutes writing it in C no matter how fast it runs.