HNHacker News
TopNewBestAskShowJobs

abathologist

595 karma · joined November 18, 2014

I am interested in functional programming and logic programming and have a background in philosophy.

Find me at http://shonfeder.net/

submissionscomments
abathologist··on The perfect programming language
Yeah, that's my point. Contrary to the claim in the post I'm replying to, it seems clear that having the ability to do unsafe impure things in a language doesn't mean users of that language "loose all ability to reason reliably". To the extent that the libraries and the ecosystem doen't make inappropriate use of unsafe behavior, you can have your impurity and reliable referential transparency too.
abathologist··on The perfect programming language
> The moment you allow imperative behaviors to leak into a declarative system it loses its ability to reason reliably about operations over time; and you’re back to flying seat-of-your-pants a-la C &co

By your (imo, extremist) line of reasoning, wouldn't the existence of `unsafePerformIO` mean Haskell itself "looses its ability to reason reliably about operations over time"? I think a more reasonable position allows for gradations of reliability, and appreciates the benefits of encouraging pure computations while allowing room for judicious use of benevolent side effects.

> they are already evolutionary dead-ends

That is patently false, imo. OCaml has a number of interesting features which most statically typed FP languages are yet to explore (e.g., polymorphic variants, (typed) named and optional arguments, first-class modules, binding operators). More to the point, ongoing development on a novel approach to multi-core, native support for algebraic effects, and modular implicits, testify to it being a live evolutionary branch. OCaml aside, innovative languages and approaches like like F, 1Ml, Frank, BER MetaOcaml, and Rust seem to give clear evidence that we still have much to learn from impure* dialects of ML.

