3 ms·
why does no programming language website ever include an example of the language? just a hello world or whatever would go a huge way. this annoys me so much.
by snek 8y ago
why does no programming language website ever include an example of the language? just a hello world or whatever would go a huge way. this annoys me so much.
- ehaliewicz2 8y agoTo be fair, most people probably wouldn't be able to read a serious example of J, and hello world is just 'hello, world', so I think it's ok.
- snek 8y agothat just makes me more curious about what J looks like. and maybe a hello world isn't the best example for every language, but there should be some small example you can show.
- kingaillas 8y agoI dug around and found Advent of Code 2015 solutions, in J: https://code.jsoftware.com/wiki/Essays/Advent_Of_Code https://code.jsoftware.com/wiki/Essays/Advent_Of_Code That should be plenty of examples for you.
- 4thaccount 8y agoIn APL and J, hello world is just 'Hello, World' I think if I recall correctly. What makes the languages (APL, J, K) impressive is that you can simplify what is sometimes pages of code into a single line of symbols (APL) or standard ASCII characters (J and K). Keep in mind that these languages are the definition of line noise to most coders as having prior knowledge of things like C, Python...etc will do you zero good as the building blocks are completely different from a high level. They might have if-statements in the language, but they're hardly idiomatic. J emphasizes tacit programming which is kind of like a data flow model made up of function application. The languages are quite mathy in some ways, but still approachable. I find them to be lots of fun, very interactive, thought provoking, and pretty cool. I've only written a little APL & J, but enjoyed how I built my command up from a few built-in primitives. A problem to me involves reading other people's code which uses primitives I haven't learned yet, or common idioms (Ex: you can make your own average function with a few characters avg=.+/%# so no need to add it to the stdlib). The average function on the tryapl.org site looked a little funny to me...then I realized it worked for not only lists, but multi-dimemsional data structures of n dimensions like tables or lists of tables. I imagine it takes awhile to become proficient. Surprisingly, both J and APL have some decent support for things such as graphics, but they are still small communities compared to languages we know and love like Python. In short, give it a try. J has some built in documentation called "J labs" that is submitted by the community. Dyalog APL has a free version for non commercial use and the excellent tryapl.org. Try not to be turned off by the bizzare symbols in APL. They have a long history and are easy to enter with either the IDE or keyboard (especially if you buy one from Dyalog with the symbols on the keys). The inventor of APL got the Turing Award awhile back (later invented J). It was also a big IBM product back in the day and is still used by companies like Volvo.
- snek 8y agoI'm not discounting the language at all, by your comment here perhaps some application of a common mathematical function such as an average or the fibonacci sequence would be a good front page example.
- 4thaccount 8y agoThat would make sense. Maybe someone on their mailing list will take note (I'm just a lurker). If you want to see something really cool, look at the APL video for Conway's Game of Life on YouTube. If I recall correctly, Jon Scholes made that video a few years ago. I don't know him, but he was supposed to be an APL wizard and an all around good guy from what I've read. I was sad to read that he passed away recently.
- kwhitefoot 8y agoThat was brilliant! Thank you for making me aware of that video. It would be great if someone could translate that into J, then I might have a chance of understanding it properly.
- 4thaccount 8y agoThere might be a version on Rosetta Code.
- jodrellblank 8y agoI tried, although I don't speak J so it's a rough transliteration. I couldn't do the last GUI animated part without more knowledge of J's tools, but it can compute multiple generations. Code summary: r =. (3 3 $ i. 9) e. 1 2 3 4 7 R =. _1 |. _2 |."1 (5 7 {. r) RR =. 15 35 {. _10 _20 {. R life =. verb : '+./ > (1;y) *.each 3 4 =each +each/ +each/ 1 0 _1 |.each/ 1 0 _1 |."1 each <y' gen =. dyad : 'life ^: y x' The 20th generation: (RR gen 20) { '.X' ................................... ................................... ................................... ................................... .........X....XXX.................. ........XX.....XX.................. .......XX.....XX................... ........X.X...X.X.................. .........XX....XXXX................ ..........X...X..XX................ ..............X.XX................. ..............XXX.................. ................................... ................................... ................................... Transcript of the whole talk with line by line translation here: https://dpaste.de/OoEM/raw https://dpaste.de/OoEM/raw (expires in 7 days).
- fxj 8y agoThis blog gives you a taste of J for mere mortals. After reading that I at least understood the gist behind J: https://kukuruku.co/post/j-can-be-readable/ https://kukuruku.co/post/j-can-be-readable/