4 ms·
It's more concise, which has value. In particular, think about how maths really consists of packing more and more concepts into higher level definitions. This i
by maest 3y ago
It's more concise, which has value. In particular, think about how maths really consists of packing more and more concepts into higher level definitions. This is similar: higher level concepts become primitives and allow you to think faster and build more complex objects.
- andoando 3y agoI can see that, though it really depends on what these abstractions are, how complete they are in solving in a variety of problems, or I suppose, how frequent the problems it makes easier in relation to ones it makes harder. I’d have to know a lot more and spend a lot of time before judging. But I am not impressed seeing a single example. I could hypothetically write a language where mergesort is the operator * and reversing an array is the operator + and showcase how in my language 30 lines of code becomes 1. That would be insanely nice if you’re doing something which just requires thinking about sorting and reversing arrays but all together, very poor thing to build a standard language on.
- jodrellblank 3y agoThat's what people do on codegolf.stackexchange.com with the dedicated golfing languages. What's interesting about APL is that it started out as linear algebra and became array programming, and the primitives are more "things which are useful transforms to do on arrays" rather than "thing people wanted to do in one problem turned into a symbol", and that's enough to be useful in many tasks. > "That would be insanely nice if you’re doing something which just requires thinking about sorting and reversing arrays but all together, very poor thing to build a standard language on." Prolog has linked lists as its main data structure, which means prepend is more performant than append. In the SWI Prolog documentation for foldl[1] it says "No implementation for a corresponding foldr is given. A foldr implementation would consist in first calling reverse/2 on each of the m input lists, then applying the appropriate foldl. This is actually more efficient than using a properly programmed-out recursive algorithm that cannot be tail-call optimized". i.e. you don't have to have a problem which involves reversing arrays, for reverse to be a useful part of a solution. In APL reverse is one character ⌽. In C# to find the first comma in a string you use IndexOf(',') and to get the last one you use LastIndexOf(','). In APL you would use the equivalent of indexOf(Reverse(string)) and then you wouldn't need the specialised LastIndexOf - and wouldn't every other function which works from the left of a string or array to have an equivalent which works from the right. https://aplcart.info/ https://aplcart.info/ is a database of idioms and samples of useful APL and it has 168 pieces of code using ⌽. [1] https://www.swi-prolog.org/pldoc/man?predicate=foldl/4 https://www.swi-prolog.org/pldoc/man?predicate=foldl/4