<commit_before>### Q.1<br>

```scala
def signum(number:Int) : Int = if(number >= 0) number else -number
```
<br>
In *Groovy* it might look like:

```groovy
def signum = {number -> if(number >= 0) number else -number}

signum(4)
signum(-4)
```

### Q.2<br>

Run the following in a worksheet:
```scala
val empty = {}
```
<br>
You see that the value is *( )* and the type is *Unit*.
<br>

### Q.4<br>

```scala
for(i <- 10.to(0, -1)) println(i)
```
<br>
In *Groovy* it might look like:

```groovy
(10..0).each{println(it)}
```
<br>


### Q.5<br>
```scala
def countdown(n: Int) = for(i <- n.to(0, -1)) println(i)
```
<br>

### Q.6<br>
```scala
def unicodes(s: String): Long = {
  (for(i <- 0 until s.length()) yield s.codePointAt(i).toLong) product
}  
 ```
<br>

### Q.7/8/9<br>
My initial stab at this was:
```scala<commit_msg>Update chapter2.md<commit_after>### Q.1<br>

```scala
def signum(number:Int) : Int = if(number >= 0) number else -number
```
<br>
In Groovy it might look like:

```groovy
def signum = {number -> if(number >= 0) number else -number}

signum(4)
signum(-4)
```

### Q.2<br>

Run the following in a worksheet:
```scala
val empty = {}
```
<br>
You see that the value is *( )* and the type is *Unit*.
<br>

### Q.4<br>

```scala
for(i <- 10.to(0, -1)) println(i)
```
<br>
In Groovy it might look like:

```groovy
(10..0).each{println(it)}
```
<br>


### Q.5<br>
```scala
def countdown(n: Int) = for(i <- n.to(0, -1)) println(i)
```
In Groovy:
```groovy
def countdown = {n-> (n..0).each{println(it)}}
countdown(10)
```
<br>

### Q.6<br>
```scala
def unicodes(s: String): Long = {
  (for(i <- 0 until s.length()) yield s.codePointAt(i).toLong) product
}  
 ```
<br>

### Q.7/8/9<br>
My initial stab at this was:
```scala
{'fraction_non_alphanumeric': 0.23949337938975246, 'fraction_numerical': 0.027633851468048358, 'mean_word_length': 3.8412256267409473, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5136590', 'n_tokens_mistral': 818, 'n_tokens_neox': 744, 'n_words': 208}