Skip to content

Commit 084ef73

Browse files
authored
Refactorings based on Steffan153's work (#40)
* Refactorings based on Steffan153's work * No longer need dash before string keys for case/condp * Update for 0.1.81 * Small change based on vendethiel's review
1 parent 0391247 commit 084ef73

File tree

168 files changed

+372
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+372
-609
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defaults:
1212
jobs:
1313
test:
1414
runs-on: ubuntu-latest
15-
container: ingy/exercism-yamlscript-test-runner:0.1.80
15+
container: ingy/exercism-yamlscript-test-runner:0.1.81
1616

1717
steps:
1818
- name: Checkout repository

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ROOT := $(shell pwd)
44

55
BIN := bin
66

7-
YS_VERSION := 0.1.80
7+
YS_VERSION := 0.1.81
88

99
YS_LOCAL := .local
1010
YS_LOCAL_PREFIX := $(YS_LOCAL)/v$(YS_VERSION)

common/gnumakefile.mk

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

33
BASE := $(shell pwd)
44

5-
export YS_VERSION := 0.1.80
5+
export YS_VERSION := 0.1.81
66

77
YS_LOCAL_PREFIX := ../../../.local/v$(YS_VERSION)
88
ifeq (,$(shell [[ -d "$(YS_LOCAL_PREFIX)" ]] && echo ok))

common/meta-makefile.mk

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

33
BASE := $(shell pwd)
44

5-
export YS_VERSION := 0.1.80
5+
export YS_VERSION := 0.1.81
66

77
YS_LOCAL_PREFIX := ../../../../.local/v$(YS_VERSION)
88

exercises/practice/acronym/.meta/Makefile

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

33
BASE := $(shell pwd)
44

5-
export YS_VERSION := 0.1.80
5+
export YS_VERSION := 0.1.81
66

77
YS_LOCAL_PREFIX := ../../../../.local/v$(YS_VERSION)
88

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
!yamlscript/v0
22

33
defn abbreviate(phrase):
4-
uc(phrase):
5-
.re-seq(/[A-Z']+/)
4+
uc(phrase).re-seq(/[A-Z']+/)
65
.map(first):join

exercises/practice/acronym/GNUmakefile

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

33
BASE := $(shell pwd)
44

5-
export YS_VERSION := 0.1.80
5+
export YS_VERSION := 0.1.81
66

77
YS_LOCAL_PREFIX := ../../../.local/v$(YS_VERSION)
88
ifeq (,$(shell [[ -d "$(YS_LOCAL_PREFIX)" ]] && echo ok))

exercises/practice/all-your-base/.meta/Makefile

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

33
BASE := $(shell pwd)
44

5-
export YS_VERSION := 0.1.80
5+
export YS_VERSION := 0.1.81
66

77
YS_LOCAL_PREFIX := ../../../../.local/v$(YS_VERSION)
88

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
!yamlscript/v0
22

3-
defn rebase(input-base digits output-base):
4-
:: Converts a sequence of digits given in input-base
5-
into a sequence of digits in the desired output-base.
6-
7-
cond:
8-
input-base < 2: die('input base must be >= 2')
9-
output-base < 2: die('output base must be >= 2')
10-
digits.some(neg?) || digits.some(ge(input-base)):
11-
die: 'all digits must satisfy 0 <= d < input base'
12-
13-
digits.every?(zero?) || count(digits).eq(0) :: [0]
14-
15-
else: digits
16-
.digits-to-decimal(input-base)
17-
.decimal-to-digits(output-base)
18-
19-
defn digits-to-decimal(digits input-base):
20-
reduce \(%2 + (%1 * input-base)): digits
21-
22-
defn decimal-to-digits(number output-base):
23-
loop digits nil, num number:
24-
if num > 0:
25-
recur:
26-
conj digits: num % output-base
27-
quot: num output-base
28-
else: digits
3+
defn rebase(input digits output):
4+
when input < 2: die('input base must be >= 2')
5+
when output < 2: die('output base must be >= 2')
6+
when-not digits.every?(\(0 <= _ <= input.--)):
7+
die('all digits must satisfy 0 <= d < input base')
8+
9+
loop n reduce(\((%1 * input) + %2) 0 digits), res []:
10+
if n.?:
11+
=>: recur(quot(n output) res.cons(n % output))
12+
res |||: -[0]

exercises/practice/all-your-base/GNUmakefile

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

33
BASE := $(shell pwd)
44

5-
export YS_VERSION := 0.1.80
5+
export YS_VERSION := 0.1.81
66

77
YS_LOCAL_PREFIX := ../../../.local/v$(YS_VERSION)
88
ifeq (,$(shell [[ -d "$(YS_LOCAL_PREFIX)" ]] && echo ok))

0 commit comments

Comments
 (0)