Click here to Skip to main content
15,886,724 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Weather Prediction using minimal data Pin
dusty_dex16-May-13 23:58
dusty_dex16-May-13 23:58 
GeneralRe: Weather Prediction using minimal data Pin
nootanghimire17-May-13 23:50
professionalnootanghimire17-May-13 23:50 
GeneralRe: Weather Prediction using minimal data Pin
dusty_dex18-May-13 2:49
dusty_dex18-May-13 2:49 
GeneralRe: Weather Prediction using minimal data Pin
Dave Kreskowiak29-May-13 18:40
mveDave Kreskowiak29-May-13 18:40 
AnswerRe: Weather Prediction using minimal data Pin
Richard MacCutchan18-May-13 5:42
mveRichard MacCutchan18-May-13 5:42 
AnswerRe: Weather Prediction using minimal data Pin
Joezer BH16-Jun-13 23:29
professionalJoezer BH16-Jun-13 23:29 
QuestionBest autorrelation function Pin
Russell'7-May-13 0:36
Russell'7-May-13 0:36 
QuestionPattern matching in trees, lists and strings alike Pin
bjongejan11-Apr-13 9:19
bjongejan11-Apr-13 9:19 
There are many programming languages that do string pattern matching, either using regular expressions or using more elegant and powerful mechanisms, like SNOBOL[^].

There are also many programming languages that do tree pattern matching, like Haskell, but you cannot easily write a pattern that attempts to match an element in a list (a right descending tree), unless it is the first element.

Many tasks involve complex, irregular and not very large structured data. The most appropriate programming languages for tackling such tasks should have this kind of pattern matching in their tool box.

Examples of application domains for such a language:
  • HTML/XML validation and correction
  • C++ source code analysis
  • Analysis of email chains
  • Automatic chaining of tools in a workflow
  • Transformation from syntax to semantics in natural language processing
  • Computer algebra


Starting in the eighties, I have made and maintained such a language, Bracmat (GitHub[^],Rosetta Code[^]), and I have used it for all purposes listed above. Problem is, it is not an established programming language and therefore not the right language for production software, so I'm looking for a replacement.

I hope that I am too pessimistic and that there are in fact programming languages with seizable user communities that support the pattern matching facilities that I am looking for. The programming language that I am looking for should have a pattern matching mechanism that:

  1. allows wild cards not only in the tail part of a pattern, but anywhere in a pattern,
  2. in the case of matching against a list, is capable of matching any number of consecutive elements anywhere in the list, and not just the 'head' of the list,
  3. is visually clean, attractive and readable,
  4. allows 'normal' instructions to be embedded in patterns (evaluation of variables, writing to files, function calls, other pattern match operations, etc.),
  5. can assign a matched part of the subject to a variable,
  6. can match part of a subject with the content of a variable,
  7. uses the same pattern syntax for string pattern matching by treating a string as a special case of a list.


It goes without saying that such a language should have data types to express trees and lists. Ideally, patterns are structured as the data they are meant to match, so it would be helpful to implement patterns as data structures themselves.


Bart Jongejan
AnswerRe: Pattern matching in trees, lists and strings alike Pin
dusty_dex11-Apr-13 11:44
dusty_dex11-Apr-13 11:44 
GeneralRe: Pattern matching in trees, lists and strings alike Pin
bjongejan11-Apr-13 22:49
bjongejan11-Apr-13 22:49 
GeneralRe: Pattern matching in trees, lists and strings alike Pin
dusty_dex11-Apr-13 23:04
dusty_dex11-Apr-13 23:04 
GeneralRe: Pattern matching in trees, lists and strings alike Pin
bjongejan12-Apr-13 9:25
bjongejan12-Apr-13 9:25 
GeneralRe: Pattern matching in trees, lists and strings alike Pin
Kosta Cherry5-Jun-13 20:04
Kosta Cherry5-Jun-13 20:04 
QuestionAlgorithm Pin
Member 99636023-Apr-13 15:11
Member 99636023-Apr-13 15:11 
AnswerRe: Algorithm Pin
BupeChombaDerrick7-Apr-13 23:39
BupeChombaDerrick7-Apr-13 23:39 
QuestionAlignment and rectification of polylines Pin
Chesnokov Yuriy1-Apr-13 8:09
professionalChesnokov Yuriy1-Apr-13 8:09 
AnswerRe: Alignment and rectification of polylines Pin
Kenneth Haugland2-Apr-13 23:31
mvaKenneth Haugland2-Apr-13 23:31 
AnswerRe: Alignment and rectification of polylines Pin
Lutosław4-Jun-13 12:57
Lutosław4-Jun-13 12:57 
QuestionConsider a complete binary tree with an odd number of nodes. Let n be the number of internal nodes (non-leaves) in the tree. Define the internal path length, I, as the sum, taken over all the internal nodes of the tree, of the depth of each node. Lik Pin
amistry_petlad28-Mar-13 7:08
amistry_petlad28-Mar-13 7:08 
AnswerRe: Consider a complete binary tree with an odd number of nodes. Let n be the number of internal nodes (non-leaves) in the tree. Define the internal path length, I, as the sum, taken over all the internal nodes of the tree, of the depth of each node. Pin
R. Giskard Reventlov28-Mar-13 7:24
R. Giskard Reventlov28-Mar-13 7:24 
AnswerRe: Consider a complete binary tree with an odd number of nodes. Let n be the number of internal nodes (non-leaves) in the tree. Define the internal path length, I, as the sum, taken over all the internal nodes of the tree, of the depth of each node. Pin
Richard MacCutchan28-Mar-13 7:25
mveRichard MacCutchan28-Mar-13 7:25 
GeneralRe: Consider a complete binary tree with an odd number of nodes. Let n be the number of internal nodes (non-leaves) in the tree. Define the internal path length, I, as the sum, taken over all the internal nodes of the tree, of the depth of each node. Pin
amistry_petlad28-Mar-13 7:51
amistry_petlad28-Mar-13 7:51 
GeneralRe: Consider a complete binary tree with an odd number of nodes. Let n be the number of internal nodes (non-leaves) in the tree. Define the internal path length, I, as the sum, taken over all the internal nodes of the tree, of the depth of each node. Pin
Richard MacCutchan28-Mar-13 7:58
mveRichard MacCutchan28-Mar-13 7:58 
AnswerRe: Consider a complete binary tree with an odd number of nodes. Let n be the number of internal nodes (non-leaves) in the tree. Define the internal path length, I, as the sum, taken over all the internal nodes of the tree, of the depth of each node. Pin
Lutosław4-Jun-13 13:06
Lutosław4-Jun-13 13:06 
QuestionThe degree of a node in a tree is the number of children the node has. If a tree has n1 nodes of degree 1, n2 nodes of degree 2, ..., nm nodes of degree m, compute the number of leaves in the tree in terms of n1, n2, . . . , nm. Pin
amistry_petlad28-Mar-13 7:04
amistry_petlad28-Mar-13 7:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.