6 ms·
Perl6: The World's Worst ML?
- ab5tract 8y agoIt’s the worst ML because it doesn’t look exactly like Haskell? Oh, no, it’s just click baiting using an easy target.
- EdwardDiego 8y agoThe rewrite he included down the bottom from one of the Perl 6 developers is very readable, I might actually have a play with Perl 6 next time I get a moment.
- willtim 8y agoIt's certainly not as readable as the Haskell version, despite the claim to the contrary in the comments. But it's nice to see them supporting this style of programming.
- deleted 8y ago[deleted]
- EdwardDiego 8y agoSure, but for anyone with any familiarity with that style (I know it from Erlang), it's immediately clear what it does.
- User23 8y agoI used to joke that Perl5 was the worst Lisp. I think the author is being jocose.
- erk__ 8y agoYeah a bit and haskell is not even the most readable ML in my opinion sml is much more readable as it does not have as many strange symbols scattred around.
- eutectic 8y agoThere are relatively few symbols in the core language; mostly just '|', '->', '=>', '::', '=', '_', ',', lambda (\_ ->) , and brackets, but people do sometimes go over the top with operators.
- Aearnus 8y agoWhile I won't deny that using an eye catching title like that got me more clicks, I was trying to joke around with regards to Perl 6's flexibility. It's the worst ML because it's not an ML at all -- but it has the impressive ability to be able to emulate the behavior of one.
- snapdangle 8y agoConsidering the amount of crap that is heaped on Perl 6 for even daring to exist, maybe in the future you might consider using language that highlights something that you find impressive. Otherwise it comes off as more cheap shots. Thanks for adding your comment, though! It helps :)
- tootie 8y agoI thought this was sarcasm. Both code snippets are gibberish to me.
- f055 8y agoTo put it a bit over the top: In every other language you write code. Perl is magic and you write spells. It suppose to be this way, because the way it works is sorcery. I don’t know about you, but I always wanted to be a wizard, not a typist.
- rat87 8y ago> In every other language you write code. Perl is magic and you write spells. Really? Every other language? https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-9.html#%_chap_1 https://mitpress.mit.edu/sites/default/files/sicp/full-text/... > The evolution of a process is directed by a pattern of rules called a program. People create programs to direct processes. In effect, we conjure the spirits of the computer with our spells. > A computational process is indeed much like a sorcerer's idea of a spirit. It cannot be seen or touched. It is not composed of matter at all. However, it is very real. It can perform intellectual work. It can answer questions. It can affect the world by disbursing money at a bank or by controlling a robot arm in a factory. The programs we use to conjure processes are like a sorcerer's spells. They are carefully composed from symbolic expressions in arcane and esoteric programming languages that prescribe the tasks we want our processes to perform. > A computational process, in a correctly working computer, executes programs precisely and accurately. Thus, like the sorcerer's apprentice, novice programmers must learn to understand and to anticipate the consequences of their conjuring. Even small errors (usually called bugs or glitches) in programs can have complex and unanticipated consequences. > Fortunately, learning to program is considerably less dangerous than learning sorcery, because the spirits we deal with are conveniently contained in a secure way. Real-world programming, however, requires care, expertise, and wisdom. A small bug in a computer-aided design program, for example, can lead to the catastrophic collapse of an airplane or a dam or the self-destruction of an industrial robot. ... > The dialect of Lisp used in this book is called Scheme.
- webreac 8y ago"we conjure the spirits of the computer with our spells" is one of my favorite quotes about computers with "Computer programming is an art form, like the creation of poetry or music" (Donald E. Knuth)
- ericls 8y agowhat is ML?
- randallsquared 8y agohttps://en.wikipedia.org/wiki/ML_(programming_language) https://en.wikipedia.org/wiki/ML_(programming_language)
- lucb1e 8y ago> ML (Meta Language) is a general-purpose functional programming language. --- Your comment would have been more useful with a short citation, but nevertheless, thanks! I didn't expect to be able to find that on Wikipedia (I assumed it was 'multi threaded language' or so). So ML is a functional language. Apparently functional languages are not quite obscure enough, we need more words and abbreviations for things!
- NikkiA 8y agoMeta languages normally imply that you can program the language syntax itself via an extensive macro system. But then, I'm not sure perl has that facility at all.
- bmn__ 8y agoIt does. It's small and hacky, but powerful enough to do things like http://p3rl.org/Moops http://p3rl.org/Moops
- Expert-007 8y agoThe term "meta-language" shouldn't be used to identify a specific language; it's a general term for a language that describes or manipulates another language(s). For instance, the rules language for XTRAN, our Expert System, is a meta-language, and we call it "meta-code", because it manipulates many different computer languages (including itself!), as well as data and text. A well-known ML example is Backus-Naur Form (BNF), which is a meta-language for specifying well-formed statements in a language. We use BNF to drive XTRAN's parsing engine, which executes the BNF at parse time.
- JadeNB 8y agoSince it's a Perl article, can we golf? Just as Conway shows that we can re-write the Perl, also the Haskell can be re-written. In general, manually dispatching by pattern matching on a `Maybe` type I think indicates that you should be using `maybe`; I would want to replace print_maybe :: Show a => Maybe a -> IO () print_maybe (Just m) = print m print_maybe (Nothing) = putStrLn "nothing" by print_maybe = print . maybe "nothing" show
- Aearnus 8y agonot quite the same as what I wrote -- it would be more akin to: print_maybe = putStr . maybe "nothing" ((++ "\n") . show) or maybe something like: print_maybe c = c >>= (\d -> print d >> putStr "\n") but that's already too long to finish
- JadeNB 8y agoAccording to https://hackage.haskell.org/package/base-4.12.0.0/docs/Prelude.html#v:print https://hackage.haskell.org/package/base-4.12.0.0/docs/Prelu... , `print` already appends a newline, so I think that `print m` is not the same as `putStr $ show m` and hence that the refinements you suggest are unnecessary.
- b2gills 8y agoIf we are going to golf, here is a small Perl6 version: sub print-maybe ( $_ ) { say $_ // "nothing" } Or to translate your code: my &print-maybe = { say $_ // "nothing" } Of course both of the above take advantage of all Perl6 types being Maybe types already. (Think of defined-or `//` as having a slightly different slant to it than `||`.)
- grawprog 8y agoIt's been a while since I played with Perl. I haven't looked at Perl6 at all. But reading Damian Conway's addendum at the bottom, really makes me want to play around with it. Mostly this: >Ultimately, I think that we’re pretty happy with Perl 6 being the “World’s Worst ML”, so long as it can also (simultaneously) be: the “World’s Worst Smalltalk”, the “World’s Worst Lisp”, the “World’s Worst Snobol”, the “World’s Worst QCL”, the “World’s Worst Erlang”, the “World’s Worst Prolog”, the “World’s Worst Python”, the “World’s Worst C”, and even the “World’s Worst Perl 5”. Because that was one of our design goals too. :-)
- thanatropism 8y agoWait what prolog?
- aggerdom 8y agoSimilarity that jumps out to me is that both include a large degree of support for grammars.
- deleted 8y ago[deleted]
- kkylin 8y agoSometimes I feel my only purpose here is to repost xkcd: https://xkcd.com/224/ https://xkcd.com/224/
- lostmyoldone 8y agoAt least as good a purpose as any other. I would even go as far as claiming it as one of the finer purposes one can have. Using ones abilities selflessly in a way that helps bring a smile peoples faces is one of the finer aspect of humanity, at least if you ask me. Myself I mostly write too long, slightly dry comments that get mostly ignored, or entirely misunderstood. Or so it seems at times. On the positive side, I feel I'm getting to the point a bit quicker, and with less triple negatives these days, any time now I might even get my point across in less than a few hundred words. Compared to you that get it across in 9 words, and the odd dozens of syllables, I still got ways to go!