[x =. 3 5 9 6 2 4 1 NB. set x to a list of numbers
3 5 9 6 2 4 1
#x NB. length of x?
7
+/ x NB. the / adverb is called 'insert'
30 NB. it puts + inbetween each item of the list
*/ x
6480
+/x % #x NB. mean = total / count
4.28571
(+/%#) x NB. tactic notation (better than pointless^H^H^H^H free style)
4.28571
Name:
Anonymous2007-04-04 8:36 ID:iCSEMMSw
I've looked at some J code. Every other character is a period or a colon. I've got spots before my eyes. How can anybody read this stuff? You'll get used to it. J has a great many primitives, and it's important to keep the names short so that you can fit a lot of computation on one line; so the names are either single characters, like >, or a character with a period or colon appended (>. and >:). The period/colon is just part of the name. Single letters with period/colon, like i., are also used for primitives. If you want to assign your own names to the primitives, you are allowed to, but pretty soon you'll want to go back to the shorter names to save space and typing.
Yeah, screw readable names. It's not like people have to maintain code or anything.
Name:
Anonymous2007-04-04 8:46 ID:A+7Bprzl
>>5
"By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and in effect increases the mental power of the race." - A. N. Whitehead
"In science, each new point of view calls forth a revolution in nomenclature." - Friedrich Engels
>>39
What happens when you sort a list which contains duplicate elements?
Name:
Anonymous2007-04-11 2:15 ID:qlHWeTXT
>>5
The harder your code is to read the less disposable you are.
Name:
Anonymous2007-04-11 3:48 ID:Ak8DbxXh
>>41
i do nicely commented structured code. One place i worked at was so full of tards the place fall apart after i left. too bad my fellow workers were just too fucking stupid to follow simple instructions or do the work to begin with. how they called themselves programmers was beyond me when all they were doing was copypasta from my originals.
next week tune in for...
Name:
Anonymous2007-04-11 4:52 ID:bL7HHWtt
>>40
Oh, duh... Didn't even try it, so I hadn't realized I compared strictly twice.
qsort = lambda x: x and qsort([i for i in x[1:] if i <= x[0]]) + [x[0]] + qsort([i for i in x[1:] if i > x[0]]) or []
Name:
Anonymous2007-04-11 13:56 ID:qlHWeTXT
>>42
I love when we got code back from contractors and they completely either ignored the pseudocode comments as to what functions should do or (the best) changed the comment to what they made it do.
"Wonderful...it doesn't even do what we wanted it to do now."
>>1 - >>53
That was EXPERT PROGRAMMER quality!
I am the 1/0 of my GET.
LISP is my body, and SICP is my blood.
I have created over 999 HUGE programs that you couldn't even comprehend.
Unaware of Python.
Nor aware of Ruby on rails.
Withstood the forced indentation of the code to create many touring-complete programs.
Waiting for an EXPERT PROGRAMMER's arrival.
I have no regrets, this was the only path.
My whole life was /prog/.
Name:
Anonymous2007-06-18 22:35 ID:AwdPCkBs
Ackermann's function in J
ack =: c1 ` c1 ` c2 ` c3 @. (#. @(,&*))
c1 =: >:@] NB. 1 + y
c2 =: <:@[ ack 1: NB. (x-1) ack 1
c3 =: <:@[ ack [ack <:@] NB. (x -1) ack x ack y -1
Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy