Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

ITT The J programming language

Name: Anonymous 2007-04-04 8:14 ID:A+7Bprzl

Examples of J: http://www.jsoftware.com/jwiki/Studio
A good introduction: http://www.jsoftware.com/help/primer/contents.htm
J for C programmers: http://www.jsoftware.com/help/jforc/contents.htm
Learning J: http://www.jsoftware.com/help/learning/contents.htm


quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)

Name: Anonymous 2007-04-04 8:19 ID:N7OPLgFv

Worse than perl.

Name: Anonymous 2007-04-04 8:25 ID:Hilt3olT

>>2
Better than APL!

J is truly the future of computation.

Name: Anonymous 2007-04-04 8:31 ID:A+7Bprzl


   [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: Anonymous 2007-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: Anonymous 2007-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

Name: Anonymous 2007-04-04 9:13 ID:A+7Bprzl

From http://www.cs.trinity.edu/~jhowland/math-talk/functional1/#SECTION00050000000000000000


   x =: 'x'
   y =: 'y'
   z =: 'z'
   f =: 3 : 0
'f(', y, ')'
:
'f(', x, ', ', y, ')'
)

   math_pat =: 3 : 0
'''',y,'('',y,'')''',LF,':',LF,'''',y,'('',x,'','',y,'')'''
)

f =: (3 : (math_pat 'f')) :. (3 : (math_pat 'f_inv'))
g =: (3 : (math_pat 'g')) :. (3 : (math_pat 'g_inv'))
h =: (3 : (math_pat 'h')) :. (3 : (math_pat 'h_inv'))
i =: (3 : (math_pat 'i')) :. (3 : (math_pat 'i_inv'))
j =: (3 : (math_pat 'j')) :. (3 : (math_pat 'j_inv'))


Now you can test expressions to see the function composition rules

   f x
f(x)
   f g x
f(g(x))
   (f g h) x
g(f(x),h(x))
   x (f g h) y
g(f(x,y),h(x,y))

   x f&g y
f(g(x),g(y))
   x f&g&h y
f(g(h(x)),g(h(y)))
   x f g&h y
f(x,g(h(y)))

   x f@g y
f(g(x,y))
   x (f g@h) y
f(x,g(h(y)))

Name: Anonymous 2007-04-06 12:11 ID:xIDx3a8V

cool

Name: Anonymous 2007-04-06 13:37 ID:cITkHmPU

qsort [] = []
qsort (x:xs) = qsort less ++ [x] ++ qsort more
    where (less, more) = partition (< x) xs

Name: Anonymous 2007-04-06 13:51 ID:X34ArnfV

