Skip to content

Commit 567f60b

Browse files
committed
docs: update example code blocks so that important of the current file aren't added, and every function used is prefixed
1 parent 7cd3830 commit 567f60b

File tree

9 files changed

+73
-91
lines changed

9 files changed

+73
-91
lines changed

Events.ark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# @brief Allows to register events listeners and emit events
44
# =begin
5-
# (let em (manager:make))
5+
# (let em (events:manager:make))
66
# (em.on "myType" (fun (value) (print "This is a callback")))
77
# (em.emit "myType") # => prints "This is a callback" thanks to the registered listener
88
# =end

Lazy.ark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# (let complex_stuff (fun () {
55
# # do complex work in the function
66
# 42 }))
7-
# (let lazy (eval complex_stuff))
7+
# (let lazy (lazy:eval complex_stuff))
88
# (print (lazy))
99
# =end
1010
# @author https://github.com/SuperFola

List.ark

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@
7272
# @param _func the function to call on each element
7373
# @details The original list is not modified.
7474
# =begin
75-
# (import std.List)
7675
# (let collection [1 2 5 12])
77-
# (forEach collection (fun (element) {
76+
# (list:forEach collection (fun (element) {
7877
# (print element) }))
7978
# =end
8079
# @author https://github.com/SuperFola
@@ -91,9 +90,8 @@
9190
# @param _func a binary function to call on each element with (index, element)
9291
# @details The original list is not modified.
9392
# =begin
94-
# (import std.List)
9593
# (let collection [1 2 5 12])
96-
# (enumerate collection (fun (idx element) {
94+
# (list:enumerate collection (fun (idx element) {
9795
# (print idx " " element) }))
9896
# =end
9997
# @author https://github.com/SuperFola
@@ -109,9 +107,8 @@
109107
# @param _L the list to iterate over
110108
# @details The original list is not modified.
111109
# =begin
112-
# (import std.List)
113110
# (let collection [1 2 5 12])
114-
# (let p (product collection)) # => 120
111+
# (let p (list:product collection)) # => 120
115112
# =end
116113
# @author https://github.com/Unactived
117114
(let product (fun (_L) {
@@ -127,9 +124,8 @@
127124
# @param _L the list to iterate over
128125
# @details The original list is not modified.
129126
# =begin
130-
# (import std.List)
131127
# (let collection [1 2 5 12])
132-
# (let p (sum collection)) # => 20
128+
# (let p (list:sum collection)) # => 20
133129
# =end
134130
# @author https://github.com/Unactived
135131
(let sum (fun (_L) {
@@ -162,7 +158,7 @@
162158
# @param _L list of numbers
163159
# @details The original list is not modified.
164160
# =begin
165-
# (let value (list:min [0 1 2 3 5 8])) # 8
161+
# (let value (list:max [0 1 2 3 5 8])) # 8
166162
# =end
167163
# @author https://github.com/SuperFola
168164
(let max (fun (_L) {
@@ -183,7 +179,7 @@
183179
# @details The original list is not modified.
184180
# =begin
185181
# (let cool-stuff [1 2 3 4 5 6 7 8 9])
186-
# (print (drop cool-stuff 4)) # [5 6 7 8 9]
182+
# (print (list:drop cool-stuff 4)) # [5 6 7 8 9]
187183
# =end
188184
# @author https://github.com/rstefanic, https://github.com/SuperFola
189185
(let drop (fun (_L _n)
@@ -206,7 +202,7 @@
206202
# @details The original list is not modified.
207203
# =begin
208204
# (let cool-stuff [1 2 3 4 5 6 7 8 9])
209-
# (print (dropWhile cool-stuff (fun (a) (< a 4)))) # [4 5 6 7 8 9]
205+
# (print (list:dropWhile cool-stuff (fun (a) (< a 4)))) # [4 5 6 7 8 9]
210206
# =end
211207
# @author https://github.com/SuperFola
212208
(let dropWhile (fun (_L _f) {
@@ -227,7 +223,7 @@
227223
# @details The original list is not modified.
228224
# =begin
229225
# (import std.Math)
230-
# (print (filter [1 2 3 4 5 6 7 8 9] math:even)) # [2 4 6 8]
226+
# (print (list:filter [1 2 3 4 5 6 7 8 9] math:even)) # [2 4 6 8]
231227
# =end
232228
# @author https://github.com/rstefanic
233229
(let filter (fun (_L _f) {
@@ -244,7 +240,7 @@
244240
# @param _f the function to apply to each element
245241
# @details The original list is not modified.
246242
# =begin
247-
# (print (map [1 2 3 4 5 6 7 8 9] (fun (e) (* e e)))) # [1 4 9 25 36 49 64 81]
243+
# (print (list:map [1 2 3 4 5 6 7 8 9] (fun (e) (* e e)))) # [1 4 9 25 36 49 64 81]
248244
# =end
249245
# @author https://github.com/rstefanic
250246
(let map (fun (_L _f) {
@@ -262,7 +258,7 @@
262258
# @details The original list is not modified.
263259
# =begin
264260
# (let cool [1 2 3 4 5 6 7 8 9])
265-
# (print (reduce cool (fun (a b) (+ a b)))) # 45
261+
# (print (list:reduce cool (fun (a b) (+ a b)))) # 45
266262
# =end
267263
# @author https://github.com/Unactived
268264
(let reduce (fun (_L _f) {
@@ -279,7 +275,7 @@
279275
# @details The original list is not modified.
280276
# =begin
281277
# (let cool [[1 2 3] [4] 5 6 [7 8] 9])
282-
# (print (flatten cool)) # [1 2 3 4 5 6 7 8 9]
278+
# (print (list:flatten cool)) # [1 2 3 4 5 6 7 8 9]
283279
# =end
284280
# @author https://github.com/SuperFola
285281
(let flatten (fun (_L) {
@@ -301,7 +297,7 @@
301297
# @details The original list is not modified.
302298
# =begin
303299
# (let cool [1 2 3 4])
304-
# (print (flatMap cool (fun (a) [a a]))) # [1 1 2 2 3 3 4 4]
300+
# (print (list:flatMap cool (fun (a) [a a]))) # [1 1 2 2 3 3 4 4]
305301
# =end
306302
# @author https://github.com/SuperFola
307303
(let flatMap (fun (_L _f) {
@@ -322,7 +318,7 @@
322318
# @param _n the number of elements to take
323319
# @details The original list is not modified.
324320
# =begin
325-
# (print (take [1 2 3 4 5 6 7 8 9] 4)) # [1 2 3 4]
321+
# (print (list:take [1 2 3 4 5 6 7 8 9] 4)) # [1 2 3 4]
326322
# =end
327323
# @author https://github.com/rstefanic
328324
(let take (fun (_L _n) {
@@ -340,7 +336,7 @@
340336
# @param _f the predicate
341337
# @details The original list is not modified.
342338
# =begin
343-
# (print (takeWhile [1 2 3 4 5 6 7 8 9 10] (fun (a) (< a 4)))) # [1 2 3]
339+
# (print (list:takeWhile [1 2 3 4 5 6 7 8 9 10] (fun (a) (< a 4)))) # [1 2 3]
344340
# =end
345341
# @author https://github.com/rakista112
346342
(let takeWhile (fun (_L _f) {
@@ -384,7 +380,7 @@
384380
# @details The original list is not modified.
385381
# =begin
386382
# (let zipped [[1 5] [2 6] [3 7] [4 8]])
387-
# (print (unzip zipped)) # [[1 2 3 4] [5 6 7 8]]
383+
# (print (list:unzip zipped)) # [[1 2 3 4] [5 6 7 8]]
388384
# =end
389385
# @author https://github.com/Unactived
390386
(let unzip (fun (_L) {
@@ -407,7 +403,7 @@
407403
# =begin
408404
# (let a [1 2 3 4])
409405
# (let b [5 6 7 8])
410-
# (print (zip a b)) # [[1 5] [2 6] [3 7] [4 8]]
406+
# (print (list:zip a b)) # [[1 5] [2 6] [3 7] [4 8]]
411407
# =end
412408
# @author https://github.com/Unactived
413409
(let zip (fun (_a _b) {
@@ -425,7 +421,7 @@
425421
# @details The original list is not modified.
426422
# =begin
427423
# (let a [5 6 7 8])
428-
# (print (zipWithIndex a)) # [[0 5] [1 6] [2 7] [3 8]]
424+
# (print (list:zipWithIndex a)) # [[0 5] [1 6] [2 7] [3 8]]
429425
# =end
430426
# @author https://github.com/SuperFola
431427
(let zipWithIndex (fun (_L) {
@@ -444,7 +440,7 @@
444440
# @details The original list is not modified.
445441
# =begin
446442
# (let a [1 2 3 4])
447-
# (print (foldLeft a 0 (fun (a b) (+ a b)))) # 10
443+
# (print (list:foldLeft a 0 (fun (a b) (+ a b)))) # 10
448444
# =end
449445
# @author https://github.com/SuperFola
450446
(let foldLeft (fun (_L _init _f) {
@@ -462,7 +458,7 @@
462458
# =begin
463459
# (let a [1 2 3 4])
464460
# (let f (fun (e) (< e 5)))
465-
# (print (forAll a f)) # true
461+
# (print (list:forAll a f)) # true
466462
# =end
467463
# @author https://github.com/Gryfenfer97
468464
(let forAll (fun (_L _f) {
@@ -481,7 +477,7 @@
481477
# =begin
482478
# (let a [1 2 3 4])
483479
# (let f (fun (e) (< e 3)))
484-
# (print (any a f)) # true
480+
# (print (list:any a f)) # true
485481
# =end
486482
# @author https://github.com/Gryfenfer97
487483
(let any (fun (_L _f) {
@@ -500,8 +496,8 @@
500496
# =begin
501497
# (let a [1 2 3 4])
502498
# (let f (fun (e) (< e 3)))
503-
# (print (none a f)) # false
504-
# (print (none [4 5 6] f)) # true
499+
# (print (list:none a f)) # false
500+
# (print (list:none [4 5 6] f)) # true
505501
# =end
506502
# @author https://github.com/SuperFola
507503
(let none (fun (_L _f)
@@ -513,7 +509,7 @@
513509
# =begin
514510
# (let lst [1 2 3 4 5 6 7 8 9])
515511
# (let is_even (fun (e) (= 0 (mod e 2))))
516-
# (print (countIf lst is_even)) # 4
512+
# (print (list:countIf lst is_even)) # 4
517513
# =end
518514
# @author https://github.com/SuperFola
519515
(let countIf (fun (_L _f) {
@@ -534,7 +530,7 @@
534530
# @param _length the sequence length
535531
# =begin
536532
# (let f (fun (x) (+ 7 x)))
537-
# (print (iterate 0 f 10)) # [0 7 14 21 28 35 42 49 56 63]
533+
# (print (list:iterate 0 f 10)) # [0 7 14 21 28 35 42 49 56 63]
538534
# =end
539535
# @author https://github.com/SuperFola
540536
(let iterate (fun (_init _f _length) {
@@ -553,7 +549,7 @@
553549
# @param _init initial value of the sequence
554550
# @param _length the sequence length
555551
# =begin
556-
# (print (iota 0 10)) # [0 1 2 3 4 5 6 7 8 9]
552+
# (print (list:iota 0 10)) # [0 1 2 3 4 5 6 7 8 9]
557553
# =end
558554
# @author https://github.com/SuperFola
559555
(let iota (fun (_init _length) (iterate _init (fun (x) (+ 1 x)) _length)))

0 commit comments

Comments
 (0)