Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Boiled Water posted:

on the other hand the decision was made way back so who knows

the explicit predecessor of python was abc, which came with a syntax-directed repl. it's a bit interesting to try out. given syntax-directed editing, it makes some sense to minimize block delimiters, and thus syntactic noise. perhaps the design decision was taken forward to python without further consideration?

one surprising aspect of abc is that there is no boolean datatype, only syntactic boolean expressions. you can define a predicate as a special case of function suitable for reference somewhere that syntactically needs a boolean, but you cannot store a boolean value in a variable:

code:
>>> PUT 4+3 IN a
>>> WRITE a
7
>>> IF 4>3: WRITE "yep"
yep
>>> HOW TO REPORT pred:
HOW TO REPORT pred:
   REPORT 4>3

>>> IF pred: WRITE "yep"
yep
>>> PUT 4>3 IN a
*** There's something I don't understand in your command
    PUT 4>3 IN a
         ^
overall it is quite a bizarre language with a remarkable number of unintuitive corners for its size.

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
anecdotally from my own teaching experience, especially with younger kids and total beginners, it is quite difficult to get new students used to the semantic significance of whitespace. they had a somewhat easier time with languages that use explicit block delimiters. line-numbered BASIC- which notably does not feature any kind of recursive syntactic structure outside of arithmetic expressions- was by far the most intuitive syntax for these groups. students could easily form an accurate mental model of the step-by-step nature of a BASIC program. familiarity with this style of notation seemed to help later when introducing block structure by showing a correspondence to familiar patterns.

if you already know how to program in some language, picking up python's syntax and semantics aren't very hard. i am, however, quite critical of its use as an introductory language.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
all code is written by assholes

all features that exist in a language will be used, often in the most malicious possible manner, in code you will later have to maintain

having 15 levels of operator precedence is a lovely design decision. seriously, the more time i spend using languages with uniform operator precedence the more convinced i am that it is the only correct solution. even alan kay got this right

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
at my day job i use k

when i added constexprs to the chip8 assembler i tinker with occasionally i gave it uniform precedence, too. a couple dozen people have used it, and there's been no complaint or confusion. most of the time it seems to make bit-twiddling stuff more concise and easier to follow than it would be in c, since operator precedence works against you there at least as often as it helps.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
people who use my assembler are often beginners, with little prior exposure to low-level programming. demographically, it's rather different from the usual assembly language audience.

when ken iverson developed apl notation, he spent a long time thinking about how best to introduce a precedence tower that would let all the primitives compose together in the most natural possible way. beyond the difficulty of remembering rules for 60ish primitives, he found that virtually every juxtaposition had some useful application. precedence bakes very strong assumptions about the way primitives will be used together into a language. as in your story about how c usage changed over the course of its design, this is hard to anticipate. i'm fundamentally not convinced that the mild familiarity benefits of pemdas pays for itself. familiarity is fleeting, but simple, uniform rules are easy to learn.

still, i'll broaden my horizons a bit and have a look at how swift handles precedence.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

it's not like i make it a secret that i work with goofy languages

it surprises even me that i can get paid to do this stuff, and yet here we are

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Notorious b.s.d. posted:

j/k/apl have a huge following in financials for reasons i cannot loving divine

mainly it's a combination of institutional inertia, a willingness to pay top dollar for people + software if it solves the problem at hand, and that k in particular is really loving good for rapid prototyping and iteration in its ideal ecological niche

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
the correct pronunciation is "squeal"

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
many places in the us consider "programmer", "software developer", and "software engineer" to be three ascending tiers of skill and pay grade. consultancies often like to give people "software engineer" as a title in order to justify charging clients more. it's basically just marketing puffery in those situations

i prefer to be called "developer" because while i strive to do a good job and write good code i am not liable for software failures; sort of related to why i prefer not to work on systems which, should they fail, would endanger lives

my company recently did a whole drawn out title normalization process and they decided to call us "software development engineers" which is loving ridiculous

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
some implementations of okrs create a weird game of chicken wherein you're supposed to state a goal for your metrics which you don't exceed (clearly your goal was too easy; this reflects badly) or undershoot (clearly your performance was bad; this reflects badly)

