This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
toDigits x | |
| x > 9 = x `mod` 10 : toDigits (x `div` 10) | |
| otherwise = [x] | |
sumFold xs = foldl (\a x -> a*10 + x) 0 xs | |
kaprekar :: Int -> Int -> Int | |
kaprekar x n = let |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains any messages produced by compilers while | |
running configure, to aid debugging if configure makes a mistake. | |
It was created by GNU MP configure 6.2.1, which was | |
generated by GNU Autoconf 2.69. Invocation command line was | |
$ ./configure --prefix /Users/haliq/opt-wasm CC=/opt/wasi-sdk-12.0/bin/clang --host=none --enable-cxx CXX=/opt/wasi-sdk-12.0/bin/clang++ --with-sysroot=/opt/wasi-sysroot | |
## --------- ## | |
## Platform. ## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
euclid :: Integer -> Integer -> Integer | |
euclid a b = case aux a b 0 of | |
0 -> b | |
r -> euclid b r | |
where | |
aux a b q = if b >= a then b - a else aux (a-b) b (q+1) | |
-- get gcd | |
main = do | |
a <- readLn :: IO Integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
Online C++ Compiler. | |
Code, Compile, Run and Debug C++ program online. | |
Write your code in this editor and press "Run" button to compile and execute it. | |
*******************************************************************************/ | |
#include <iostream> | |
#include <string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let global_nctx = ref Kernel.Context.empty | |
let global_ectx = ref Kernel.Context.empty | |
let js_run_repl str = | |
match String.(compare str "quit") with | |
| 0 -> "bye" | |
| _ -> | |
match String.(compare str "reset") with | |
| 0 -> | |
global_nctx := Kernel.Context.empty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rate[x_] := rated[x*365] | |
rated[x_] := | |
If[x < 7, 1.5, | |
If[x < 30.4167, 3, If[x < 365/2, 5, If[x < 365, 17, 30]]]] | |
f[ip_, r_, p_, t_, n_] := | |
If[t <= 0, ip, | |
If[t < p, ip + ip*r*t - rate[t], | |
f[ip + (ip * r * p) - rate[p] - rate[0]*n, r, p, (t - p), n + 1]]] | |
g[ip_, r_, t_] := ip + ip*r*t - rate[t] | |
init := 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE read Responses.java first itll make more sense | |
public class CreateInputCommand implements ResponseFunc { | |
private String front = ""; | |
private String back = ""; | |
// handle types?? | |
@Override | |
public boolean funcCall(String i, State s) { | |
if (s.state == StateEnum.CREATE_STATE_FRONT) { | |
front = i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my motivation to use enum is so you dont need to create new objects everytime a command is executed | |
// instead you simply call a static method. and to iterate through a list of static methods we use enums. | |
// So this is a typical enum u encounter all the time | |
enum MyEnum { | |
A, B, C; | |
} | |
// However enums are capable of having properties and methods! | |
// if u define a method in an enum all enums will have it | |
// e.g. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.core; | |
import com.core.savedata.SaveFile; | |
import com.util.datetime.DateTime; | |
import com.util.datetime.DateTimeParse; | |
import java.util.stream.IntStream; | |
import com.util.Printer; | |
import com.tasks.Deadline; | |
import com.tasks.DoableTask; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.core; | |
public enum Response { | |
BYE("(?i)^b(ye)?\\s*", (i, s) -> { | |
Printer.printString("Bye. Hope to see you again soon!"); | |
s.toExit = true; | |
s.lastError = false; | |
return true; | |
}), | |
RESPONDER_NAME("regex", (commandInput, programState) -> { |
NewerOlder