String manipulation in Prolog

From: basi (basiibarra_at_yahoo.com)
Date: 03/30/05

  • Next message: djame: "Re: String manipulation in Prolog"
    Date: 29 Mar 2005 15:40:47 -0800
    
    

    I'm exploring the use of Prolog in text/corpus processing. What is so
    simple in other languages like Python and Ruby, I find so difficult to
    do in Prolog. I have gone through the familiar family tree tutorial,
    gone through Learning Prolog Now (excellent beginner book). But I
    can't find much in the way of string manipulation. How do I do such
    simple tasks like:

    create a string variable, assign a value to it
    search a string for a substring
    concatenate strings
    insert a substring into a string
    compare two strings for (in)equality
    iterate through a string
    use control structures like if-then, repeat, while
    and other string manipulation tasks, reverse, length, substringing

    I realize that Prolog's syntax, and way of doing things, is different
    from other languages. But the above are tasks that a text/corpus
    programmer will do even in Prolog. If I can do familiar tasks like the
    above in Prolog, then this would be a better Getting Started (for me)
    than querying and extending a family tree database (which I have no
    problem with). I don't mind direct translations of imperative commands
    to declarations for now. I'll learn the idiom as I go along.

    Which Prolog has the best string manipulation facility? I'm playing
    with SWI-Prolog, but there isn't much there. Quintus appears to have
    what I'm looking for but the product appears to be in limbo after
    being acquired by SICStus (I'm also having problem installing it).

    Thanks for your help.
    basi


  • Next message: djame: "Re: String manipulation in Prolog"

    Relevant Pages

    • Re: Possible to register a foreign function dynamically?
      ... anything, it just returns the pointer to the actual string, so I don't ... Actually it can also come along during the lifetime of the predicate ... Prolog threads active. ... If above is how Python programmers would like to see it, ...
      (comp.lang.prolog)
    • Re: Can I do this in prolog string to [s,t,r,i,n,g]
      ... >>How do I do this in ISO or SWI Prolog? ... >> string functions like those in visual prolog. ... For, if the input is an atom you can use sub_atom/5, for a string ...
      (comp.lang.prolog)
    • Re: String manipulation in Prolog
      ... > I'm exploring the use of Prolog in text/corpus processing. ... > can't find much in the way of string manipulation. ... > insert a substring into a string ...
      (comp.lang.prolog)
    • Re: what does for _ in range() mean?
      ... > E.g. to declare that X is a parent if X is a father or mother: ... string that needs localization. ... in Prolog and the use of _ in Python; ... That's not true in Python, ...
      (comp.lang.python)
    • Re: In which cases/problems is Prolog faster than Java?
      ... We've OOP languages built from functional languages foundations ... they are envy of imperative programming styles. ... still a predicate either in plain Prolog or encapsulated in a Prolog ... People often use Java not because its OO features per se but because ...
      (comp.lang.prolog)