>>9
$:@(>#[)

Name: Anonymous 2007-04-06 14:17 ID:cITkHmPU

>>10
X(

Name: Anonymous 2007-04-06 18:19 ID:UV18LUaO

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: Anonymous 2007-04-06 19:40 ID:cITkHmPU

>>12
I no longer wonder why van Rossum wanted to get rid of lambdas in Python.

Name: Anonymous 2007-04-06 19:44 ID:UV18LUaO

>>13
I admit it sucked but I wanted to do it in less lines than >>9 to see if I can troll the Haskell guy one more time.

Name: Anonymous 2007-04-06 19:49 ID:e/+Ee95N

Are these quicksorts in-place? Or is this just your way to say "I've read SICP"?

Name: Anonymous 2007-04-06 20:00 ID:cITkHmPU

>>14
You succeeded.

>>15
No, they are in-SICP. But they are still the best way to demonstrate the idea of quicksort.

Name: Anonymous 2007-04-07 5:42 ID:C9MJ60zi

SPOILER: >>12 contains a bug

Name: Anonymous 2007-04-07 6:49 ID:gQ81pvl6

>>17
It's an undocumented feature!

Name: Anonymous 2007-04-07 10:20 ID:npmD/EJg

What's this then? The bastard offspring of a love-hate-orgy triangle between Haskell, Perl and Forth?

Name: Anonymous 2007-04-07 10:40 ID:J6X4fgKZ

>>19
APL, motherfucker, have you ever heard of it?

Name: Anonymous 2007-04-07 13:51 ID:6SwJdC/n

>>19
more like the future of computing!

Name: Anonymous 2007-04-07 14:30 ID:Heaven

>>21
I started the ``future of computation'' meme !!

I also started the ``tex quotes'' meme !!

Name: Anonymous 2007-04-07 14:35 ID:6SwJdC/n

>>22
ok well lets get back on topic :)

Name: Anonymous 2007-04-07 16:21 ID:WBqctclY

This ``quote style'' is superior. However, the "space - exclamation point" thing is annoying as fuck.

Name: Anonymous 2007-04-07 16:37 ID:gQ81pvl6

This “quote style” is superior‼

Name: Anonymous 2007-04-07 22:07 ID:6SwJdC/n

HOW TO MAKE Make a hypercube from a vector of length n (where n is a power of 2):

#:&.<:@# $ ]

Name: Anonymous 2007-04-09 1:51 ID:HkCRsRmr

in J zero divided by zero = zero!!!

   0%0
0

Name: Anonymous 2007-04-09 1:54 ID:onhmdO/m

^^wrong

0=0

4%

Name: Anonymous 2007-04-09 2:00 ID:6bs2IFb4

Dividing by zero considered overrated

Prelude> 1/0
Infinity

Name: Anonymous 2007-04-09 2:47 ID:onhmdO/m

^dude that's wrong.

Prelude<^`2/5
Indafo,cic

Name: Anonymous 2007-04-09 3:09 ID:cBVQTJDh

>>29
I just lost a little piece of respect for Haskell.

Name: Anonymous 2007-04-09 3:39 ID:Heaven

Using Haskell considered retarded

Name: Anonymous 2007-04-09 5:50 ID:Y4qqp/vv

>>29
bitches don't know about my integer division

Hugs.Base> 1 `div` 0

Program error: divide by zero

Name: Anonymous 2007-04-09 5:59 ID:Heaven

data Surreal = APlainBoringNumberNoOneReallyCaresAbout Double | OhShi

(/////////) :: Num a => a -> a -> Surreal
(/////////) _ 0 = OhShi
(/////////) a b = APlainBoringNumberNoOneReallyCaresAbout $ a / b

Name: Anonymous 2007-04-09 6:49 ID:t6bi9DTl

>>31,32
Don't blame Haskell. Blame the IEEE:
http://en.wikipedia.org/wiki/IEEE_754

Name: Anonymous 2007-04-09 12:14 ID:r5Sr3yLw

itt: crap programming languages nobody uses FOR A REASON

Name: Anonymous 2007-04-09 13:11 ID:HkCRsRmr

>>36
lots of people use it because its simply the best tool for the job they are doing.

Name: Anonymous 2007-04-09 13:27 ID:lC6diV8H

The job they're doing being nothing.

Name: Anonymous 2007-04-09 15:22 ID:8lxHqepV

>>17
So what's the bug?

Name: Anonymous 2007-04-09 15:28 ID:Heaven

>>39
What happens when you sort a list which contains duplicate elements?

Name: Anonymous 2007-04-11 2:15 ID:qlHWeTXT

>>5
The harder your code is to read the less disposable you are.

Name: Anonymous 2007-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: Anonymous 2007-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: Anonymous 2007-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."

Name: Anonymous 2007-06-14 13:08 ID:6ONwV4by

[bold]   ] p=: ?.~ 23
4 22 16 15 18 14 7 8 0 21 3 13 20 9 11 19 6 17 2 5 1 10 12
   C. p
┌──┬─────────────────┬──────────────────────────┬──────────┐
│17│18 2 16 6 7 8 0 4│21 10 3 15 19 5 14 11 13 9│22 12 20 1│
└──┴─────────────────┴──────────────────────────┴──────────┘
   #&> C. p
1 8 10 4
   *./ #&> C. p
40
   # ~. {/\ (100,#p)$p
40
   p&{^:40 i.#p
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
[/bold]

Name: Anonymous 2007-06-14 18:23 ID:qGsfJu7Q

>>45
[spoiler]You are [b]not an [i][u][o][s]EXPERT [spoiler]BBCODE[/spoiler] PROGRAMMER[/s][/o][/u][/i][/b][/spoiler].

Name: Anonymous 2007-06-14 18:23 ID:qGsfJu7Q

Oh what the fuck.

Name: Anonymous 2007-06-14 18:30 ID:Heaven

WTF. I was expecting something more Java-like.

Name: Anonymous 2007-06-14 18:41 ID:Z49PgsRQ

>>47
You fail at bbcode

Name: Anonymous 2007-06-14 19:01 ID:XDl0nRhE

>>49

you fail at quoting

Name: Anonymous 2007-06-14 20:14 ID:tIRKm7j6

>>50
You fail at recognizing same person and GET-ing.

Name: Anonymous 2007-06-14 20:49 ID:Z49PgsRQ

>>51
"50 get" how fucking old are you?

Name: Anonymous 2007-06-14 22:31 ID:6ONwV4by

oh i try again?

Name: Anonymous 2007-06-14 22:35 ID:Heaven

>>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: Anonymous 2007-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

Name: Anonymous 2007-06-19 16:30 ID:hC8t6g/W


    0%0
0

wat?

Name: Anonymous 2009-01-14 13:53

FIOC

Name: Anonymous 2009-03-06 6:10

8 By learning MFC.

Name: Anonymous 2010-12-17 1:40

Erika once told me that Xarn is a bad boyfriend

Name: Anonymous 2012-02-05 17:00

>>45

that's actually pretty hot, thanks

Name: Anonymous 2012-02-05 19:26

http://www.jsoftware.com/help/jforc/culture_shock.htm#_Toc191734290

How do I compile my program?

You don't.  J is interpreted

Dropped.

Name: Sgt.KabuⰆ顀kiman⾁井 2012-05-28 23:59

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

Don't change these.
Name: Email:
Entire Thread Thread List