Browse Source

content: issue fix

pull/631/head
lee 4 years ago
parent
commit
70b11bfbd1
  1. 46
      js/tests/mapper_test.js
  2. 3
      subjects/currify/README.md
  3. 12
      subjects/go-reloaded/README.md
  4. 2
      subjects/go-reloaded/audit/README.md
  5. 2
      subjects/mapper/README.md

46
js/tests/mapper_test.js

@ -24,18 +24,18 @@ const arrayFormatSentence = (item, index, arr) => {
// map // map
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq(map(ctx.numbers, add1), [11, -9, 21, -94, 87, 103, 36, 90, 111]), eq(map(ctx.numbers, add1), [11, -9, 21, -94, 87, 103, 36, 90, 111])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq(map(ctx.numbers, mult2), [20, -20, 40, -190, 172, 204, 70, 178, 220]), eq(map(ctx.numbers, mult2), [20, -20, 40, -190, 172, 204, 70, 178, 220])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq(map(ctx.numbers, sub3), [7, -13, 17, -98, 83, 99, 32, 86, 107]), eq(map(ctx.numbers, sub3), [7, -13, 17, -98, 83, 99, 32, 86, 107])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq(map(ctx.numbers, doAll), [19, -21, 39, -191, 171, 203, 69, 177, 219]), eq(map(ctx.numbers, doAll), [19, -21, 39, -191, 171, 203, 69, 177, 219])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
@ -49,7 +49,7 @@ t(({ eq, ctx }) =>
'6: 35', '6: 35',
'7: 89', '7: 89',
'8: 110', '8: 110',
]), ])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
@ -63,53 +63,53 @@ t(({ eq, ctx }) =>
'35 is at index: 6 out of 8', '35 is at index: 6 out of 8',
'89 is at index: 7 out of 8', '89 is at index: 7 out of 8',
'110 is at index: 8 out of 8', '110 is at index: 8 out of 8',
]), ])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq( eq(
map(ctx.sentences[0], arrayFormatSentence).join(''), map(ctx.sentences[0], arrayFormatSentence).join(''),
'Colombia, Mexico, and El Salvador are 3 Spanish speaking countries.', 'Colombia, Mexico, and El Salvador are 3 Spanish speaking countries.'
), )
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq( eq(
map(ctx.sentences[1], arrayFormatSentence).join(''), map(ctx.sentences[1], arrayFormatSentence).join(''),
'Perou, Brazil, Argentina, and Venezuela are 4 countries in South America.', 'Perou, Brazil, Argentina, and Venezuela are 4 countries in South America.'
), )
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq( eq(
map(ctx.sentences[2], arrayFormatSentence).join(''), map(ctx.sentences[2], arrayFormatSentence).join(''),
'France, Portugal, and Italy are 3 members of the EU.', 'France, Portugal, and Italy are 3 members of the EU.'
), )
) )
t(({ eq, ctx }) => t(({ eq }) =>
// map should not flat // map should not flat
eq( eq(
map([1, 2, 3], n => [n, n]), map([1, 2, 3], (n) => [n, n]),
[ [
[1, 1], [1, 1],
[2, 2], [2, 2],
[3, 3], [3, 3],
], ]
), )
) )
// flatMap // flatMap
t(({ eq, ctx }) => t(({ eq }) =>
// flatMap should flatten the result of map // flatMap should flatten the result of map
eq( eq(
flatMap([1, 2, 3], n => [n, n]), flatMap([1, 2, 3], (n) => [n, n]),
[1, 1, 2, 2, 3, 3], [1, 1, 2, 2, 3, 3]
), )
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
eq(flatMap(ctx.mixed, add1), ['101', -9, 21, -94, 87, '1021', '35,891', 111]), eq(flatMap(ctx.mixed, add1), ['101', -9, 21, -94, 87, '1021', '35,891', 111])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
@ -122,7 +122,7 @@ t(({ eq, ctx }) =>
'5: 102', '5: 102',
undefined, undefined,
'7: 110', '7: 110',
]), ])
) )
t(({ eq, ctx }) => t(({ eq, ctx }) =>
@ -135,7 +135,7 @@ t(({ eq, ctx }) =>
'-33 is at index: 5 out of 7', '-33 is at index: 5 out of 7',
'-4 is at index: 6 out of 7', '-4 is at index: 6 out of 7',
'18 is at index: 7 out of 7', '18 is at index: 7 out of 7',
]), ])
) )
Object.freeze(tests) Object.freeze(tests)

