This file is indexed.

/usr/lib/ats2-postiats-0.2.6/libats/ML/HATS/myfunset.hats is in ats2-lang 0.2.6-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
(***********************************************************************)
(*                                                                     *)
(*                         Applied Type System                         *)
(*                                                                     *)
(***********************************************************************)

(*
** ATS/Postiats - Unleashing the Potential of Types!
** Copyright (C) 2010-2015 Hongwei Xi, ATS Trustful Software, Inc.
** All rights reserved
**
** ATS is free software;  you can  redistribute it and/or modify it under
** the terms of  the GNU GENERAL PUBLIC LICENSE (GPL) as published by the
** Free Software Foundation; either version 3, or (at  your  option)  any
** later version.
**
** ATS is distributed in the hope that it will be useful, but WITHOUT ANY
** WARRANTY; without  even  the  implied  warranty  of MERCHANTABILITY or
** FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License
** for more details.
**
** You  should  have  received  a  copy of the GNU General Public License
** along  with  ATS;  see the  file COPYING.  If not, please write to the
** Free Software Foundation,  51 Franklin Street, Fifth Floor, Boston, MA
** 02110-1301, USA.
*)

(* ****** ****** *)

(* Author: Hongwei Xi *)
(* Authoremail: gmhwxiATgmailDOTcom *)
(* Start time: March, 2015 *)

(* ****** ****** *)
//
// HX-2015-03-14:
// For quickly building a funset interface
//
(* ****** ****** *)
//
(*
typedef elt = int/...
*)
//
(* ****** ****** *)
//
abstype
myset_type = ptr
//
typedef
myset = myset_type
//
(* ****** ****** *)

extern
fun
myfunset_nil():<> myset
and
myfunset_make_nil():<> myset

(* ****** ****** *)

extern
fun
myfunset_sing(elt): myset
and
myfunset_make_sing(elt): myset

(* ****** ****** *)

extern
fun
myfunset_make_list(List(elt)): myset

(* ****** ****** *)
//
extern
fun
fprint_myfunset
  (out: FILEref, xs: myset): void
//
overload fprint with fprint_myfunset
//
(* ****** ****** *)
//
extern
fun
myfunset_size(myset): size_t
//
overload .size with myfunset_size
//
(* ****** ****** *)
//
extern
fun
myfunset_is_member(myset, elt): bool
and
myfunset_isnot_member(myset, elt): bool
//
overload is_member with myfunset_is_member
overload isnot_member with myfunset_isnot_member
//
overload .is_member with myfunset_is_member
overload .isnot_member with myfunset_isnot_member
//
(* ****** ****** *)
//
extern
fun
myfunset_insert
  (xs: &myset >> _, x0: elt): bool
//
overload .insert with myfunset_insert
//
(* ****** ****** *)
//
extern
fun
myfunset_remove
  (xs: &myset >> _, x0: elt): bool
//
overload .remove with myfunset_remove
//
(* ****** ****** *)
//
extern
fun
myfunset_union(myset, myset): myset
and
myfunset_union2(&myset >> _, myset): void
//
overload union with myfunset_union
overload .union with myfunset_union2
//
extern
fun
myfunset_intersect(myset, myset): myset
and
myfunset_intersect2(&myset >> _, myset): void
//
overload intersect with myfunset_intersect
overload .intersect with myfunset_intersect2
//
(* ****** ****** *)
//
extern
fun
myfunset_differ
  (xs: myset, ys: myset): myset
and
myfunset_differ2
  (xs: &myset >> _, ys: myset): void
//
overload differ with myfunset_differ
overload .differ with myfunset_differ2
//
extern
fun
myfunset_symdiff
  (xs: myset, ys: myset): myset
and
myfunset_symdiff2
  (xs: &myset >> _, ys: myset): void
//
overload symdiff with myfunset_symdiff
overload .symdiff with myfunset_symdiff2
//
(* ****** ****** *)
//
extern
fun
myfunset_equal(myset, myset): bool
and
myfunset_notequal(myset, myset): bool
//
overload = with myfunset_equal
overload != with myfunset_notequal
//
(* ****** ****** *)
//
extern
fun
myfunset_compare(myset, myset): int
//
overload compare with myfunset_compare
//
(* ****** ****** *)
//
extern
fun
myfunset_is_subset(myset, myset): bool
and
myfunset_is_supset(myset, myset): bool
//
(* ****** ****** *)
//
overload is_subset with myfunset_is_subset
overload is_supset with myfunset_is_supset
//
overload .is_subset with myfunset_is_subset
overload .is_supset with myfunset_is_supset
//
(* ****** ****** *)
//
extern
fun
myfunset_foreach_cloref
  (myset, fwork: (elt) -<cloref1> void): void
//
extern
fun
myfunset_foreach_method
  (myset) (fwork: (elt) -<cloref1> void): void
//
overload .foreach with myfunset_foreach_method
//
(* ****** ****** *)
//
extern
fun
{res:t@ype}
myfunset_foldleft_cloref
(
  xs: myset
, ini: res, fopr: (res, elt) -<cloref1> res
) : res // end of [myfunset_foldleft_cloref]
//
extern
fun
{res:t@ype}
myfunset_foldleft_method
(
  myset, TYPE(res)
) (ini: res, fopr: (res, elt) -<cloref1> res): res
//
overload .foldleft with myfunset_foldleft_method
//
(* ****** ****** *)
//
extern
fun
myfunset_tabulate_cloref
  {n:nat}
