Skip to content

Commit

Permalink
Slight tweak to the mapconcat function
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushalmodi committed Oct 11, 2018
1 parent 8504af1 commit 57a0bdf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ const
# https://github.com/kaushalmodi/nimy_lisp
proc dollar[T](s: T): string =
result = $s
proc mapconcat[T](s: openArray[T]; op: proc(x: T): string = dollar; sep = " "): string =
proc mapconcat[T](s: openArray[T]; sep = " "; op: proc(x: T): string = dollar): string =
## Concatenate elements of ``s`` after applying ``op`` to each element.
## Separate each element using ``sep``.
for x in s:
result.add op(x) & sep
for i, x in s:
result.add(op(x))
if i < s.len-1:
result.add(sep)

task installPcre, "Installs PCRE using musl-gcc":
if not existsFile(pcreLibFile):
Expand Down

0 comments on commit 57a0bdf

Please sign in to comment.