| 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 = <pce>(0x7f9c3a41b0,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.length elements from the 1-based start.
length defaults to the remainder of the chain. The part of
the range outside the chain is left out, so the result may be shorter or
empty. The result is of the class of the receiver. Example:
?- get_object(chain(a,b,c,d,e), slice, 2, 3, X). X = chain(b,c,d)
See also chain<-sub
and vector<-slice.
<-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.