like many "agile" practices it seems like okrs breed a culture where covering your rear end and applying game theory is more important than accomplishing real-world business goals

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant libc but we want to use them to build good software. So, the libc that we give them has to be easy for them to understand and easy to adopt.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Xarn posted:

I think Python is better because Perl and Perl culture encourages terse and clever code. :colbert:

may your code pour like rivers from your fingers, drowning every reader in its impossible length, breadth, and depth
every expression, line, file, module, volume composed without the tiniest spark of cleverness
staggering in both its vastness and the gaping incuriousness of its crude construction
"given enough eyeballs, all bugs are shallow", you mumble to yourself as you repeatedly copy and paste a ten-thousand line function, "simple is better than complex"
may your verbosity blot out the sun itself

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

animist posted:

why doesn't everyone just write APL

life←{↑1 ⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}

nowadays in dyalog apl you could write

life ← U ∊⍨ ⊢∘⊂⌺3 3

the core enhancement is the use of a relatively new operator ⌺ (read "stencil") which generalizes the idea of carving up a matrix into uniform-shaped possibly-overlapping tiles, reducing over each tile, and then gluing the results back together; this makes it much easier to express the idea of a neighbor count. several interesting variations can be found here

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
fabrice bellard's new dependency-free embeddable js interpreter kinda owns

wonder how long it'll be before somebody uses it to build a javascript bootloader and begin the js apocalypse, as the legends foretold

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Luigi Thirty posted:

i'm writing a forth -> bytecode compiler in C# and a bytecode interpreter in 6502 ASM

i like forth now

forth is pretty rad. more people should try it.

do you have a particular project in mind for your interpreter, or are you just tinkering?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Luigi Thirty posted:

it's a scripting engine for an RPG

sounds like a good fit; raw speed probably isn't that sensitive, but compact bytecode is useful on a ram-limited platform.

do you have an inner interpreter, or is it just a "static" forth?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
bootin' up the MIPS

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
we get poo poo post

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
the jpl spent an obscene amount of money achieving their level of code quality because it was really loving important

lol if you think the average ibm customer from that era had a comparable desire and budget for robust code

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Nomnom Cookie posted:

where’s the history of Unix philosophy, its successes, its failures. why is programming so relentlessly forward looking

the current context is lisp, the language whose strongest exponents like to believe sprang fully-formed from the head of john mccarthy and has always had every feature ascribable to any programming language. a language which, for some, will always be a priori superior for all tasks irrespective of any measure of its fitness

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

animist posted:

lol no static types

surely a trivial exercise for the boundless capabilities of lisp's macro system

so trivial, in fact, that i shall leave it as an exercise for the reader

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
just have the unicode consortium provide a lookup table of every word in every language and then pattern match on that

easy peasy

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
the idiom in question is probably something like +\-⌿'()'∘.=

In K it would be
code:
+\-/"()"=\:
Step by step:
code:
  "add(1;sub(3;4))"                / start with a string
"add(1;sub(3;4))"

  "()"=\:"add(1;sub(3;4))"         / compare characters in a string with each of ( and )