(
  n: int(n), fopr: (natLt(n)) -<cloref1> elt
) : myset // end of [myfunset_tabulate_cloref]
//
extern
fun
myfunset_tabulate_method
  {n:nat}
  (n: int(n)) (fopr: (natLt(n)) -<cloref1> elt): myset
//
overload .tabulate with myfunset_tabulate_method
//
(* ****** ****** *)
//
extern
fun
myfunset_listize(myset): List0(elt)
//
overload listize with myfunset_listize
overload .listize with myfunset_listize
//
(* ****** ****** *)

local
//
staload
UN = "prelude/SATS/unsafe.sats"
//
staload "libats/ML/SATS/basis.sats"
staload "libats/ML/SATS/list0.sats"
staload "libats/ML/SATS/funset.sats"
//
staload _ = "libats/DATS/funset_avltree.dats"
//
staload _(*anon*) = "libats/ML/DATS/funset.dats"
//
assume myset_type = set_type(elt)
//
in (* in-of-local *)

(* ****** ****** *)
//
implement
myfunset_nil() = funset_make_nil{elt}()
implement
myfunset_make_nil() = funset_make_nil{elt}()
//
implement
myfunset_sing
  (x) = funset_make_sing<elt>(x)
implement
myfunset_make_sing
  (x) = funset_make_sing<elt>(x)
//
implement
myfunset_make_list
  (xs) = funset_make_list<elt>(g0ofg1(xs))
//
(* ****** ****** *)
//
implement
fprint_myfunset
  (out, xs) = fprint_funset<elt>(out, xs)
//
(* ****** ****** *)
//
implement
myfunset_size(xs) = funset_size<elt>(xs)
//
(* ****** ****** *)
//
implement
myfunset_is_member
  (xs, x0) = funset_is_member<elt>(xs, x0)
implement
myfunset_isnot_member
  (xs, x0) = funset_isnot_member<elt>(xs, x0)
//
(* ****** ****** *)
//
implement
myfunset_insert
  (xs, x0) = funset_insert<elt>(xs, x0)
//
implement
myfunset_remove
  (xs, x0) = funset_remove<elt>(xs, x0)
//
(* ****** ****** *)
//
implement
myfunset_union
  (xs, ys) = funset_union<elt>(xs, ys)
implement
myfunset_union2
  (xs, ys) = (xs := funset_union<elt>(xs, ys))
implement
myfunset_intersect
  (xs, ys) = funset_intersect<elt>(xs, ys)
implement
myfunset_intersect2
  (xs, ys) = (xs := funset_intersect<elt>(xs, ys))
//
(* ****** ****** *)
//
implement
myfunset_differ
  (xs, ys) = funset_differ<elt>(xs, ys)
implement
myfunset_differ2
  (xs, ys) = (xs := funset_differ<elt>(xs, ys))
implement
myfunset_symdiff
  (xs, ys) = funset_symdiff<elt>(xs, ys)
implement
myfunset_symdiff2
  (xs, ys) = (xs := funset_symdiff<elt>(xs, ys))
//
(* ****** ****** *)
//
implement
myfunset_equal
  (xs, ys) = funset_equal<elt>(xs, ys)
implement
myfunset_notequal
  (xs, ys) = ~(funset_equal<elt>(xs, ys))
//
implement
myfunset_compare
  (xs, ys) = funset_compare<elt>(xs, ys)
//
(* ****** ****** *)
//
implement
myfunset_is_subset
  (xs, ys) = funset_is_subset<elt>(xs, ys)
implement
myfunset_is_supset
  (xs, ys) = funset_is_supset<elt>(xs, ys)
//
(* ****** ****** *)
//
implement
myfunset_foreach_cloref
(
  xs, fwork
) = funset_foreach_cloref<elt>(xs, fwork)
//
implement
myfunset_foreach_method
  (xs) =
(
  lam (fwork) => myfunset_foreach_cloref(xs, fwork)
) (* myfunset_foreach_method *)
//
(* ****** ****** *)

implement
{res}(*tmp*)
myfunset_foldleft_cloref
  (xs0, ini, fopr) = r0 where
{
//
var r0
  : res = ini
//
val p_r0 = addr@r0
//
val ((*void*)) =
myfunset_foreach_cloref
(
  xs0
, lam(x) =>
  $UN.ptr0_set<res>
  (p_r0, fopr($UN.ptr0_get<res>(p_r0), x))
  // end of [lam]
) (* end of [myfunset_foreach_cloref] *)
//
} (* end of [myfunset_foldleft_cloref] *)
//
(* ****** ****** *)
//
implement
{res}(*tmp*)
myfunset_foldleft_method
  (xs0, tres) =
  lam (int, fopr) =>
  myfunset_foldleft_cloref<res> (xs0, int, fopr)
//
(* ****** ****** *)
//
implement
myfunset_tabulate_cloref
  (n, fopr) = funset_tabulate_cloref<elt>(n, fopr)
//
implement
myfunset_tabulate_method
  (n) = lam(fopr) => myfunset_tabulate_cloref(n, fopr)
//
(* ****** ****** *)
//
implement
myfunset_listize
  (xs) = g1ofg0_list(funset_listize<elt>(xs))
//
(* ****** ****** *)

end // end of [local]

(* ****** ****** *)

(* end of [myfunset.hats] *)