6 ms·
Pure: a modern functional programming language based on term rewriting
- spraak 9y agoI wish it were modern enough to have a proper mobile site...
- hossbeast 9y agoIs there an example of a problem where Pure would be a good choice of language in solving that problem?
- blacksqr 9y agoFrom the FAQ: Why Pure? Thanks to LLVM, Pure offers state-of-the-art JIT compiler technology in an interactive environment, and makes it easy to interface to C in a direct fashion. Recent releases also provide the ability to directly import LLVM bitcode modules into Pure scripts and to inline code written in various languages (currently C/C++, Fortran and Faust). Scripts can also be compiled to standalone native executables (they are also executed during compilation, which makes it possible to employ partial evaluation techniques). Pure has an efficient MATLAB-like, GSL-compatible matrix type which makes it easy to interface to languages and libraries for doing numeric computations and digital signal processing. In particular, Pure interfaces to (GNU) Fortran, Octave and Grame's Faust, and you can directly invoke GSL routines on Pure matrices. In a way, this is like having Haskell, Octave, DSP programming and the term rewriting capabilities of a computer algebra system under one hood. It goes without saying that Pure can be used used for mathematical applications, but there's also a growing collection of extension modules for GUI, graphics, multimedia, database and web programming which makes Pure useful as a kind of algebraic/functional scripting language for a variety of purposes.
- 59nadir 9y agoI don't think this really does a great job of selling Pure as a solution to a problem. It's sort of saying "Well, you can kind of use Pure for anything, even GUIs!". I'm sure there's something Pure was designed to solve which could be brought forward as something it solves beautifully. It's not really obvious what that is from this text, though.
- rmbeard 9y agoFor me the symbolic math capabilities are interesting. I'm not sure I like the choice of reduce that much, but still few languages offer symbolic capabilities. Python does with SymPy and Maxima is based on Lisp but that's moe a case of a CAS being based on a language than the language having symbolic capabilities and then there is Mathematica (expense being the barrier).
- rurban 9y agoOnline, dynamic music synthesis. pure comes from pd I think, puredata, which has as default an unoptimized graphical language. pure can deal with real-world musical problems much better.
- sehugg 9y agoWhat's up with Clean these days? https://en.wikipedia.org/wiki/Clean_(programming_language) https://en.wikipedia.org/wiki/Clean_(programming_language)
- fusiongyro 9y agoI haven't heard mum about it since 2006. Wikipedia says the last stable release was in 2011. I guess the market for proprietary Miranda derivatives fell apart after _Real World Haskell_ was published?
- srean 9y agoI wish Clean caught on more. I find unique types a little easier to think about. A version of Clean could/can(?) compile Haskell too. If I recall correctly, Clean is BSD licensed. By 'proprietary' do you mean their main source of funding was building proprietary solutions over what they release open source ? They did seem they were more of a 'windows first' group, but I may be wrong about that.
- maartenh 9y agoFrom what I've heard in the hallways, the people driving the language from the Radboud University retired.
- Nokinside 9y agoNothing it seems. Too bad. Clean's graph rewriting and unique types approach was very good and practical direction for functional programming. Declaring unique types allows functional paradigm in much lower lever programming and it's easy to grasp. (it's part of the linear types paradigm).
- squiggleblaz 9y agoI don't think I've come across term-rewriting before. There's an example in their wiki page for inserting into a BST: > nonfix nil; > insert nil y = bin y nil nil; > insert (bin x L R) y = bin x (insert L y) R if y<x; > = bin x L (insert R y) otherwise; > foldl insert nil [7,3,9,18]; bin 7 (bin 3 nil nil) (bin 9 nil (bin 18 nil nil)) Lines beginning with > are what you type; the extra line is the evaluated response. So the language is dynamically typed and it seems you don't need to declare constructor symbols that take arguments. A constructor seems to be something that is irreduceable according to the rules already defined, whereas a function is something with reduction rules available. I'm not sure I agree with the rationale for the dynamic typing. The designer says it means the language supports an arbitrary degree of polymorphism, but obviously it means it accepts invalid programs with undefined behavior. I think by adopting a Typescript style system you'd get huge advantages ("Typescript-style" meaning structural, adhoc and evolving towards correctness, rather than meeting the wrong design constraints upfront). But I'm still not at all sure my intuitions for this language are useful. Anyway that's my review in five minutes. I hope someone writes something relevant here.
- deleted 9y ago[deleted]
- fusiongyro 9y ago> but obviously it means it accepts invalid programs with undefined behavior. Congratulations! This is the most entitled sentence in all of computing. The prize ceremony will be held at your house, tomorrow. I'll be casting a statue of gold for you, but first I have to rebuild all the software between me and the CNC machine in Coq or Typescript.
- 59nadir 9y agoOn a barely related note: When did Typescript's type system become some shining example of type systems? It's super basic and you can do almost nothing with it. It's not as basic as Go's type system, but it's really very sparse.
- jorgec 9y agoNEEEEERD! As a instructor, i usually use the Fibonacci number as an example: an example of futility, or how programming is hard if you are teaching it in the hard way. Fibonacci example is overly complex, people don't understand it, or its usable. I remember that i spend years in the university with those examples (and lots of math), to find that the real world is completely different. If you want to lure programmers then you will need a better bait.
- c3534l 9y agoThe Fibonacci sequence is an obviously toy example. No one seems to use it for any practical purpose, but the same can be said of most functions named Foo and Bar.
- unlmtd 9y agohttps://dwm.suckless.org/patches/fibonacci/dwm-fibonacci-5.8.2.diff https://dwm.suckless.org/patches/fibonacci/dwm-fibonacci-5.8...
- chenglou 9y agoThis is pretty neat! https://github.com/agraef/pure-lang/wiki/Rewriting#constructor-equations https://github.com/agraef/pure-lang/wiki/Rewriting#construct...: > As a bonus, you also get "constructors with equations" for free. E.g., suppose that we want lists to automagically stay sorted and eliminate duplicates. In Pure we can do this by simply adding the following equations for the : constructor: > x:y:xs = y:x:xs if x>y; x:y:xs = x:xs if x==y; > [13,7,9,7,1]+[1,9,7,5]; [1,5,7,9,13] (The point about this global override is addressed later. The rewriting can be lexically scoped.)
- otabdeveloper2 9y agoIsn't this basically bubble sort?
- cordite 9y agoNo, the sources must be pre sorted for this to work. What this does is merge two lists of dynamic size like a set like a zipper.
- deleted 9y ago[deleted]
- fmap 9y agoIf you build such a list by consing new elements to the front, then it's insertion sort. If you build the list from a balanced binary tree it's merge sort. --- One important difference between this and quotient-inductive types is that there are examples of "types with equations" which cannot be expressed as a rewriting system, e.g., free groups. It's a still a cool feature to have this built into the language.
- amelius 9y agoIsn't just about any functional language based on term rewriting? E.g. beta reductions, combinators, etc.
- goldfeld 9y agoYes. The website beats around the bush before stating that actually most functional programming languages are just like this (possibly more interesting too, shh).
- justinpombrio 9y agoCompare to: Maude https://en.wikipedia.org/wiki/Maude_system https://en.wikipedia.org/wiki/Maude_system
- BoiledCabbage 9y agoMaude is a truly fascinating language. Its base computation model (no true operation order and pure term rewritting) is extremely innovative, and I've never seen another language like it. While not a production ready language, I'm really surprised it or something like it doesn't get more attention.
- johnxxxxxxxxxx 9y agoFrom 8 years ago: https://news.ycombinator.com/item?id=722580 https://news.ycombinator.com/item?id=722580