abathologist··on A Tiling Desktop Environment
I installed the [i3 edition of Manjaro](https://manjaro.org/download/i3/) last weekend. I was up and running with a beautiful environment providing most of the listed utilities in an hour or so. I have been incredibly happy with the setup.

The edition could still use some more love (e.g., I had to set up auto-mounting and HiDPI compatible configs myself), but it is remarkably cohesive and (relatively) easy to get going.

There is definitely room for improvement, but this is probably a good place to look or inspiration, and contributing to advance this work might be a good use of energy for those interested.

abathologist··on Buck: A high-performance build tool
Building and deploying software is an unsolved problem and this bottleneck becomes increasingly costly and painful as the digital revolution accelerates.
abathologist··on Kwm, tiling window manager for OS X
Does this mean you've installed and are using it? Does it feel more responsive?
abathologist··on Kwm, tiling window manager for OS X
I'd be curious to know how this software compares with Amethyst. I've also been using Amethyst for some time with no problems, but it is sometimes a bit sluggish. I have so far assumed this has more to do with unavoidable limitations in the OS X gui ecosystem. It is written in Objective-C, is available on homebrewa and has a binary distribution available, provides a gui configuration manager, and seems to include all features claimed by kwm—including focus follows mouse. But if I knew how the two projects differ and, in particular, what kwm provides (or plans to provide) that Amethyst doesn't, I might consider giving it a shot.
abathologist··on Kwm, tiling window manager for OS X
Yes, the license is an MIT license.
abathologist··on Learn Prolog Now
What sort of library support have you found wanting? While the Prolog ecosystem is admittedly tiny compared to mainstream languages, I have often been surprised by the amount of useful libraries available.

I love Prolog syntax. I do think there is room for improvement, but the language is also extremely flexible, and it is very easy to roll your own syntax. Funny enough, so far my many experiments with alternative syntax have mainly had the effect of convincing me of the elegance and power of standard Prolog syntax.

While there is no particular reason the '.' should be used to terminate statements (except the resonance with many natural languages in this regard), I think some sort of terminator is necessary to keep the syntax as flexible as possible. Like Lisp, Prolog syntax is isomorphic to its AST. Currently my main gripe with Prolog syntax is that it represents conjunction and delimitation of predicate arguments and list items with the same operator, `(,)/2`. However, that can be fixed in two lines:

    :- op(1000, xfy, user:(&)).
    A & B :- A, B.
But I'm not sure it really needs "fixing"...

Regarding, "batching up a bunch of attributes into one conceptual 'thing'": SWI-Prolog has implemented a special data structure it calls "dicts"[dicts] for this purpose, but I am not very fond of it (and there's a fair amount of concern over the way this implementation breaks compatibility with ISO standards). More traditional solutions are to use lists of "pairs"[pairs], option lists[option], or, for larger data structures and when performance and lookup time is an issue, association lists[assoc] or records[records]. Using the first of these techniques looks like this:

    my_foo(a, [bar-Bar, baz-Baz]) :-
        Bar = something,
        Baz = something_else.
    
    get_attr(Pairs, Key-Value) :-
        member(Key-Value, Pairs).
    set_attr(Pairs, Key-Value, NewPairs) :-
        ( select(Key-_, Pairs, Key-Value, NewPairs), !
        ; NewPairs = [Key-Value|Pairs]
        ).

    ?- my_foo(a, As), get_attr(As, baz-X), writeln(X), set_attr(As, boz-another_thing, Bs), writeln(Bs).
    something_else
    [boz-another_thing,bar-something,baz-something_else]
    As = [bar-something, baz-something_else],
    X = something_else,
    Bs = [boz-another_thing, bar-something, baz-something_else].
It might be the case that Prolog's flexible syntax leaves it spoiled for choices here... That being said, it would be straightforward to implement syntax similar to your description, which evaluates and replace attribute accessors in place, using `term_expansion/2` and `goal_expansion/2`. Then you could use `As.baz` in place of the value itself (I've done so before, and this is what the SWI-Prolog's dict expansion does). Even easier, you could use Michael Hendricks' func package[func] to make a function for this purpose. But I've increasingly come to think of Prolog's explicit evaluation as a unique strength rather than a problem to be solved.

[dicts]: http://www.swi-prolog.org/pldoc/man?section=dicts

[pairs]: http://www.swi-prolog.org/pldoc/man?section=pairs

[option]: http://www.swi-prolog.org/pldoc/man?section=option

[records]: http://www.swi-prolog.org/pldoc/man?section=record

[func]: http://www.swi-prolog.org/pack/list?p=func

abathologist··on Learn Prolog Now
You might be interested in these SO answers regarding "Real world Prolog Usage": http://stackoverflow.com/questions/130097/real-world-prolog-... The answers are replete with claims about good use-cases for Prolog.

Michael Hendricks' talk at last year's Strange Loop on "Production Prolog" gives an excellent high-level survey of the uses, advantages, and drawbacks of Prolog: https://www.youtube.com/watch?v=G_eYTctGZw8

BTW, I have played a tiny bit with Flora2 myself. It seemed really neat. If you're interested in the intersection of OO and Prolog, you may also want to look at Logtalk[0]. FWIW, if I understand your meaning correctly, it is very easy to "pass rules as parameters to other rules" in vanilla Prolog. It facilitates all sorts of higher-order approaches and is very good for meta-programming.

[0]:http://logtalk.org/

abathologist··on Learn Prolog Now
Have you used any of the numerical constraint solving libraries available for many Prolog implementations?[1] (It is also worth noting that Turbo Prolog is a rather peculiar—and now rather old—take on Prolog. I believe it has been superseded by Visual Prolog).

[1]: e.g., SWI Prolog's http://www.swi-prolog.org/pldoc/man?section=clpfd, or http://www.swi-prolog.org/pldoc/man?section=clpqr

abathologist··on Monoids, Functors, Applicatives, and Monads: Main Ideas
That makes sense. Your points are well taken. Also, in retrospect, I realize that my reply wasn't helpful for the discussion at hand.
abathologist··on Monoids, Functors, Applicatives, and Monads: Main Ideas
I find that talk really painful. I do not recommend it. It is mean spirited, full of misleading characterizations, and - I think - it misses the core point of functional programming. Gary Verhaegen's comment "this was a waste of time" addresses the many problems effectively. Brian Craft's "ugh" addresses others. Either of those comments are more worthwhile than the video itself.
abathologist··on Isomorphic JavaScript with React and Node
In light of my previous reply, I wonder why you think appropriation of terms is okay going one way but not the other. It really seems a bit like bullying. Why can't the weird kid call itself whatever the weird kid chooses? It seems like the job of a bully to say "no way twerp, you can't use 'The Chief', that's only for cool kids to use". I don't know why you'd willingly take on that role.
abathologist··on Isomorphic JavaScript with React and Node
I don't think the "it already had an established meaning" argument is very tenable, especially not when we're talking about mathematical terms. Maths freely borrows terms that have very well established meanings. E.g., "category" has an ancient and well established meaning, but that didn't stop it from being appropriated for "category theory". Category theorists also seem to have appropriated the term "categorical" even though it has a very specific and firmly established meaning in logic. "Functor" was appropriated from an established term that was in use by logicians and linguists. "Topology" was taken over from botanists. Categorial "Monads" have nothing to do with Leibniz (that I can tell), nor "arrows" with everyday arrows of any sort, and the wikipedia article on category theory even begins with the following caution:

>Several terms used in category theory, including the term "morphism", differ from their uses within mathematics itself

There may be other aspects of the appropriation of sexy math terms which you find problematic, but the mere act of borrowing established terms doesn't seem problematic in its own right.

fwiw, I don't like JavaScript and I am interested in and partial to mathematically and logically grounded languages. otoh, I don't care what names JS developers give to their constructs either.

abathologist··on Where FP meets OO
I bet "referential transparency" was meant. It would make sense as a replacement for "referentiality". oops :(
abathologist··on Where FP meets OO
(Too late to edit, but, in the last line, s/always/also).
abathologist··on Where FP meets OO
I bet "referentiality" was meant. It would make sense as a replacement for "homoiconicity".
abathologist··on Where FP meets OO
> they are a type system feature and have nothing to do with FP

I suggested in a sibling reply that the use of type-theoretic notions in FP is a natural out growth of the initial motives of the FP paradigm. While I wouldn't think that FP languages must incorporate type-theoretic notions, it does seem to me fitting that many would, since type systems have been involved with the functional understanding of computation since quite early on. Do think that line of reasoning make sense?

abathologist··on Where FP meets OO
I'm not an expert or professional, but I'll offer some few cents here.

I think your feeling that the "goalposts have moved" is a result of mistaking 'Functional Programing' as the name for a set of language features. Instead, I understand FP to designate a far reaching paradigm encompassing language design, computer science research, and the design and development of particular programs.

As I understand it, the initial motive for FP was the development of an elegant, mathematically grounded programming style in which the human readable forms of expression neatly reflect the underlying computational model. This is evident in John McCarthy's 1962 "A basis for a mathematical theory of computation"[0], where he presents

> a formalism based on conditionals forms and recursive functions whereby the functions computable in terms of certain base functions can be simply expressed.

The same principles seem to persist right through to the current wikipedia article on FP:

> In computer science, functional programming is a programming paradigm, a style of building the structure and elements of computer programs, that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.

Of course, over the course of 50+ years of ongoing research into FP, and roughly 80 years of research into the functional expression of mathematical foundations, there have been lots of developments and plenty of emergent insights that have altered the reigning implementations of FP languages. The fact that OO languages can keep incorporating features that emerge in FP languages is simply a testament to the fertility of the paradigm.

The advent of type-theoretic constructs (like higher-kinded-types) in FP is directly related to the central motives and inspirations of FP. It continues to draw inspiration from developments in maths. Contemporary FP incorporating ideas from type-theory is just like LISP incorporating ideas form the lambda calculus. Since both FP is an ongoing research and design paradigm, the features and approaches associated with it continue to develop. And unless the implementation of FP languages ever overtakes the ongoing research into functional foundations of mathematics, FP will continue to incorporate findings that emerge in the latter.

I may be mistaken, but I don't believe homoiconicity was ever a central feature of the FP paradigm. And, as you note, is is only associated with FP because LISPs were the paradigmatic FP language for so long. But homoiconicity is always a feature of the primordial OO and LP languages, SmallTalk and Prolog.

[0] - http://dspace.mit.edu/bitstream/handle/1721.1/6099/AIM-031.p...

abathologist··on An Opinionated Treatise on Cosmos, a New Programming Language
What the designer calls "functors" just appear to be positional records (or labeled tuples). In Lisp, a list is a series of nested pairs with an empty list as the last element: `(a . (b . ())`. The data structures the designer calls "functors" are just labeled pairs. The Lisp empty list, `()`, is the Cosmos term `Cons`, the Lisp pair `(a . ())` is the Cosmos compound term `Cons(a, Cons)`.
abathologist··on An Opinionated Treatise on Cosmos, a New Programming Language
Sucks, cannot edit old comment. Correction:

Michael Hendrick: https://www.youtube.com/watch?v=G_eYTctGZw8

abathologist··on An Opinionated Treatise on Cosmos, a New Programming Language
I %100 support this project: though I am no expert, I am a PL enthusiast and I have high hopes for the future of logic programming. It's also just great to see projects like this exploring the space of PL design. The more the merrier! That being said, I tend to side with those who find the jocular arrogance of the writeup irritating and off putting rather than charming. My 2 cents, fwiw.

Stylistic quibbles aside, I have some reservations about the choices you've made in diverging from Prolog.

Your use of 'functor' seems to be different from Prolog's. You are therefore adding a forth or fifth meaning to the term, will have to compete with those already given by of Carnap, Quine, category theory, and OCaml. You are, thus, further muddying the sense of an already over-loaded term (http://pinealservo.com/posts/2014-10-22-ManyFunctionsOfFunct...). You seem to use 'functor' to refer to labeled tuples, or positional records. Prolog 'functors' are rather the atoms used to label such structures, e.g., `p(a)` and `p(a,b)` are different compounds with the same functor, 'p'. As a matter of fact, Prolog's compound structures do also serve as labeled tuples, but that is only a symptom of Prolog's explicit evaluation and homoiconicity. In fact, Prolog functors are "function like" in that we can call a functor on arguments, thereby instantiating a predicate. Your "functors" seem to be inert, and I think it would keep things much clearer if you just called them "records" or something. 'Functor' makes sense in the context of Prolog, where labeled compounds can be both data structures and propositions/propositional functions; for in that case, the atom used for labeling also serves a role akin to the string 'sin' in the function `sin(x)`.

This brings me to my other reservation: one of Prolog's real strengths, in my estimation, is the combination of explicit evaluation, unification, and homoiconicity. That combination gives us many higher order behaviors for free and facilitates meta programming. Thus, explicit evaluation and data-as-code means the compound `p(a)` can be mapped over a list, giving us partial application of `p(a,X)`. We also get the equivalence of first-class functions, allowing predicates to be passed as arguments to other predicates. We are also permitted remarkably deep reflection, including unification-matching on predicates and arbitrary data structures: e.g., I can do `p(X,q(r,S)) = p(2+2, Y)` to get the assignments `X = 2+2, Y = q(r,S)` and then `Sum is X * 2`, to get `Sum = 8`, and `S` will still be free until bound to something later.

This is why we differentiate the unification operator `=/2` from the arithmetic evaluation operator `is/2` and various equality operators. Contrary to your assertion, `X = 1+2` works very well, allowing me to do `X =.. [F|Args]` to get the assignments `F = +, Args = [1,2]`, so I can choose to multiply the arguments instead (e.g., `Y =.. [*|Args], Product is Y` getting `Product = 2`), inspect he functor (in this case, `+`), or simply pattern match to get the values in X (`2+Y = X` yielding the assignment `Y = 2`).

As a Prolog user, I have to say, I wouldn't dream of giving up this flexibility just to save the trouble of writing commas for explicit conjunctions and gain the (dubious) convenience of an operator that conflates assignment and equality.

Lastly, as an SWI-Prolog user, it is disingenuous to ask "where is list.map or string.concat?", as I'm sure you are well aware that both of those predicates (and many more besides) are supplied in the standard library. SWI, great as it is, still wants for features, but basic operations like those are well provided for.

So, there's some criticism from an inexpert enthusiast. Truly, I am inspired by your effort and look forward to trying out your language!

abathologist··on An Opinionated Treatise on Cosmos, a New Programming Language
Michael Hendrix described Mercury as Haskell + Prolog, which is accurate, I think, and an indication that Mercury is pretty far removed from what Cosmos is trying to do. (I'm more interested in Mercury). Cosmos looks like it wants to be a multi-paradigm scripting language, whereas Mercury is aiming for logical purity (no cuts), strong and static typing, and high speed (...for a Prolog). I think Picat (http://www.picat-lang.org/) or Ciao (http://ciao-lang.org/) are probably closer matches to Cosmos.
← PreviousPage 6 of 6