- No performance benchmark.
- Python ⟿
PEP-8
- Nim ⟿
NEP1
- Python ⟿
3.7
- Nim ⟿
0.19
- No Ofuscation, no Code-Golf.
This is to compare elegant, simple, expressive code.
/* Halide.h -- interface for the 'Halide' library. | |
Copyright (c) 2012-2018 MIT CSAIL, Google Inc., and other contributors | |
Developed by: | |
The Halide team | |
http://halide-lang.org | |
Permission is hereby granted, free of charge, to any person obtaining a copy of |
date | |
echo | |
fortune | cowsay -f $(gls /usr/local/Cellar/cowsay/3.04/share/cows/ | gshuf -n1) | |
echo | |
if [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
if [ -f $HOME/.git-completion.bash ]; then |
import | |
deques, options, | |
milagro_crypto, | |
./spec/[datatypes, crypto, digest, helpers, validator], extras, | |
tables, hashes # For BeaconChainDB stub | |
type | |
AttestationCandidate* = object | |
validator*: int | |
data*: AttestationData |
import algorithm | |
func cumsum[T](x: openarray[T]): seq[T] = | |
result = newSeq[T](x.len) | |
result[0] = x[0] | |
for i in 1 ..< x.len: | |
result[i] = x[i] + result[i-1] | |
func searchsorted[T](a, v: openarray[T], leftSide: static bool = true): seq[T] = | |
result = newSeqUninitialized[T](v.len) |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
# Laser | |
# Copyright (c) 2018 Mamy André-Ratsimbazafy | |
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0). | |
# This file may not be copied, modified, or distributed except according to those terms. | |
import | |
math | |
const | |
bits = 10 |
# TODO debug multiplication with negative numbers | |
# Laser | |
# Copyright (c) 2018 Mamy André-Ratsimbazafy | |
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0). | |
# This file may not be copied, modified, or distributed except according to those terms. | |
import ../../simd, math | |
# ############################################################ |
# Laser | |
# Copyright (c) 2018 Mamy André-Ratsimbazafy | |
# Distributed under the Apache v2 License (license terms are at http://www.apache.org/licenses/LICENSE-2.0). | |
# This file may not be copied, modified, or distributed except according to those terms. | |
# Generic microkernel for matrix multiplication | |
import | |
./laser_gemm_tiling, ./laser_gemm_matrix, ./laser_gemm_utils, | |
../../../laser/[cpuinfo, compiler_optim_hints], |
import macros | |
type Kernel = object | |
mr*, nr*: int | |
epilogue*: NimNode | |
template impl(c: var int, x, y: int, | |
mr, nr: static int, epilogue: untyped | |
): untyped = |