3
subjects/currify/README.md

@ -5,9 +5,10 @@
Create the function `currify` that will curry any functions put as argument. Create the function `currify` that will curry any functions put as argument.
example: example:
```js ```js
const mult2 = (el1,el2) => el1 * el2 const mult2 = (el1,el2) => el1 * el2
console.log(mult2(2,2)) // result epected 4 console.log(mult2(2,2)) // result expected 4
const mult2Curried = currify(mult2) const mult2Curried = currify(mult2)

12
subjects/go-reloaded/README.md

@ -643,19 +643,19 @@ student@ubuntu:~/[[ROOT]]/test$
### Instructions ### Instructions
Write a program that has the same behaviour as the system's `cat` command-line. Write a program that behaves like a simplified `cat` command.
- The `options` do not have to be handled. - The `options` do not have to be handled.
- If the program is called without arguments it should take the `input` and print it back (as shown with the "Hello" example below). - If the program is called without arguments it should take the standard input (stdin) and print it back on the standard output (stdout).
- In the program folder create two files named `quest8.txt` and `quest8T.txt`. - In the program folder create two files named `quest8.txt` and `quest8T.txt`.
- Copy to the `quest8.txt` file the following sentence : - Copy to the `quest8.txt` file the following sentence, with a new line ate the end of the file :
`"Programming is a skill best acquired by practice and example rather than from books" by Alan Turing` `"Programming is a skill best acquired by practice and example rather than from books" by Alan Turing`
- Copy to the `quest8T.txt` file the following sentence : - Copy to the `quest8T.txt` file the following sentence, with a new line ate the end of the file :
`"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."` `"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."`
@ -666,7 +666,7 @@ Write a program that has the same behaviour as the system's `cat` command-line.
```console ```console
student@ubuntu:~/[[ROOT]]/cat$ go build student@ubuntu:~/[[ROOT]]/cat$ go build
student@ubuntu:~/[[ROOT]]/cat$ ./cat abc student@ubuntu:~/[[ROOT]]/cat$ ./cat abc
open abc: no such file or directory ERROR: abc: No such file or directory
student@ubuntu:~/[[ROOT]]/cat$ ./cat quest8.txt student@ubuntu:~/[[ROOT]]/cat$ ./cat quest8.txt
"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing "Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing
student@ubuntu:~/[[ROOT]]/cat$ ./cat student@ubuntu:~/[[ROOT]]/cat$ ./cat
@ -853,8 +853,6 @@ student@ubuntu:~/[[ROOT]]/test$
Write a function `SortedListMerge` that merges two lists `n1` and `n2` in ascending order. Write a function `SortedListMerge` that merges two lists `n1` and `n2` in ascending order.
- During the tests `n1` and `n2` will already be initially sorted.
### Expected function and structure ### Expected function and structure
```go ```go

2
subjects/go-reloaded/audit/README.md

@ -576,7 +576,7 @@ slice = [1 2 3 A B C a b c] and f = func(a, b string) int {
###### Does the program displays the content of the file in order? ###### Does the program displays the content of the file in order?
##### Run the program with a diferent file and then run the system program `cat` with the same file. ##### Run the program with a different file and then run the system program `cat` with the same file.
###### Are the outputs identical? ###### Are the outputs identical?

2
subjects/mapper/README.md

@ -8,13 +8,11 @@ and that works like the method .map
- Create a `flatMap` function that takes an array as first argument, a function as second, - Create a `flatMap` function that takes an array as first argument, a function as second,
and that works like the method .flatMap and that works like the method .flatMap
### Notions ### Notions
- [devdocs.io/javascript/global_objects/array/map](https://devdocs.io/javascript/global_objects/array/map) - [devdocs.io/javascript/global_objects/array/map](https://devdocs.io/javascript/global_objects/array/map)
- [devdocs.io/javascript/global_objects/array/flatmap](https://devdocs.io/javascript/global_objects/array/flatmap) - [devdocs.io/javascript/global_objects/array/flatmap](https://devdocs.io/javascript/global_objects/array/flatmap)
### Code provided ### Code provided
> all code provided will be added to your solution and doesn't need to be submited. > all code provided will be added to your solution and doesn't need to be submited.

Loading…
Cancel
Save