6 ms·
Can anyone speak to this for Icon? For context, Prolog had a culture of "the built-in search is less than wonderful... but good for crafting a problem-appropri
by mncharity 4y ago
Can anyone speak to this for Icon?
For context, Prolog had a culture of "the built-in search is less than wonderful... but good for crafting a problem-appropriate search". II(fuzzily)RC, Mozart/Oz decoupled nondeterministic code (explicit amb, spelled "dis") specification from search, and allowed managing search over nested spaces of unification constraints and threads. With (very fuzzy) less use of backtrack-driven implicit sequences than in Prolog? I so don't remember Icon.
Curiously, https://www2.cs.arizona.edu/icon/books.htm https://www2.cs.arizona.edu/icon/books.htm includes a "newish" (2010) book, "Icon Programming
for Humanists".
- cryptonector 4y agoIn Icon a function ("procedure") can: fail, return a value, or "suspend" (yield) a value (and then again and again). The difference between returning and suspending being that a generator that returns cannot be resumed again. That difference was needed (IIRC) because the alternative would be to end the generator with failure, which could be confused with failure in a boolean sense. jq gets this better by saying that a function can produce zero, one, or more values (just like Verse), but unlike Verse, jq does have booleans. I prefer the jq approach to the Icon approach, which I think means I am suspicious of this aspect of Verse :) Also, boolean values are inherently useful, and while checking that an expression is empty or not is a boolean predicate, it should be a predicate that produces a boolean value. Otherwise if we have no boolean values then we shouldn't have integer values either and just go back to the Lambda Calculus!
- chowells 4y agoBoolean values are inherently a sign of an insufficient data model. Booleans carry no inherent meaning. They don't tell you where they came from or provide any context about what operations or data they are guarding. If your language lets you declare your own algebraic data types, there's no need to lean on a built-in Boolean type. You can create types that actually carry all the information you need so that pattern matching provides provenance and data only in the branches that need them. Robert Harper discusses the idea in some detail here: https://existentialtype.wordpress.com/2011/03/15/boolean-blindness/ https://existentialtype.wordpress.com/2011/03/15/boolean-bli...
- mrkeen 4y ago> Boolean values are inherently a sign of an insufficient data model. Booleans carry no inherent meaning. Would you say the same about Ints or Strings?
- mjburgess 4y agoThey're saying you should be able to define your own The domain of int/str is infinite so there's less sense in redefining a number system for every property you want to model For small finite domains it makes sense to define your own in terms of the problem domain In this sense all two-valued types are bools
- HelloNurse 4y agoPractical language-agnostic example: a database for a business where some VARCHAR(34) columns are IBAN codes and others are messages to be displayed on a 2 by 17 characters LCD screen. They are two completely different data types that happen to have identical approximate representations but should be distinguished very strictly in a sufficiently expressive model. For instance, it should be possible to turn an IBAN into a device screen message but not the opposite, but you can't do it if they are all "strings"; and the two types have different value constraints while a generic VARCHAR has none.
- mrkeen 4y ago> They are two completely different data types that happen to have identical approximate representations but should be distinguished very strictly in a sufficiently expressive model. About bools: that's my problem with this. If-statements now operate on anything, instead of just bools. And I don't think that makes sense, unless cheese. About strings: It's great you can statically differentiate between their types. But if strings don't exist, it makes it a little hard to write WHERE clauses.
- charcircuit 4y agoPattern matching is just syntatic sugar over using booleans and extracting values from data types. This is an exaggerated problem with a cherry picked solution. See what happens when the condition is if a number > 100. Are you expected to convert the integer into a church encoded integer and then write 100 S types? Are you expected to adopt a language with refined or dependent types? Adding a ton of abstractions to fix a problem doesn't mean you now don't have an even bigger problem.