4 ms·
To add to this comment; if you use Pharo, the impressive part is right in the first-run tutorial. It gives you the basics but you have to write the code to upda
by ljm 7y ago
To add to this comment; if you use Pharo, the impressive part is right in the first-run tutorial. It gives you the basics but you have to write the code to update the environment to give you the next/previous buttons for each step.
You can run whatever code you want in those windows, but just by finishing the tutorial you'll have an idea of what you're getting into.
It's on my backlog of things to toy with, along with Prolog. And after playing with Objective-C long enough I quite enjoy the syntax.
- Gene_Parmesan 7y agoI can definitely highly recommend Prolog for playing. I found it to be a mind-opener in the same way learning Scheme for the first time was a mind-opener. Programming with predicates/relations is extremely powerful. As a teaser, consider a predicate Concat(X, Y, Z). In Prolog, capitalized identifiers are considered as unbound variables. There aren't return values; instead, you compute via unification. So we can approximate the idea of a list concat funtion by entering something like `Concat([1, 2], [3, 4], X).` The Prolog evaluator will answer that X must be [1, 2, 3, 4] in order for the predicate to hold true. Looks like a standard function with a quirky way to provide an out param. But these are predicates, not functions. Concat's internal logic defines a logical relation among the various values. This logic holds no matter which values you leave unbound. So here are some other things you get for free: `Concat(X, Y, [1, 2, 3, 4]).` -- this will, in turn, iterate through all possible values of X and Y that make this predicate true. Thus Prolog will give us X: [], Y: [1,2,3,4]; but also X: [1], Y: [2,3,4]; and so on. `Concat(X, [3, 4], [1, 2, 3, 4]).` -- this will give us X: [1, 2]; alternatively, it will give us the answer 'no' (sort of equivalent to false) if [3, 4] is not some tail of the provided list. `Concat([1, 2], [3, 4], [1, 2, 3, 4]).` -- will give us "yes", for true. This is a simple example, but now perhaps the potential power of Prolog is more visible. Imagine the possibilities -- for instance, a constructed grammar can tell you not only if a given candidate sentence is valid, but it can also (in theory) generate every single valid sentence in turn.
- ljm 7y agoI've been feeling this out through the Adventures in Prolog book. It's also a fascinating insight into how SQL engines work and what it means to write declarative code. I've had an idea for a prolog side-project for a while, but just haven't learned enough yet to know how I could implement it. In my mind, reserving a slot in a calendar or otherwise finding the next best opportunity is a valid use-case.
- saagarjha 7y ago> And after playing with Objective-C long enough I quite enjoy the syntax. Interestingly, I enjoy Objective-C despite its syntax.