Skip to content

Commit

Permalink
feat(languages): add support for Jule
Browse files Browse the repository at this point in the history
  • Loading branch information
adamperkowski committed Feb 2, 2025
1 parent 68930d5 commit 3d3a563
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gengo/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,13 @@ Jsonnet:
extensions:
- jsonnet
- libsonnet
Jule:
category: programming
color: "#5F7489"
nerd-font-glyph: "\U0000e80c"
matchers:
extensions:
- jule
Julia:
category: programming
color: "#9558B2"
Expand Down
41 changes: 41 additions & 0 deletions samples-test/samples/Jule/generic.jule
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Source: https://github.com/github-linguist/linguist/blob/864316de29403c4be224a2de573e53724e8f2546/samples/Jule/generic.jule

use "std/math/rand"
use "std/time"

fn Max[S: []E, E: ordered](mut s: S): E {
if len(s) == 0 {
panic("Max: empty slice")
}
mut m := s[0]
for _, e in s[1:] {
if m < e {
m = e
}
}
ret m
}

fn Min[S: []E, E: ordered](mut s: S): E {
if len(s) == 0 {
panic("Min: empty slice")
}
mut m := s[0]
for _, e in s[1:] {
if m > e {
m = e
}
}
ret m
}

fn main() {
rand := rand::Rand.New(rand::NewSource(u64(time::Now().Nanosecond())))
mut s := make([]int, 10)
for i in s {
s[i] = rand.Intn(100)
}
println(s)
println(Max(s))
println(Min(s))
}

0 comments on commit 3d3a563

Please sign in to comment.