9 ms·
The Egison Programming Language
- mapcars 8y agoLooks like a lisp dialect, why is it a separate language?
- vosper 8y ago> Egison is a programming language that realizes non-linear pattern-matching against non-free data types. It's a what? Can someone ELI5 this for a lowly Python and JS dev - why would I want this? ---- I watched a talk about Scala's future [0] recently, in which the presenter compared the taglines of a few different languages (Go, Rust, Erlang, Scala), and how they relate to business pains or non-academic problems. His conclusion about Scala's tagline - "Scala combines object-oriented and functional programming in one concise, high-level language" is that "no engineering manager in the history of software development ever thought to themselves 'hmmm, if only I had a language that fused OO and FP, I'd be able to solve my business problems'. That hasn't happened; that will never happen. This is an academic novelty that has zero relevance to any of us as professional software developers [...] this is not a business pain, this is an academic interest." I felt a little bit like that when I read Egison's tagline: why should I care about this language? [0] "The Last Hope for Scala's Infinity War" https://youtu.be/v8IQ-X2HkGE?t=15m8s https://youtu.be/v8IQ-X2HkGE?t=15m8s
- lliamander 8y agoScala's mistake is ostensibly that it is an academic language trying to pitch itself as a language for building business applications. Egison appears to be a self-consciously academic language, which strikes me as a perfectly legitimate. In particular, the goal seems to be to provide a more intuitive way of writing algorithms using extensible pattern matching. Now, I have worked on commercial software that has highly algorithmic parts (graph traversals, etc.) written in Erlang (a language that supports a powerful, but not extensible, form of pattern matching). I found the pattern matching facilities to be quite helpful in producing readable, concise, correct code. The use case is narrow, but strikes me as real nonetheless.
- the_af 8y ago> "Scala's mistake is ostensibly that it is an academic language trying to pitch itself as a language for building business applications." It's a bit subtler than that. Scala is an industry programming language perfectly suited to business applications, but with a big academic and research input (remember that Odersky, its creator, was a big contributor to Java, an industry language) and with an initial emphasis on research. The mentioned talk is criticizing Scala's marketing blurb because it was written almost entirely from a research angle, and doesn't accurately and convincingly portray Scala's benefits for business. See the revised blurb at the end of the talk [1]. It's a question of being clever about marketing. ---- [1] revised blurb: "Scala is an open source programming language that helps you write correct code and modify code safely, while seamlessly reusing existing JVM libraries."
- vvillena 8y agoAs a Scala dev, one issue I see with the language is that it doesn't keep you in check. Easy things are easy and there are lots of syntax sugar and little conveniences here and there that make the language great, but the advanced features are just as accesible to the developer. You need self-restraint when doing Scala, there is a real risk of losing perspective and getting distracted with fancy features and libraries.
- tormeh 8y agoIt requires taste or code reviews, essentially.
- rs86 8y agoI have the same feeling. It is a very powerful and interesting language from my anecdotal experience, but I also feel it gives too much options to use
- egi 8y agoWhich syntax sugar do you think verbose? I don't think Egison has lots of syntax sugar.
- egi 8y ago
- throwawayjava 8y ago> It's a what? Can someone ELI5 this for a lowly Python and JS dev - why would I want this? Nah, but I can ELI a person with some programming experience. Pattern matching is super useful for writing code that spends a lot of time building and deconstructing syntactic data structures. Non-linear pattern matching is useful when de-constructing large-ish expressions that might contain multiple occurances of the same sub-term. Nonfree datatypes allow you to encode some constraints about your datatypes; e.g., "lists that are equal modulo permutation". Supporting type-checked non-linear matching over nonfree datatypes allows you to encode a lot of constraints in the type system and syntax that would otherwise be encoded with lots of nested if-statements and only checked by tests, not by static type checking. This combination of features could be very useful when implementing a lot of mathematical code that operates over algebraic structures. Which is why the language's homepage mentions the implementation of (features for) computer algebra systems as a sort of killer app. > this is not a business pain, this is an academic interest Not all innovation is motivated by the business pains of today's engineering managers. And often the solutions to those pains are not recognizable; e.g., thousands engineering manager in 1950 could've beneifted from CAD software but I bet very feew were sitting around saying "I could really use a good piece of CAD software right now". Scala is another good example of that, despite a marketing complaints about messaging. No one asked for FP+OO, but Scala took off because the combination of FP and OO solved a lot of the pain caused by Java. Substantially improving the ease of implementing new types of computer algebra systems could easily create a lot of business opportunities e.g. in providing improved analysis/synthesis tools for all sorts of CAD tools. that said, I don't think this language hits the target. See the hodge operator example...
- vosper 8y agoThanks for making the effort to explain, I think I have a better handle on what it means now.
- madmax96 8y agoI think you're right - this is an academic language. That doesn't mean it's devoid of value, it's just not meant to solve industrial problems. Instead, it's supposed to experiment with a new paradigm so that other (more pragmatic) languages can someday incorporate some of its ideas.
- qop 8y agoScala has always nurtured that ridiculous notion that an animal that's 50% cat and 50% dog would appeal to both cat-lovers and dog-lovers, which doesn't actually make any sense. This language is clearly an academic endeavor. Disclaimer: I don't know what non-linear pattern matching on non-free data means either, but the fact that it's not explained to me is proof enough they aren't meaning to cater to non-academic users.
- nikofeyn 8y agointeresting about the math integration with tensors and differential forms. gonna have to read the linked paper.
- egi 8y agoThank you for your interest! Here is a link for a new paper that discusses the integration of tensor index notation including the support for differential forms. https://arxiv.org/abs/1804.03140 https://arxiv.org/abs/1804.03140
- carapace 8y agoThis seems very interesting, I have only just skimmed it so far. Am I wrong in thinking this might relate to (representations for) Geometric Algebra?
- amckinlay 8y agoThis looks like an intruiging alternative to Julia. Last time I tried Julia, effecient multidimensional code generation was incomplete due to required work in the type system. I wonder how Egison's performance matches it's expressiveness.
- eigenspace 8y agoWhen did you last try julia? Things are looking pretty great these days.
- nerdponx 8y agoExpress Intuition Directly with Essentially New Syntax Egison makes programming dramatically simple! (define $twin-primes (match-all primes (list integer) [<join _ <cons $p <cons ,(+ p 2) _>>> [p (+ p 2)]])) Uh, ok?
- nine_k 8y agoIt helps if you remember that $primes is a list of primes, and <...> is pattern-matching. So what it does is matching of such elements (named p) that the next element (see cons) equals p+2, which would be a twin prime, since p is a prime. Then it generates an element consisting of a pair [p, p+2]. The pattern apparently matches such a list comprised of elements (see <join ... >) that are [p, p+2] (the inner <cons ...>). You definitely remember that Lisp lists are singly-linked lists, and (cons head tail) prepends a new head element to the list tail. This is why it is matched, pertty similarly to how it's done in Haskell.
- sp332 8y agoOh, I thought it was doing some kind of prime search. But you have to give it a list of primes to start with? How about one of: print [(x,x+2) for x in primes if (x+2 in primes)] print [(x,y) for x, y in zip(primes, primes[1:]) if x+2 == y] The simpler one doesn't even require the primes list to be sorted, so I thought the second one would be more equivalent. It's still a lot easier to read and write than Egison one.
- nine_k 8y agoYour first snippet has quadratic performance. The second is closer to the idea. Pattern-matching would be even more obvious is a piece of Haskell: pair :: [x] -> Maybe (x, x) pair p:q:rest = if q = p + 2 then Just (p, q) else Nothing pair _ = Nothing findTwins primes = [x | x <- map pair primes] I suppose that Eigson's power lies in matching of more complex structures, as they mention non-linear matching, matching with multiple results, matching with lexical scoping.
- bcheung 8y agoI love how it matches so much more. It would take me some time wrap my head around the new possibilities. I doubt I have time to learn this or use it but it would be cool to see a list of examples of things that are much more concise and elegant in this language so that it expands my thinking. Is there a list of examples with comparisons to traditional languages?
- Pica_soO 8y agoIs there a academic language which focuses solely on performance and optimization- by building the program and data structures around the hot-loop and optimal cache usage? Something Mike Acton would create if he wrote compilers?
- carapace 8y agoA language called "Spiral" went by yesterday, that I think does a little bit of that. https://news.ycombinator.com/item?id=17519138 https://news.ycombinator.com/item?id=17519138
- kamyarg 8y agoYour syntax is bad and you should feel bad. Mandatory XKCD: https://xkcd.com/297/ https://xkcd.com/297/
- chenglou 8y agoI’ve been casually following Egison for a while now. Its customizable pattern matching is really cool. Unfortunately I do think the lisp syntax does turn some folks off; whether this set of folks overlaps with those who would be interested in Egison otherwise, is another question. I’ve also noticed that it “pivoted” to focus more on math; is that intentional? Anyway, good to see it on HN again. Anything that pushes more pattern matching research is a plus for me =). Mainstream languages barely started to adopt first-order pattern matching!
- egi 8y agoThank you for your comment! I started to implement a computer algebra system as a killer application of customizable pattern matching of Egison. It allows users to customize the pattern-method for mathematical expressions from more primitive level than the other computer algebra systems.