Japanese is a head-final, strictly left branching language, as linguists might put it, which means it's structured like postfix.
This would actually let you read code strictly left-to-right (even though English speakers would be tempted to think of it as right-to-left) - when you read through functional programs, you end up reading a lot of the code right-to-left, due to function application, to see the order that code is actually executed. In postfix, the order objects/functions are written is the order they're executed.
Continuing along the lines of the post, a more Japanese programming language would also have named arguments (particles), and if it was object oriented, you wouldn't need to type 'this'/'self', since subject can be implied by context (well, it's really the direct object - the computer is the subject).
Interesting point with regards to functional programming, although it's worth pointing out that at least some functional languages have operators that allow you to do what you're describing. For instance, in F# instead of writing "f x" you can write "x |> f"
I was just thinking about that. You have to do it by hacking the infix syntactic sugar.
x |> f = f x
gives you lambda calculus, but it gets ugly, since you need to specify order of operations with parentheses.
(4 |> (5 |> (+))) |> (3 |> (*))
You can take it a step further with tuples, but you still need to be explicit about the number of arguments:
(x,y) |> f = f x y
((4,5) |> (+), 3) |> (*)
Maybe you could go almost all the way by telling it to create a List when passed two values, and telling it apply to the (nested) List when called with a List and an operator, but off hand, I can't think of a way to get it to type check, particularly not without killing currying.
I don't know Haskell very well, but I assume you're defining an |> function? If so that's pretty neat. Haskell's flexibility always impresses me. I think the F# version generally assumes one argument too, though I think you could use partial function application to work with multiple parameters.
Yes, that's right. Infix function names (anything made of symbols or delimited by backticks) are allowed on the LHS of a defining equation. An alternative syntax for this function would be this:
(|>) f x = f x
The parentheses just serve to denote an infix operator being used in a prefix way.
A type signature makes this clearer:
(|>) :: a -> (a -> b) -> b
As you can see, (|>) is a function which accepts an argument of type a, a function which takes an argument of type a and returns something of type b, and returns something of type b. In this way it's just a flipped version of the application operator ($), which has this type:
I think the brain is wired in such a way that it can handle different verb orders without reprogramming. Personally, the verb order in Japanese has never given me any trouble; combined with the way verb inflection works, I never have trouble picking out the verbs, even in the written language.
German, on the other hand, has this mechanism where verbs split and wind up with fragments stacked up the end of the sentence and that, combined with the need to master grammatical gender to answer questions like "who did what to whom?" causes me to have a much harder time parsing German, despite the use of the roman alphabet.
Cute, but the prefix notation in LISP is not purely aesthetic; it is related to the fact that lists were stored in a first-rest (car-cdr) pair structure, and thus function calls (a list including the function itself and all its arguments) could be broken into the function and its list of arguments, using mechanisms already present.
I suppose you could then define car-cdr as a last-rest pair, but there are reasons aside from linguistic ones to want the first of a list to be the prominent one.
It's more subtle than that, though. Every list has a beginning; not all lists have ends. If the 'car' semantics are "last item of the list" this is actually meaningfully different from "first item of the reversed list".
It's not meaningful at all. The list would just be constructed entirely from right to left. The "first" item in a pair would be on the right, and "car" would just mean "item on the right of a pair", or "first item in a list".
Are you also writing right-to-left, then? If everything about the system is reflected (including having a reading order of right-to-left), then you're right, it's not meaningful. But it's also not what's proposed in the OP here. When the two-dimensional text on the screen is re-formed into a linear string, it is the right end of line N that is attached to the left end of line N+1, and so the right-hand arguments of functions are "after" the left-hand arguments.
It's fun to speculate the cultural influence on a programming language design.
There was a story Dijkstra told in his "Discipline of programming" - he gave his students a task where they had to process a set of items or something like that; and most did it in left-to-right order.
The only one to work right-to-left was Syrian or Egyptian - i.e. native Arabic speaker.
What would be interesting is if Lisp were invented by the Greeks. In Greek (I believe) there is no grammatical ordering. Each part of a sentence is declined according to what part of speech it is. So a noun is formed differently if it's an object or if it's a subject. Verbs are readily identifiable as well. So a sentence can be any of SVO SOV OSV OVS VSO VOS.
In Japanese, you can mix word order freely as well---nouns are marked with particles ("ha" = topic marker; "wo" subject; etc etc). You can think of it as the nouns being declined, but with the declensions being completely regular.
These sentnces all mean the same thing ("Jim ate an apple"):
Jim-ha ringo-wo tabeta.
Tabeta ringo-wo Jim-ha.
Ringo-wo tabeta Jim-ha.
Jim-ha tabeta ringo-wo.
Ringo-wo Jim-ha tabeta.
Tabeta Jim-ha ringo-wo.
However, putting the sentences in a non-SOV order changes which which get emphasized (the same thing happens in Latin and Greek, which were also both verb-final languages by default). The SVO form of the sentence is the most neutral, plainly informative version of the sentence.
I have no idea what this comment means and it is already the highest Google hit, with all others not making any sense. Would you please care to elaborate?
Factor really needs a book or large tutorial as it is one of the coolest languages out there but you still need to read a forth book or delve deep into the provided example problems to really get into it.
Start with "To Mock a Mockingbird." One way to think about languages like Factor and Joy is that they are direct representations of Combinatorial Logic, just as Lisp and it's descendants are representations of the Lambda Calculus:
It looks a lot like Forth (a RPN language). Many years ago I worked on a hardware project to build a Forth machine specifically for running ""reversed lisp"".
Many years ago I had the luck to work on a project that involved me writing a lot of code in both Lisp and PostScript (another RPN language, although not one commonly associated with manual code generation) - there is actually quite a lot that the two environments had in common - particularly the REPL and a relatively simple set of structural abstractions.
I was just trying to make a point with the only N.E.Asian language I know anything about.
If the Japanese had used 讓 in a programming language, someone somewhere would have added 让 as an alias, which would have quickly spread. As for 井, it looks like # , which I call "hash"; again, it might have spread.
Tone of voice doesn't translate well into text---I wasn't picking on you. I was just being a nerd.
But just to be irritating, I don't think anyone would've added the alias, as inputting a kanji from an IME is as simple as choosing it from a list---and the one you want (regardless of complexity) is usually the first one on the list. It would make more sense if the language was handwritten. I heard somewhere that Donald Knuth writes his software by hand before inputting it, but I'm pretty sure he's an exception.
Yes. And as an avid HP-50g user, I wouldn't have much problem switching everything I do to postfix. After you get used to it, everything is a lot easier.
It is an interesting point the author makes concerning linguistic influence on using infix notation or prefix notation. Aside from grammar, there is really no reason to do things that way.
Consider the following sentences:
"Mix 2 eggs with 1 cup flour" (prefix)
"We ate dinner" (infix)
In both cases, the first step is to fetch the operands, being 2 eggs and 1 cup flour and "we" and dinner. Only after we fetch them can we apply the operator, to mix and to eat. Both of these sentences are carried out in postfix.
That's the way cpu instructions are executed. The read stage comes before the execute stage.
> using infix notation or prefix notation. Aside from grammar, there is really no reason to do things that way.
Even grammar isn't a reason to do things that way. In English:
"2 eggs with 1 cup of flour are to be mixed" =passive (postfix)
"Dinner we ate" =topic fronting (postfix)
Subject, verb, & object are a feature of the grammatical (transitive) structure of English. The order the nouns are introduced is a feature of the thematic structure. They're orthogonal to each other (though some combinations are less common than others). English lets us mix the two structures any way we want.
HP 42s user here. A few years ago I went to buy a second one, so went to EBay... they were going for a few hundred dollars. I bought mine for about $90 new. One of the few pieces of electronics that seems to have gone up in price.
Another HP50g user here. My friends disliked the RPN mode for the first few weeks (they couldn't borrow my calculator), but even they got used to it within 10 minutes of button mashing and errors.
Has anyone actually been able to use all of its built-in functions though?
There's no example the author gives that contradicts it, but it's not quite RPN. In Lisp, the + operator is variadic -- it can take any number of arguments. So in reverse-Lisp, this would be legal code:
It's worth pointing out that the default word order of English is SVO, and not VOS/VSO like the "word" order of LISP. Perhaps, John McCarthy is a native speaker of Malagasy?
Given that imperative sentences in English map onto function calls rather well, and also have an understood subject, I think Malagasy is an unnecessary assumption.