(0 0 0 1 0 0 0 0 0 1 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1)

  -/"()"=\:"add(1;sub(3;4))"       / subtract the ) vector from the ( vector
0 0 0 1 0 0 0 0 0 1 0 0 0 -1 -1

  +\-/"()"=\:"add(1;sub(3;4))"     / take a running (scan) sum
0 0 0 1 1 1 1 1 1 2 2 2 2 1 0
The only thing that is at all exotic is having "scan" as a primitive. It's a very useful cousin of reduce.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

animist posted:

it's just numpy but every library function is a randomly-selected Unicode symbol

numpy is just apl but every library function is less general and has a longer name

optimized for people who screech in fear at "mathy" notation like + or =

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Krankenstyle posted:

why not scan once only while doing inc/dec on hitting (/)?

you could do that explicitly, sure:

0{x+-/"()"=\:y}\

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

taqueso posted:

Is there still an array language thread?

it died of inactivity just like my forth thread and my chip-8 thread :smith:

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Subjunctive posted:

I really liked your chip-8 thread, fwiw

if anyone cares, I'm still working on octo from time to time.

it's a lot fancier overall than it used to be. one particularly handy feature is that you can now export a project as a standalone html file, so it's much easier to distribute/display programs. there are also some improvements to the debugging tools, more robust support for creating programs that will work properly on a COSMAC VIP or an HP-48, and lots of small stuff

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

eschaton posted:

now write that in a pseudo lisp so it can be understood by anyone at a glance

code:
x=>x.split('').reduce((x,y,i)=>x.concat(x[i]+(y=='(')-(y==')')),[0])

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

gonadic io posted:

hasn't he used nothing but visual studio his entire life? that explains disliking ides. what does he prefer, notepad++?

he codes in emacs and uses vs for debugging

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

taqueso posted:

no, like actually good

apl has been around for nearly 60 years, my dudes

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
1337⍴⊂'buttes'

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Captain Foo posted:

all method calls are done via smtp

soon my dream of using pine as a debugger will be a reality

think mapreduce is impressive? wait till you get a load of replyallforward

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Doom Mathematic posted:

Badlang provides sophisticated shortcuts and syntax for declaring, executing and reading data out of Turing machines, instead of arithmetic operators.

on the other hand, having a primitive operator for evaluating an fsm is pretty rad

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

gonadic io posted:

objectivist oriented programming

is programming really in anyone's rational self-interest?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Soricidus posted:

comments also use a souls-inspired format and vocabulary, and other developers will randomly invade your ide

POINTER BUT HOLE

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Athas posted:

Is this inspired by APL, where the array indexing base (e.g. 0- or 1-indexed) is controlled by a global variable that can be set at any time, which libraries do and depend on?

that's the downside of a language invented by a mathematician

of course, idiomatic APL is probably among the languages least likely to use libraries at all, so often this wart is moot

if you can read someone else's APL at all you're aware of this potential landmine

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Cybernetic Vermin posted:

on another subject matter entirely: since you bothered to implement it at one point, do you know a reasonably idiomatic use of the odometer operator (in k and presumably others)?

there are simple ways to implement odometer, but you want your dialect's equivalent of base-decode: {+x\'!*/x} (k5) or {x _vs!*/x} (k2/k3)

if you just form a cartesian product, you have to make a bunch of nested lists and then flatten them back out to get the same effect; it's less direct, and it gets messier for higher dimensions:
code:
  !2 3
(0 0 0 1 1 1
 0 1 2 0 1 2)
  (!2),/:\:!3
((0 0
  0 1
  0 2)
 (1 0
  1 1
  1 2))
  ,/(!2),/:\:!3
(0 0
 0 1
 0 2
 1 0
 1 1
 1 2)
  +,/(!2),/:\:!3
(0 0 0 1 1 1
 0 1 2 0 1 2)
odometer is useful for expressing many combinatorial search problems in a single pass, rather than multiple nested iterations.

as another concrete example, here's a cute way of generating power sets from a list:
code:
  {x@&:'+!(#x)#2}`a`b`c
(()
 ,`c
 ,`b
 `b`c
 ,`a
 `a`c
 `a`b
 `a`b`c)
I don't think arthur considers odometer essential, just a convenience- it's often implemented in k rather than c. he has also been known at times to add features in his languages which make various benchmark-puzzles more elegant to express.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
code:
/ a vector of symbols- interned, atomic strings. good for dictionary keys
`a`b`c

/ curly braces enclose lambdas. x is implicitly the first argument to a lambda
  {x}`a`b`c
`a`b`c

/ unary # is count of x
  {#x}`a`b`c
3

/ binary # is take- make copies or resize a list
/ evaluation is strictly right to left unless there are parentheses
  {(#x)#2}`a`b`c
2 2 2

/ unary ! of a list is odometer- see above
  {!(#x)#2}`a`b`c
(0 0 0 0 1 1 1 1
 0 0 1 1 0 0 1 1
 0 1 0 1 0 1 0 1)

/ unary + is transpose- flip the axes of a matrix
  {+!(#x)#2}`a`b`c
(0 0 0
 0 0 1
 0 1 0
 0 1 1
 1 0 0
 1 0 1
 1 1 0
 1 1 1)

/ unary & is where- collect the nonzero indices
  &0 0 1 0 1 1
2 4 5

/ the symbol ' is each- map the operation on the left over the list on the right
  {&:'+!(#x)#2}`a`b`c
(()
 ,2
 ,1
 1 2
 ,0
 0 2
 0 1
 0 1 2)

/ binary @ is index- note that this indexes with the entire structure on the right
  {x@&:'+!(#x)#2}`a`b`c
(()
 ,`c
 ,`b
 `b`c
 ,`a
 `a`c
 `a`b
 `a`b`c)
you'd read x@&:'+!(#x)#2 aloud as "x indexed by where each of the transpose of the count of x take 2"

you have to learn K's operators before you can read it, and once you do it's very clear and comprehensible

our summer interns pick this stuff up in a few days

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

eschaton posted:

like I’m a Lisp proponent and still understand why some people initially dislike it, you do have to learn to read “through” the parentheses (same as people new to Objective-C have to learn to read “through” the square brackets)

but APL and its derivatives make intentionally-obfuscated Perl and MUMPS both look like goddamn COBOL, the only thing comparable to them in sheer opacity is loving Urbit and it was designed by a crazy bigot to be intentionally opaque and establish a priesthood

mumps is a fairly normal imperative programming language with weird looking syntax and numerous footguns because it was invented in the 1960s and still bears the scars of those early constraints

apl is an opportunity for lisp and haskell people to experience the sensation of a totally unfamiliar language again, much like the sensation that people who know python or js get when they look at something genuinely different like lisp, haskell, prolog, or forth for the first time. the dissonance between mastery of other things and the unfamiliarity of something new makes many experienced programmers shut down and stick their fingers in their ears. it rubs their egos the wrong way

for those who make it past the first filter, the second gut reaction everyone has is to try to recreate the apl primitives as a library for their favorite language, with conventional-looking spelled-out names and all the functions underloaded-apart into more specialized ones. this still misses the point. the notation is important. concise, consistent notation that reveals patterns through idioms instead of wrapping ideas in abstractions is valuable. Aaron Hsu has given some good talks about this:

https://www.youtube.com/watch?v=v7Mt0GYHU9A

the most frustrating thing about working with apls is that literally every discussion of apl online contains exactly the same knee-jerk critique, formed after scarcely a moment's contemplation of the subject

Adbot
ADBOT LOVES YOU

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Athas posted:

I like to think that my dislike of APL isn't completely knee-jerk, because I did put some effort into learning it, and even helped write an APL compiler that targeted GPUs (not co-dfns, another one). Maybe I just got stuck in the third filter, but I found lots of performance poison in APL. I do get what Iverson was going for, and I can definitely see why APL is nice for some things. Mostly I ended up being disillusioned because all the parallelism promises were hot air.

I do sometimes get the urge to properly learn one of the K dialects. Has any interesting publicly available software been written in APL, K, or J?

I think the parallelism claims for apl are sort of like the lisp claims about being "good for ai": not impossible, but mostly left as an exercise for the reader. perhaps it was more true by the standards of the day when these languages were young, but the woo has aged poorly

nick psaris has written some interesting open-source libraries in q, like his funq project that provides q implementations of a wide range of machine learning algorithms. it's mostly cool how it's possible to distill them all down to common elements and highlight similarities and differences

i haven't played with it but nick nickolov of dyalog has released ngn k, which is presumably much faster than mine and based on a more modern dialect of k than kona. my interpreter is still the only one that comes with snake and asteroids implementations, though. :)

dyalog also has some interesting examples on their site

dyalog, q, and k all being commercial products will probably forever stunt the open-source ecosystems of these languages, though. it's a shame.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply