Skip to content

Commit

Permalink
remove pub keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed May 2, 2024
1 parent d7388a5 commit 4933162
Show file tree
Hide file tree
Showing 24 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion math/abs.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn Abs(mut n: f64): f64 {
fn Abs(mut n: f64): f64 {
if n < 0 {
n = -n
}
Expand Down
2 changes: 1 addition & 1 deletion math/fact.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn Fact(n: f64): f64 {
fn Fact(n: f64): f64 {
if n == 0 {
ret 1
}
Expand Down
4 changes: 2 additions & 2 deletions math/fib.jule
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// O(2^n)
pub fn Fib(i: int): int {
fn Fib(i: int): int {
if i == 0 || i == 1 {
ret i
}
ret Fib(i - 1) + Fib(i - 2)
}

// O(n * 2^n)
pub fn FibSeq(mut n: int): []int {
fn FibSeq(mut n: int): []int {
let mut s: []int
let mut i = n
for i > 0 {
Expand Down
2 changes: 1 addition & 1 deletion math/max.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn Max(values: ...int): int {
fn Max(values: ...int): int {
if values.len == 0 {
ret 0
}
Expand Down
2 changes: 1 addition & 1 deletion math/median.jule
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use sort::{QuickSort}

pub fn Median(mut slice: []int): f64 {
fn Median(mut slice: []int): f64 {
slice = QuickSort(slice)
let l = slice.len
match {
Expand Down
2 changes: 1 addition & 1 deletion math/min.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn Min(values: ...int): int {
fn Min(values: ...int): int {
if values.len == 0 {
ret 0
}
Expand Down
2 changes: 1 addition & 1 deletion math/q_rsqrt.jule
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use math for std::math

// Fast inverse square root.
// See: https://en.wikipedia.org/wiki/Fast_inverse_square_root
pub fn QRsqrt(mut f: f64): f64 {
fn QRsqrt(mut f: f64): f64 {
const ThreeHalfs = 1.5
const Magic = 0x5FE6EB50C7B537A9

Expand Down
2 changes: 1 addition & 1 deletion math/sum.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn Sum(slice: []int): int {
fn Sum(slice: []int): int {
let mut total: int = 0
for _, i in slice {
total += i
Expand Down
2 changes: 1 addition & 1 deletion search/binary_search.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn BinarySearch(s: []int, i: int): (pos: int) {
fn BinarySearch(s: []int, i: int): (pos: int) {
let mut b = 0
let mut e = s.len - 1
for b <= e {
Expand Down
2 changes: 1 addition & 1 deletion search/linear_search.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn LinearSearch(s: []int, i: int): (pos: int) {
fn LinearSearch(s: []int, i: int): (pos: int) {
for j, x in s {
if x == i {
ret j
Expand Down
2 changes: 1 addition & 1 deletion sort/bubble_sort.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn BubbleSort(mut s: []int): []int {
fn BubbleSort(mut s: []int): []int {
let mut swapped = true
for swapped {
swapped = false
Expand Down
2 changes: 1 addition & 1 deletion sort/exchange_sort.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn ExchangeSort(mut s: []int): []int {
fn ExchangeSort(mut s: []int): []int {
let mut i = 0
for i < s.len-1; i++ {
let mut j = i + 1
Expand Down
2 changes: 1 addition & 1 deletion sort/insertion_sort.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn InsertionSort(mut s: []int): []int {
fn InsertionSort(mut s: []int): []int {
let mut currentIndex = 1
for currentIndex < s.len; currentIndex++ {
let temporary = s[currentIndex]
Expand Down
2 changes: 1 addition & 1 deletion sort/quick_sort.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn QuickSort(mut s: []int): []int {
fn QuickSort(mut s: []int): []int {
if s.len <= 1 {
ret s
}
Expand Down
2 changes: 1 addition & 1 deletion sort/selection_sort.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn SelectionSort(mut s: []int): []int {
fn SelectionSort(mut s: []int): []int {
let mut i = 0
for i < s.len; i++ {
let mut min = i
Expand Down
2 changes: 1 addition & 1 deletion sort/shell_sort.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn ShellSort(mut s: []int): []int {
fn ShellSort(mut s: []int): []int {
let mut d = int(s.len / 2)
for d > 0; d /= 2 {
let mut i = d
Expand Down
2 changes: 1 addition & 1 deletion sort/simple_sort.jule
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn SimpleSort(mut s: []int): []int {
fn SimpleSort(mut s: []int): []int {
let mut i = 1
for i < s.len; i++ {
let mut j = 0
Expand Down
2 changes: 1 addition & 1 deletion string/atoi.jule
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn isNbr(b: byte): bool {
ret b >= '0' && b <= '9'
}

pub fn Atoi(s: str): int {
fn Atoi(s: str): int {
let mut result = 0
let mut sign = 1
let mut i = 0
Expand Down
2 changes: 1 addition & 1 deletion string/capitalize.jule
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Capitalize("12345")
"12345"
*/

pub fn Capitalize(mut s: str): str {
fn Capitalize(mut s: str): str {
ret UpperCase((str)(s[0])) + LowerCase(s[1:])
}
2 changes: 1 addition & 1 deletion string/is_alpha.jule
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ IsAlpha("Foo Bar")
false
*/

pub fn IsAlpha(s: str): bool {
fn IsAlpha(s: str): bool {
let mut state: bool = false
for _, c in s {
if c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' {
Expand Down
2 changes: 1 addition & 1 deletion string/is_digit.jule
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ IsDigit("123 45")
false
*/

pub fn IsDigit(digit: str): bool {
fn IsDigit(digit: str): bool {
let mut state: bool = false
for _, n in digit {
if n >= '0' && n <= '9' {
Expand Down
2 changes: 1 addition & 1 deletion string/lower_case.jule
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LowerCase("Foo 123")
"foo 123"
*/

pub fn LowerCase(mut s: str): str {
fn LowerCase(mut s: str): str {
for i, c in s {
if c >= 'A' && c <= 'Z' {
s[i] = 'z' - ('Z' - c)
Expand Down
2 changes: 1 addition & 1 deletion string/reverse.jule
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Reverse("FooBar")
"raBooF"
*/

pub fn Reverse(mut s: str): str {
fn Reverse(mut s: str): str {
let mut i = 0
for i < s.len/2; i++ {
s[i], s[s.len-i-1] = s[s.len-i-1], s[i]
Expand Down
2 changes: 1 addition & 1 deletion string/upper_case.jule
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ upperCase("Foo 123")
"FOO 123"
*/

pub fn UpperCase(mut s: str): str {
fn UpperCase(mut s: str): str {
for i, c in s {
if c >= 'a' && c <= 'z' {
s[i] = 'Z' - ('z' - c)
Expand Down

0 comments on commit 4933162

Please sign in to comment.