Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #14440

Deephaven inspired me to name a predicate [first_by/2]

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Deephaven inspired me to name a predicate [first_by/2]
Date 2025-02-10 18:44 +0100
Message-ID <vodduk$1vor$1@solani.org> (permalink)

Show all headers | View raw


Hi,

Suddently I got an allergy to name a predicate
distinct/2. It is not so obvious that distinct/1 and
distinct/2 are related. There is no constant C such that:

distinct(X) :- distinct(C, X).

Just joking, but for some consistency with the introduction
of group_by/4 and aggregate_by/4 I went for the
name first_by/2. The name is more intuitive:

?- [user].
p(1,a).
p(1,b).
p(2,c).
p(2,d).
p(2,e).
^Z
true.

Now some queries:

?- p(X,Y), write(X-Y), nl, fail; true.
1-a
1-b
2-c
2-d
2-e
true.

?- first_by(X, p(X,Y)), write(X-Y), nl, fail; true.
1-a
2-c
true.

Cool! The name is also used here with the same semantics:

https://deephaven.io/core/docs/reference/table-operations/group-and-aggregate/firstBy/

Back to comp.lang.prolog | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Deephaven inspired me to name a predicate [first_by/2] Mild Shock <janburse@fastmail.fm> - 2025-02-10 18:44 +0100
  India & France had their AI Bikini Moment (Was: Deephaven inspired me to name a predicate [first_by/2]) Mild Shock <janburse@fastmail.fm> - 2025-02-10 21:17 +0100
    More about an experimental aggregate_by/4 (Was: India & France had their AI Bikini Moment) Mild Shock <janburse@fastmail.fm> - 2025-02-16 12:24 +0100
      Experimental aggregate_by/4 was dismissed (Was: India & France had their AI Bikini Moment) Mild Shock <janburse@fastmail.fm> - 2025-02-16 12:25 +0100
        Re: Experimental aggregate_by/4 was dismissed (Was: India & France had their AI Bikini Moment) olcott <NoOne@NoWhere.com> - 2025-02-16 12:54 -0600

csiph-web