Add justfile to build for correct out dir

main
trivernis 10 months ago
parent 6ae8d0b8e4
commit 4c9edbfadb
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -15,7 +15,8 @@ main =
fibWalk : List (Num a), Num a -> List (Num a) fibWalk : List (Num a), Num a -> List (Num a)
fibWalk = \l, n -> fibWalk = \l, n ->
next = when l is next =
when l is
[] | [_] -> fib n [] | [_] -> fib n
[.., a, b] -> a + b [.., a, b] -> a + b
List.append l next List.append l next

@ -0,0 +1,13 @@
set shell := ["nu", "-c"]
default:
print "Select a command"
dev target +FLAGS="": (build target FLAGS)
if ('out/{{target}}' | path exists) { out/{{target}} } else { ^$"out/('{{target}}' | str replace -r '\.roc$' '')" }
build target +FLAGS="--optimize": init
roc build {{FLAGS}} ('{{target}}.roc' | str replace -r '\.roc\.roc$' '.roc') --output out/
init:
mkdir out/

@ -21,11 +21,13 @@ primeWalk = \l, n ->
when n is when n is
Yes n2 -> Yes n2 ->
List.append l n2 List.append l n2
Maybe n2 -> Maybe n2 ->
if isPrimePost l n2 then if isPrimePost l n2 then
List.append l n2 List.append l n2
else else
l l
No _ -> l No _ -> l
isPrimePre : U64 -> PrimeResult isPrimePre : U64 -> PrimeResult
@ -41,7 +43,7 @@ isPrimePre = \n ->
isPrimePost : List U64, U64 -> Bool isPrimePost : List U64, U64 -> Bool
isPrimePost = \l, n -> isPrimePost = \l, n ->
nFloat = (Num.toF64 n) nFloat = Num.toF64 n
valLimit = Num.ceiling (Num.sqrt nFloat) valLimit = Num.ceiling (Num.sqrt nFloat)
# approximate the number of primes < sqrt(n) to limit the range we have to check with a 25% error tolerance # approximate the number of primes < sqrt(n) to limit the range we have to check with a 25% error tolerance
valLimitF = Num.toF64 valLimit valLimitF = Num.toF64 valLimit

Loading…
Cancel
Save