| Did you know ... | Search Documentation: |
| Get methods |
<-_arg<-_arity<-next_cell <-head_cell ->cell_value
@nil Use default conversion to text. @default Use object <-print_name.Function Use this function, @arg1 is the element.
The return value is a tuple
object. The tuple<-first contains a new
chain holding all elements of the receiving string whose name start with
the given prefix. The tuple<-second
contains a new string
object holding the largest common prefix of all matches. If no element
of the chain matches prefix, this method fails. Example:
?- get(chain(gnu, foo, gnats, bar), complete_name, 'g',
tuple(Matches, string(Common))),
object(Matches, Chain).
Common = gn
Chain = chain(gnu, gnats)
Matches = @854357/chain
See also text_item->complete.
send(new(B, browser), open), send(B, members, [gnu, gnat, gnome]).
When the receiver is a subclass of chain, the resulting chain will be an instance of the same (sub)class: an instance of this subclass is created with no arguments, after which the append behaviour of class chain is used to append the elements.
Bugs: Creating copies of subclasses is ill-defined.
current cell. Use of the current
field of chains is discouraged as it makes the code non-reentrant.
->current
<-index
@arg1 Element tested @arg2 1-based index of element
->for_all <-find_all ->find <-find_key
@arg1 Element tested @arg2 1-based index of element
The following example finds all inverted graphicals on the graphical device Dev:
?- get(Dev?graphicals, find_all,
@arg1?inverted == @on, Inverted).
See also chain->for_all.
->for_all <-find<-cell_value
@see chain->cell_value<-current_no
@arg1 Element tested @arg2 1-based index of the element
The example below returns a chain with names holding the names of all graphical objects on the graphical device.
graphical_names(Device, Names) :-
get(Device, graphicals, Chain),
get(Chain, map, @arg1?name, Names).
For backward compatibility only, if no argument is provided,
chain<-current
is returned and chain<-current
is moved to the next element.
See also chain<-previous, chain<-nth1, chain<-head
and chain<-tail.
<-cell_value
@see chain->cell_value->current_no<-next, chain<-nth1, chain<-head
and chain<-tail.<-size.
The object at chain<-end is not included.
Example:
?- get_object(chain(0,1,2,3), sub, 1, 2, X). X = chain(1)
See also char_array<-sub.