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
-- While building custom Setup.hs for package clash-prelude-0.99 using: | |
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.0.0.2_ghc-8.2.1.exe --builddir=.stack-work\dist\e53504d9 build lib:clash-prelude --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always" | |
Process exited with code: ExitFailure 1 | |
Logs have been written to: D:\code\clash-compiler\.stack-work\logs\clash-prelude-0.99.log | |
Configuring clash-prelude-0.99... | |
Warning: | |
This package indirectly depends on multiple versions of the same package. This is very likely to cause a compile failure. | |
package time (time-1.8.0.2-6D7zA6hvj7J2L4fRhEphEi) requires Win32-2.4.0.0-6h2GtvaqnjAGgAinwN44RU | |
package time (time-1.8.0.2) requires Win32-2.5.4.1 |
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
cabal.exe: Error parsing project file | |
D:\code\clash-compiler\cabal.project:6: | |
Parse of field 'allow-newer' failed. |
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
module Core.Shift where | |
import CLaSH.Prelude | |
import CLaSH.Signal | |
import CLaSH.Sized.BitVector | |
import Data.Word | |
import Data.Bits | |
type Word256 = BitVector 256 |
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
-- tweaking `CLaSH.Sized.Vector.vfold` so that an initial vector can be provided/built upon | |
-- reusing the `Append` motive from the main `dfold` example | |
data Append (m :: Nat) (a :: *) (f :: TyFun Nat *) :: * | |
type instance Apply (Append m a) l = Vec (l + m) a | |
vifold :: forall k j a b . (KnownNat k, KnownNat j) | |
=> (forall l . SNat l -> a -> Vec (j + l) b -> Vec (j + l + 1) b) | |
-> Vec j b |
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
-- in `cabal exec clash -- --interactive` | |
CLaSH.Prelude> import Data.Int | |
CLaSH.Prelude Data.Int> let x = 56 :: Int8 | |
CLaSH.Prelude Data.Int> x + x | |
112 | |
-- in `Foo.hs`: | |
module Foo where |
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
(def words (set (.split (slurp "g:/words") "\n"))) | |
=> #'user/words | |
(count words) | |
=> 99171 | |
(require '[clojure.math.combinatorics :refer (permutations)]) | |
=> nil | |
(count (permutations "plates")) | |
=> 720 | |
(first (permutations "plates")) | |
=> (\p \l \a \t \e \s) |
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
#!/usr/bin/bash | |
filename="$1" | |
wait="🕜" | |
# test 🕜🕜🕜🕜pausing | |
function keystroke-delay { | |
delay=`bc <<END | |
scale=2 |
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
; e.g. usage | |
:filespecs [{:type :path :path "source/directory" :root "destination/directory/"}] | |
; at the end of project.clj | |
(require 'leiningen.jar) | |
(in-ns 'leiningen.jar) | |
(defmethod copy-to-jar :path [project jar-os acc spec] | |
(let [root-file (io/file (:path spec)) |
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
; a toy example of a nested reduction; especially when function bodies are nontrivial, or when the nesting | |
; gets much deeper than 2 levels, it's easy to lose track of which values are being reduced over at each | |
; level, etc | |
(let [x {:a [1 2 3] :b [4 5 6]}] | |
(reduce | |
(fn [x [k vs]] | |
(reduce | |
(fn [x v] (update x :sum (fnil + 0) v)) | |
x |