_id stringlengths 64 64 | repository stringlengths 6 84 | name stringlengths 4 110 | content stringlengths 0 248k | license null | download_url stringlengths 89 454 | language stringclasses 7
values | comments stringlengths 0 74.6k | code stringlengths 0 248k |
|---|---|---|---|---|---|---|---|---|
e7bddffd43649581c4c224b87830abe799d26716b492235c385d782edb37d4ef | thephoeron/black-stone | qclambda.lisp | -*- Mode : LISP ; Syntax : COMMON - LISP ; Package : BLACK - STONE ; Base : 10 -*-
;;;; file: qclambda/qclambda.lisp
Copyright ( c ) 2013 - -2015 , " the Phoeron " < //thephoeron.com >
;;;; See LICENSE for additional information.
(in-package :black-stone)
;; Top-level functions and external API
(defvar *post... | null | https://raw.githubusercontent.com/thephoeron/black-stone/c8f1d76d81de3c9862520c8ddac62e73e831ea55/qclambda/qclambda.lisp | lisp | Syntax : COMMON - LISP ; Package : BLACK - STONE ; Base : 10 -*-
file: qclambda/qclambda.lisp
See LICENSE for additional information.
Top-level functions and external API
*T*
it's a measurement so split state and return list of results
0 branch |
Copyright ( c ) 2013 - -2015 , " the Phoeron " < //thephoeron.com >
(in-package :black-stone)
(defun run-qsys (qsys)
"Takes a quantum system and returns the list of quantum systems that
results from the execution of its program."
(if (or (null (program qsys))
(zerop (prior-probability qsys)))
... |
b0e6c326a8fcbc80c9175391c246fa8441548566486bfe6b71539d5814a13a8d | jgoerzen/twidge | OAuth.hs | hpodder component
Copyright ( C ) 2010 < >
This program is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program... | null | https://raw.githubusercontent.com/jgoerzen/twidge/1efa65da2c2c21fbed05590f4a22b34c9085244f/OAuth.hs | haskell | hpodder component
Copyright ( C ) 2010 < >
This program is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program... | |
1537509c983cb4d3e184befc4c39cb189c96343d9349360d67bc9d9c95254527 | mfp/obigstore | test_protocol.ml |
* Copyright ( C ) 2011 - 2012 < >
*
* This library is free software ; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version , ... | null | https://raw.githubusercontent.com/mfp/obigstore/1b078eeb21e11c8de986717150c7108a94778095/test/test_protocol.ml | ocaml |
* Copyright ( C ) 2011 - 2012 < >
*
* This library is free software ; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version , ... | |
08855bbfe9a4528cd159daa1c7734eeb97c54cd01eef65cd616fbb85e711908b | lem-project/lem | 8bit.lisp | (uiop:define-package :lem-encodings-table/8bit
(:use :cl)
(:export :generate-table))
(in-package :lem-encodings-table/8bit)
(defun map-bytes (fun)
(loop for c from #x00 to #xff
do (funcall fun c)))
(defun generate-table (file code)
(with-open-file (out file
:direction :output
... | null | https://raw.githubusercontent.com/lem-project/lem/2efd909118a24434623907330de7302143358f1c/lib/encodings/encodings-table/8bit.lisp | lisp | (uiop:define-package :lem-encodings-table/8bit
(:use :cl)
(:export :generate-table))
(in-package :lem-encodings-table/8bit)
(defun map-bytes (fun)
(loop for c from #x00 to #xff
do (funcall fun c)))
(defun generate-table (file code)
(with-open-file (out file
:direction :output
... | |
d094cafe5fa10eedbf7b0f8b4076379a8bc8e0e33f0a3c90baa9fb20e0167570 | circuithub/rel8 | Null.hs | # language DataKinds #
{-# language FlexibleContexts #-}
# language FlexibleInstances #
# language MultiParamTypeClasses #
{-# language ScopedTypeVariables #-}
# language StandaloneKindSignatures #
# language TypeApplications #
{-# language TypeFamilies #-}
{-# language UndecidableInstances #-}
module Rel8.Table.Null
... | null | https://raw.githubusercontent.com/circuithub/rel8/58a7ecdc4ebe6ad0fdef359cfc6b18d85b1f55a5/src/Rel8/Table/Null.hs | haskell | # language FlexibleContexts #
# language ScopedTypeVariables #
# language TypeFamilies #
# language UndecidableInstances #
base
comonad
rel8
| @NullTable t@ is the table @t@, but where all the columns in @t@ have the
possibility of being 'Rel8.null'. This is very similar to
'Rel8.MaybeTable', except that it does ... | # language DataKinds #
# language FlexibleInstances #
# language MultiParamTypeClasses #
# language StandaloneKindSignatures #
# language TypeApplications #
module Rel8.Table.Null
( NullTable(..)
, nullableTable, nullTable, nullifyTable, unsafeUnnullifyTable
, isNullTable, isNonNullTable
, nameNullTable
, to... |
55ef1af87d33e4047b0e00f6740ba19c921bffa20b17f6c637992a26bebf11cc | elaforge/karya | Set.hs | Copyright 2013
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or -3.0.txt
-- | Extra utils for "Data.Set".
module Util.Set where
import qualified Data.Set as Set
-- | Find a key at or below the given one.
lookup_below :: Ord k => k -> Set.Set k -> Maybe k
loo... | null | https://raw.githubusercontent.com/elaforge/karya/471a2131f5a68b3b10b1a138e6f9ed1282980a18/Util/Set.hs | haskell | This program is distributed under the terms of the GNU General Public
License 3.0, see COPYING or -3.0.txt
| Extra utils for "Data.Set".
| Find a key at or below the given one. | Copyright 2013
module Util.Set where
import qualified Data.Set as Set
lookup_below :: Ord k => k -> Set.Set k -> Maybe k
lookup_below k set = case Set.splitMember k set of
(_, True, _) -> Just k
(below, False, _) -> find_max below
| Safe versions of findMin and .
find_min :: Set.Set k -> Maybe k
find... |
bf57f3c56fd791c845221ee8081cdeaf828498002aed92f28486fca6a6cc9295 | KestrelInstitute/Specware | Tests.lisp | (test-directories ".")
(test
("Bug 0109 : Declarations not printed"
:show "DeclsRequired"
:output '(";;; Elaborating spec at $TESTDIR/DeclsRequired"
(:optional "")
"spec"
(:optional "")
"type YesNo = | No | Yes"
(:optional "")
"type Affirm = | Ok | Sure | Yes"
(:optional "")... | null | https://raw.githubusercontent.com/KestrelInstitute/Specware/2be6411c55f26432bf5c9e2f7778128898220c24/TestSuite/Bugs/Bug_0109/Tests.lisp | lisp | (test-directories ".")
(test
("Bug 0109 : Declarations not printed"
:show "DeclsRequired"
:output '(";;; Elaborating spec at $TESTDIR/DeclsRequired"
(:optional "")
"spec"
(:optional "")
"type YesNo = | No | Yes"
(:optional "")
"type Affirm = | Ok | Sure | Yes"
(:optional "")... | |
d42d59f23c520b6c15b68898a1d03f9daac8ff60ef62ae98debda8a3e5026fcb | dparis/gen-phzr | physics_body.cljs | (ns phzr.impl.accessors.component.physics-body)
(def physics-body-get-properties
{:body "body"
:x "x"
:y "y"})
(def physics-body-set-properties
{:body "body"
:x "x"
:y "y"}) | null | https://raw.githubusercontent.com/dparis/gen-phzr/e4c7b272e225ac343718dc15fc84f5f0dce68023/out/impl/accessors/component/physics_body.cljs | clojure | (ns phzr.impl.accessors.component.physics-body)
(def physics-body-get-properties
{:body "body"
:x "x"
:y "y"})
(def physics-body-set-properties
{:body "body"
:x "x"
:y "y"}) | |
d95f2c2264859665ada5e73754fd7f3fa619f361649fbe35be0320958d9283ef | Toxaris/pts | Main.hs | {-# LANGUAGE NoMonomorphismRestriction, FlexibleContexts #-}
module PTS.Process.Main where
import Control.Monad.Assertions (checkAssertions)
import Control.Monad.Errors
import Control.Monad.Reader (runReaderT)
import Control.Monad.State (MonadState, evalStateT)
import Control.Monad.Trans (MonadIO, liftIO)
import Contr... | null | https://raw.githubusercontent.com/Toxaris/pts/1700024f47bc9d28528b68fc815d2421f5d25b84/src-lib/PTS/Process/Main.hs | haskell | # LANGUAGE NoMonomorphismRestriction, FlexibleContexts #
This shares the state across files. | module PTS.Process.Main where
import Control.Monad.Assertions (checkAssertions)
import Control.Monad.Errors
import Control.Monad.Reader (runReaderT)
import Control.Monad.State (MonadState, evalStateT)
import Control.Monad.Trans (MonadIO, liftIO)
import Control.Monad.Log (runConsoleLogT)
import qualified Data.Set as S... |
21882b1eaa4f7868ea7f84d28198f2374526419164c58f96d4bcdf9d05e570c7 | Vlix/safe-json | Types.hs | # LANGUAGE CPP #
# LANGUAGE FlexibleInstances #
# LANGUAGE TypeFamilies #
module Types where
import Control.Monad (when)
import Data.Aeson
import Data.Aeson.Types (Parser)
import Data.Hashable (Hashable(..))
import Data.Maybe (isJust)
#if MIN_VERSION_base(4,11,0)
#else
import Data.Monoid ((<>))
#endif
import Data.Tex... | null | https://raw.githubusercontent.com/Vlix/safe-json/e556086c3c0e8cad8d636b36b7b62878748090c1/test/Types.hs | haskell | --------------------------------------------------------
--------------------------------------------------------
--------------------------------------------------------
Simple Version
-------------------------------------------------------- | # LANGUAGE CPP #
# LANGUAGE FlexibleInstances #
# LANGUAGE TypeFamilies #
module Types where
import Control.Monad (when)
import Data.Aeson
import Data.Aeson.Types (Parser)
import Data.Hashable (Hashable(..))
import Data.Maybe (isJust)
#if MIN_VERSION_base(4,11,0)
#else
import Data.Monoid ((<>))
#endif
import Data.Tex... |
3ebe5b19a60dc043fe3fe5acb1a1e71f385cc328a4639e6bb301d4376dbc6bac | haskell-compat/base-compat | CompatSpec.hs | module Foreign.Marshal.Alloc.CompatSpec (main, spec) where
import Test.Hspec
import Control.Exception
import Foreign.Marshal.Alloc.Compat
import Foreign.Storable
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "calloc" $
it "allocates memory with bytes o... | null | https://raw.githubusercontent.com/haskell-compat/base-compat/847aa35c4142f529525ffc645cd035ddb23ce8ee/base-compat-batteries/test/Foreign/Marshal/Alloc/CompatSpec.hs | haskell | module Foreign.Marshal.Alloc.CompatSpec (main, spec) where
import Test.Hspec
import Control.Exception
import Foreign.Marshal.Alloc.Compat
import Foreign.Storable
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "calloc" $
it "allocates memory with bytes o... | |
34f5d30f60a6d194bf52d552ec2d7fb55e3403bed81bd118b2f2aa50c71ceb68 | naoiwata/sicp | q2.46.scm | ;; @author naoiwata
SICP Chapter2
question 2.46
(define (make-vect x y)
(cons x y))
(define (xcor-vect vec)
(car vec))
(define (ycor-vect vec)
(cdr vec))
; add-vect
(define (add-vect a b)
(make-vect
(+ (xcor-vect a) (xcor-vect b))
(+ (ycor-vect a) (ycor-vect b))))
; sub-vect
(define (sub-vect a b)
(ma... | null | https://raw.githubusercontent.com/naoiwata/sicp/7314136c5892de402015acfe4b9148a3558b1211/chapter2/q2.46.scm | scheme | @author naoiwata
add-vect
sub-vect
scale-vect
test
(-2 . -2)
END | SICP Chapter2
question 2.46
(define (make-vect x y)
(cons x y))
(define (xcor-vect vec)
(car vec))
(define (ycor-vect vec)
(cdr vec))
(define (add-vect a b)
(make-vect
(+ (xcor-vect a) (xcor-vect b))
(+ (ycor-vect a) (ycor-vect b))))
(define (sub-vect a b)
(make-vect
(- (xcor-vect a) (xcor-vect b))
... |
266d45c5dc7584b83f5f283af0c6b4c93316f1de73f9b54038e5c42e0ea30e45 | hkuplg/fcore | TypeCheck.hs | {-# LANGUAGE TypeSynonymInstances #-}
# LANGUAGE FlexibleInstances #
# LANGUAGE RecordWildCards #
# OPTIONS_GHC -fno - warn - incomplete - patterns #
|
Module :
Description : Type checker for the source language .
Copyright : ( c ) 2014—2015 The F2J Project Developers ( given in AUTHORS.txt )
... | null | https://raw.githubusercontent.com/hkuplg/fcore/e27b6dec5bfd319edb8c3e90d94a993bcc7b4c95/frontend/typecheck/TypeCheck.hs | haskell | # LANGUAGE TypeSynonymInstances #
For REPL
Temporary hack for REPL
Just result ->
case result of
IsTypeVar UnConstrained -> False
check should n't be aware of the type synonym feature .
IsTypeAlias _ ->
text "Type alias" <+> code (text a) <+> text "should already have ... | # LANGUAGE FlexibleInstances #
# LANGUAGE RecordWildCards #
# OPTIONS_GHC -fno - warn - incomplete - patterns #
|
Module :
Description : Type checker for the source language .
Copyright : ( c ) 2014—2015 The F2J Project Developers ( given in AUTHORS.txt )
License : BSD3
Maintainer ... |
2ba8fe0777d5752bcc32db041b5c1a3af264bf460d8ba3dd31e59dc9ac26a519 | rowangithub/DOrder | splaytree.ml | type 'a tree =
Empty
| Node of 'a tree * 'a * 'a tree
Representation invariant : given a node ( L , V , R ) ,
* All values in the left subtree L are less than V , and
* all values in the right subtree R are greater than V , and
* both L and R also satisfy the RI .
* All values in the... | null | https://raw.githubusercontent.com/rowangithub/DOrder/e0d5efeb8853d2a51cc4796d7db0f8be3185d7df/tests/reachability/splaytree.ml | ocaml | type set = int * (tree ref)
Representation invariant: size is the number of elements in
* the referenced tree.
let empty () = (0, ref Empty)
splay(n,k) is a BST node n' where n' contains
* all the elements that n does, and if an
* element keyed by k is in under n, #value n'
* is that element. Requires:... | type 'a tree =
Empty
| Node of 'a tree * 'a * 'a tree
Representation invariant : given a node ( L , V , R ) ,
* All values in the left subtree L are less than V , and
* all values in the right subtree R are greater than V , and
* both L and R also satisfy the RI .
* All values in the... |
efc41da86ed0831d6e9bff145b5b2ae443de507c54f531160b5fc65206fef5f6 | racket/web-server | util.rkt | #lang racket
(provide write-response)
(require web-server/private/timer
web-server/private/connection-manager
web-server/http/response
(file "../util.rkt"))
(define (write-response tm r [redact? #t])
(define-values (i-port o-port) (make-pipe))
(define conn
(connection 0 (start-time... | null | https://raw.githubusercontent.com/racket/web-server/f718800b5b3f407f7935adf85dfa663c4bba1651/web-server-test/tests/web-server/http/util.rkt | racket | #lang racket
(provide write-response)
(require web-server/private/timer
web-server/private/connection-manager
web-server/http/response
(file "../util.rkt"))
(define (write-response tm r [redact? #t])
(define-values (i-port o-port) (make-pipe))
(define conn
(connection 0 (start-time... | |
4f9e01b18ebcd5c5aaeec56b792454890707c440d44bf3d8c2810e2044c20dac | nklein/Roto-Mortar | font.lisp | (in-package :roto-mortar)
;; see blog post for documentation of what follows:
;; -text-with-cl-opengl-and-zpb-ttf
(defun draw-quad (bx1 by1 bx2 by2)
(gl:with-primitives :quads
(gl:vertex bx1 by1)
(gl:vertex bx2 by1)
(gl:vertex bx2 by2)
(gl:vertex bx1 by2)))
(defun make-interpolator (ss cc ee)
(... | null | https://raw.githubusercontent.com/nklein/Roto-Mortar/dd3bb63aa6a377ee4b359921c8d46a94d2847227/src/font.lisp | lisp | see blog post for documentation of what follows:
-text-with-cl-opengl-and-zpb-ttf
antialias lines
fill stencil buffer with filled-in-glyph
fill in area subject to stencil | (in-package :roto-mortar)
(defun draw-quad (bx1 by1 bx2 by2)
(gl:with-primitives :quads
(gl:vertex bx1 by1)
(gl:vertex bx2 by1)
(gl:vertex bx2 by2)
(gl:vertex bx1 by2)))
(defun make-interpolator (ss cc ee)
(let ((xx (+ ss (* -2 cc) ee))
(yy (* 2 (- cc ss)))
(zz ss))
#'(lambda (tt)
(+ (* x... |
e9d99ba87ce5a5fced7f81b3bba41ea6fa432ec8263d42cbe45b82d95190b869 | graninas/The-Amoeba-World | Runtime.hs | module Amoeba.GameLogic.Language.Translation.Runtime where
import Control.Monad (when, liftM)
import Control.Monad.State
import Control.Monad.Trans.Either as E
import Data.Maybe (catMaybes)
import qualified Data.Map as M
import Prelude hiding (log)
import Amoeba.GameLogic.Data.World
import Amoeba.GameLogic.Data.Objec... | null | https://raw.githubusercontent.com/graninas/The-Amoeba-World/a147cd4dabf860bec8a6ae1c45c02b030916ddf4/src/Amoeba/GameLogic/Language/Translation/Runtime.hs | haskell | TODO: use Lenses to update it.
Makes from rules list the list of context modifiers.
Folds the new list with applying to current context.
Specific
TODO: use Lenses to update it.
TODO: use Lenses to update it. | module Amoeba.GameLogic.Language.Translation.Runtime where
import Control.Monad (when, liftM)
import Control.Monad.State
import Control.Monad.Trans.Either as E
import Data.Maybe (catMaybes)
import qualified Data.Map as M
import Prelude hiding (log)
import Amoeba.GameLogic.Data.World
import Amoeba.GameLogic.Data.Objec... |
c7720706f7cc7f513439df36c9e20b882b4d33c1cd972ab77bfe6c291561eda0 | mirage/ocaml-xenstore-server | handler.ml |
* Copyright ( C ) Citrix Systems Inc.
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation ; version 2.1 only . with the special
* exception on linking described in file LI... | null | https://raw.githubusercontent.com/mirage/ocaml-xenstore-server/2a8ae397d2f9291107b5d9e9cfc6085fde8c0982/kernelspace/handler.ml | ocaml | the cmd_line should have --event %d set by init-xenstore-domain.c |
* Copyright ( C ) Citrix Systems Inc.
*
* This program is free software ; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation ; version 2.1 only . with the special
* exception on linking described in file LI... |
7faf502e04ba7e8cf4272369b87d217ed5417bd03550b36a0dc70a9cdb24149f | ymherklotz/verismith | Parser.hs | -- |
Module : . Verilog . Parser
Description : Minimal Verilog parser to reconstruct the AST .
Copyright : ( c ) 2019 - 2022 ,
-- License : GPL-3
-- Maintainer : yann [at] yannherklotz [dot] com
-- Stability : experimental
-- Portability : POSIX
--
Minimal Verilog parser to reconstruct the AS... | null | https://raw.githubusercontent.com/ymherklotz/verismith/e02fc4561b9db1bd695be4436c5cd6d6695ef9c4/src/Verismith/Verilog/Parser.hs | haskell | |
License : GPL-3
Maintainer : yann [at] yannherklotz [dot] com
Stability : experimental
Portability : POSIX
** Internal parsers
| This parser succeeds whenever the given predicate returns true when called
with parsed `Token`. Same as 'Text.Parsec.Char.satisfy'.
| Parse a Number depending on if it is i... | Module : . Verilog . Parser
Description : Minimal Verilog parser to reconstruct the AST .
Copyright : ( c ) 2019 - 2022 ,
Minimal Verilog parser to reconstruct the AST . This parser does not support the
whole Verilog syntax , as the AST does not support it either .
module Verismith.Verilog.Parser
... |
aa1fbca7d23307b5762b25044901889eecc1d63ac1296c5d3a7d75edd3aeaff0 | argp/bap | test_random.ml | open OUnit
open BatPervasives
let assert_equal_arrays =
assert_equal ~printer:(BatIO.to_string (BatArray.print BatInt.print))
let take_array n e = BatArray.of_enum (BatEnum.take n e)
let test_enum_helper reset create modify =
let make n = take_array n (create ()) in
(* Enumerations constructed for the same st... | null | https://raw.githubusercontent.com/argp/bap/2f60a35e822200a1ec50eea3a947a322b45da363/batteries/testsuite/test_random.ml | ocaml | Enumerations constructed for the same state should be equal.
Wrapper that assures that [cmd] does not modify the default state. | open OUnit
open BatPervasives
let assert_equal_arrays =
assert_equal ~printer:(BatIO.to_string (BatArray.print BatInt.print))
let take_array n e = BatArray.of_enum (BatEnum.take n e)
let test_enum_helper reset create modify =
let make n = take_array n (create ()) in
let () = reset () in
let a = make 10 in
... |
4b5cf946d15bc9af65c17870b9fee8f03b03797582565e0ce5f433cd541078a5 | maranget/hevea | color.mli | (***********************************************************************)
(* *)
(* HEVEA *)
(* *)
, projet PARA , INR... | null | https://raw.githubusercontent.com/maranget/hevea/226eac8c506f82a600d453492fbc1b9784dd865f/color.mli | ocaml | *********************************************************************
HEVEA
... | , projet PARA , INRIA Rocquencourt
Copyright 1998 Institut National de Recherche en Informatique et
Automatique . Distributed only by permission .
" $ I d : color.mli , v 1.6 2005 - 03 - 08 15:15:03 maranget Exp $ "
"$Id: color.mli,v 1.6 2005-03-08 15:15:... |
d29ee58a6a7e5658018907e4789dabf68c5f7ce53385a8a4b24ec41563ffddd0 | bvaugon/ocapic | ocapic.ml | (*************************************************************************)
(* *)
(* OCaPIC *)
(* *)
... | null | https://raw.githubusercontent.com/bvaugon/ocapic/9d68039e3c861f24dd31d70f93e29a7ed0f284fd/src/ocapic/ocapic.ml | ocaml | ***********************************************************************
OCaPIC
... |
This file is distributed under the terms of the CeCILL license .
type gc_algo = Stop_and_copy | Mark_and_compact;;
let pic_segment_nb = 15;;
let compile_only = ref false;;
let output_file = ref None;;
let verbose = ref false;;
let pp_commands = re... |
2de7355f62339d32926684e96e9246f261253635549d9a00ad22ee0f9c9fe3e7 | CompSciCabal/SMRTYPRTY | ynasser-2.3.2.rkt | #lang racket
(require "ynasser-sicp.rkt")
Exercise 2.56
(define (exponentiation? x)
(and (pair? x) (eq? (car x) '**)))
(define (base x)
(car (cdr x)))
(define (exponent x)
(car (cdr (cdr x))))
(define (make-exponentiation b e)
(cond
[(equal? 0 e) 1]
[(equal? 1 e) b]
[(andmap number? (list b ... | null | https://raw.githubusercontent.com/CompSciCabal/SMRTYPRTY/4a5550789c997c20fb7256b81469de1f1fce3514/sicp/v1/chapter-2.3/ynasser-2.3.2.rkt | racket | See "ynasser-sicp.rkt"
Exercise 2.58a
(x + 3 * (x + y + 2)) | #lang racket
(require "ynasser-sicp.rkt")
Exercise 2.56
(define (exponentiation? x)
(and (pair? x) (eq? (car x) '**)))
(define (base x)
(car (cdr x)))
(define (exponent x)
(car (cdr (cdr x))))
(define (make-exponentiation b e)
(cond
[(equal? 0 e) 1]
[(equal? 1 e) b]
[(andmap number? (list b ... |
389b79f445535003dd3bd5e19437844cea6260c18e0283784be1dc3a0bcede1f | ekmett/speculation | Test.hs | {-# LANGUAGE BangPatterns #-}
module Main where
import Prelude hiding ((||),(&&))
import Test.Framework (Test)
import Test.Framework (defaultMain, testGroup)
import Test.Framework.Providers.HUnit
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.QuickCheck hiding ((==>))
import Test . HUnit hid... | null | https://raw.githubusercontent.com/ekmett/speculation/354a3accdb1eebc3a8c99e1c5e3f58ebad8104a2/Test.hs | haskell | # LANGUAGE BangPatterns #
unevaluated
evaluated | module Main where
import Prelude hiding ((||),(&&))
import Test.Framework (Test)
import Test.Framework (defaultMain, testGroup)
import Test.Framework.Providers.HUnit
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.QuickCheck hiding ((==>))
import Test . HUnit hiding ( Test )
import Control.Co... |
0e02ec7e5cf8f760a314a10ea91a737e02b719aa506be203a41bc9d05f26995e | philnguyen/soft-contract | sqrt.rkt | #lang racket/base
(require racket/contract)
(provide sqrt
(contract-out
[add1 (string? . -> . integer?)]))
| null | https://raw.githubusercontent.com/philnguyen/soft-contract/5e07dc2d622ee80b961f4e8aebd04ce950720239/soft-contract/test/programs/unsafe/issues/sqrt.rkt | racket | #lang racket/base
(require racket/contract)
(provide sqrt
(contract-out
[add1 (string? . -> . integer?)]))
| |
c9ac3b726969de217a441c4beb1b7b06b41bed3beb47fe7e90ccd45455cfbc26 | Datomic/day-of-datomic | decomposing_a_query.clj | Copyright ( c ) Cognitect , Inc. All rights reserved .
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be... | null | https://raw.githubusercontent.com/Datomic/day-of-datomic/20c02d26fd2a12481903dd5347589456c74f8eeb/tutorial/decomposing_a_query.clj | clojure | The use and distribution terms for this software are covered by the
Eclipse Public License 1.0 (-1.0.php)
which can be found in the file epl-v10.html at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not remove ... | Copyright ( c ) Cognitect , Inc. All rights reserved .
(require '[datomic.api :as d])
(set! *print-length* 100)
(def kvs (into [] (for [e (range 2000)
a [:a :b :c :d :e]]
[e a e])))
(count kvs)
(time (count (d/query {:query '[:find ?e1 ?e2
... |
2eba25790826184de4d12b4863e5e137e741a93f52300fe3e570b10fed91b730 | danr/hipspec | LiftTest.hs | module LiftTest where
import Prelude (Bool(..),undefined)
data Nat = Z | S Nat
plus :: Nat -> Nat -> Nat
plus Z y = y
plus (S x) y = S (plus x y)
-- Introduces a lifted g
# NOINLINE g #
g y = x `plus` y
in g x `plus` g (x `plus` x)
Here , is nicely inlined
h x = let g y = x `plus` y
i... | null | https://raw.githubusercontent.com/danr/hipspec/a114db84abd5fee8ce0b026abc5380da11147aa9/tfp1/tests/LiftTest.hs | haskell | Introduces a lifted g | module LiftTest where
import Prelude (Bool(..),undefined)
data Nat = Z | S Nat
plus :: Nat -> Nat -> Nat
plus Z y = y
plus (S x) y = S (plus x y)
# NOINLINE g #
g y = x `plus` y
in g x `plus` g (x `plus` x)
Here , is nicely inlined
h x = let g y = x `plus` y
in g x `plus` g (x `plus`... |
8b7812172bfd1e32b08bf67dd6765bd5443bdcfc4c592b5b74e7d348f7aa3d4c | haskell/cabal | cabal.test.hs | import Test.Cabal.Prelude
-- Test internal custom preprocessor
main = cabalTest $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
skipUnless "no Cabal for GHC" =<< hasCabalForGhc
old Cabal 's ./Setup.hs output is difficult to normalise
recordMode DoNotRe... | null | https://raw.githubusercontent.com/haskell/cabal/410f871df899e5af0847089354e0031fe051551d/cabal-testsuite/PackageTests/CustomPreProcess/cabal.test.hs | haskell | Test internal custom preprocessor
here, we only care that result works: | import Test.Cabal.Prelude
main = cabalTest $ do
isWin <- isWindows
ghc94 <- isGhcVersion "== 9.4.*"
expectBrokenIf (isWin && ghc94) 8451 $ do
skipUnless "no Cabal for GHC" =<< hasCabalForGhc
old Cabal 's ./Setup.hs output is difficult to normalise
recordMode DoNotRecord $
cabal "v2-build" []
... |
305ddedb0c6db682c4da66742c402a0e0c276aa2e7c645b01150264e0c21b950 | mokus0/junkbox | CayleyDickson.hs | # LANGUAGE
MultiParamTypeClasses ,
FunctionalDependencies ,
FlexibleInstances ,
FlexibleContexts ,
UndecidableInstances ,
TypeSynonymInstances ,
TypeFamilies
#
MultiParamTypeClasses,
FunctionalDependencies,
FlexibleInstanc... | null | https://raw.githubusercontent.com/mokus0/junkbox/151014bbef9db2b9205209df66c418d6d58b0d9e/Haskell/Math/CayleyDickson.hs | haskell | A strict tuple type with a suggestive name:
and short-hand forms:
???
Note that for H and beyond, (/) is ambiguous:
conjecture: There is some f (independent of a) for which the following is true:
exp (CD a b) = CD (exp a) 0 * f b
or perhaps something like:
exp (CD a b) = CD (exp a) (cos b) * sin b
... | # LANGUAGE
MultiParamTypeClasses ,
FunctionalDependencies ,
FlexibleInstances ,
FlexibleContexts ,
UndecidableInstances ,
TypeSynonymInstances ,
TypeFamilies
#
MultiParamTypeClasses,
FunctionalDependencies,
FlexibleInstanc... |
7f4768b0b1026ac9d083446b0c62049fddb6ac6effb12fbdc348352ee13bc26a | sgignoux/sicp-solutions.net | ch5-compiler.scm | COMPILER FROM SECTION 5.5 OF
;;;; STRUCTURE AND INTERPRETATION OF COMPUTER PROGRAMS
;;;;Matches code in ch5.scm
;;;;This file can be loaded into Scheme as a whole.
;;;;**NOTE**This file loads the metacircular evaluator's syntax procedures
from section 4.1.2
;;;; You may need to change the (load ...) expression to... | null | https://raw.githubusercontent.com/sgignoux/sicp-solutions.net/688edba8e1060e48283c76c7d2d398d83163101c/solutions/code%20from%20sicp%20second%20edition/ch5-compiler.scm | scheme | STRUCTURE AND INTERPRETATION OF COMPUTER PROGRAMS
Matches code in ch5.scm
This file can be loaded into Scheme as a whole.
**NOTE**This file loads the metacircular evaluator's syntax procedures
You may need to change the (load ...) expression to work in your
version of Scheme.
**implementation-dependent loading of ... | COMPILER FROM SECTION 5.5 OF
from section 4.1.2
Then you can compile Scheme programs as shown in section 5.5.5
section 4.1.2 syntax procedures
SECTION 5.5.1
(define (compile exp target linkage)
(cond ((self-evaluating? exp)
(compile-self-evaluating exp target linkage))
((quoted? exp) (compi... |
1512a15ef160f2437db19ad188af288b07dcec6e2b8a7bed725bd0493dfece30 | tolysz/prepare-ghcjs | TopHandler.hs | # LANGUAGE Trustworthy #
{-# LANGUAGE CPP
, NoImplicitPrelude
, MagicHash
, UnboxedTuples
#-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
Module : GHC.TopHandler
Copyright : ( c ) The University of G... | null | https://raw.githubusercontent.com/tolysz/prepare-ghcjs/8499e14e27854a366e98f89fab0af355056cf055/spec-lts8/base/GHC/TopHandler.hs | haskell | # LANGUAGE CPP
, NoImplicitPrelude
, MagicHash
, UnboxedTuples
#
# OPTIONS_HADDOCK hide #
---------------------------------------------------------------------------
|
License : see libraries/base/LICENSE
Maintainer :
Stability : internal
Support for catching excepti... | # LANGUAGE Trustworthy #
Module : GHC.TopHandler
Copyright : ( c ) The University of Glasgow , 2001 - 2002
Portability : non - portable ( GHC Extensions )
( e.g. @Main.main@ , ' Control . Concurrent.forkIO ' , and foreign exports )
module GHC.TopHandler (
runMainIO, runIO, runIOFastExit... |
af18e0298f37a738df1bdabdd594ff51f5127f04e260026dce39a63a89996076 | marksteele/cinched | cinched_ensemble_backend.erl | %%%-------------------------------------------------------------------
@author < >
( C ) 2016 ,
%%% @doc
Cinched riak_ensemble backend
%%% @end
Created : 24 Jan 2016 by < >
%%%-------------------------------------------------------------------
This file is provided to you under the Apache License ,
%... | null | https://raw.githubusercontent.com/marksteele/cinched/5284d048c649128fa8929f6e85cdc4747d223427/src/cinched_ensemble_backend.erl | erlang | -------------------------------------------------------------------
@doc
@end
-------------------------------------------------------------------
Version 2.0 (the "License"); you may not use this file
a copy of the License at
-2.0
Unless required by applicable law or agreed to in writing,
KIND, either expres... | @author < >
( C ) 2016 ,
Cinched riak_ensemble backend
Created : 24 Jan 2016 by < >
This file is provided to you under the Apache License ,
except in compliance with the License . You may obtain
software distributed under the License is distributed on an
" AS IS " BASIS , WITHOUT WARRANTIES O... |
bae493de3ace9e1d3797781e7dc4ba1749c64fa7823caded44d3a15f28aca33f | input-output-hk/offchain-metadata-tools | org-to-md.hs | {-# LANGUAGE OverloadedStrings #-}
import Text.Pandoc.JSON
import Text.Pandoc.Walk
removeTags :: Inline -> Inline
removeTags (Span (_id, classes, _kvs) xs) | "tag" `elem` classes
= Span nullAttr []
removeTags x
= x
sanitizeCodeBlocks :: Block -> Block
sanitizeCodeBlocks (CodeBlock (_id, _classes, _kvs) contents)... | null | https://raw.githubusercontent.com/input-output-hk/offchain-metadata-tools/040cfa44f58eea6ca8c8bb4576ba352d17689be5/scripts/pandoc-filters/org-to-md.hs | haskell | # LANGUAGE OverloadedStrings # |
import Text.Pandoc.JSON
import Text.Pandoc.Walk
removeTags :: Inline -> Inline
removeTags (Span (_id, classes, _kvs) xs) | "tag" `elem` classes
= Span nullAttr []
removeTags x
= x
sanitizeCodeBlocks :: Block -> Block
sanitizeCodeBlocks (CodeBlock (_id, _classes, _kvs) contents)
= CodeBlock (mempty, mempty, mem... |
12c83c2ac9ed1c9004227a546b43db323392d6d608969aebcd2ac8857c5a25ba | PacktPublishing/Haskell-High-Performance-Programming | matrix-cuda.hs | -- file: matrix-cuda.hs
# LANGUAGE TypeOperators #
import Data.Array.Accelerate as A
import Data.Array.Accelerate.CUDA
type Matrix = Array DIM2 Double
matProduct :: Acc Matrix -> Acc Matrix -> Acc Matrix
matProduct a b = let
Z :. mx :. _ = unlift (shape a) :: Z :. Exp Int :. Exp Int
Z :. _ :. my = unlift ... | null | https://raw.githubusercontent.com/PacktPublishing/Haskell-High-Performance-Programming/2b1bfdb8102129be41e8d79c7e9caf12100c5556/Chapter11/matrix-cuda.hs | haskell | file: matrix-cuda.hs |
# LANGUAGE TypeOperators #
import Data.Array.Accelerate as A
import Data.Array.Accelerate.CUDA
type Matrix = Array DIM2 Double
matProduct :: Acc Matrix -> Acc Matrix -> Acc Matrix
matProduct a b = let
Z :. mx :. _ = unlift (shape a) :: Z :. Exp Int :. Exp Int
Z :. _ :. my = unlift (shape b) :: Z :. Exp I... |
4e2d722258bf67f6b487f18676e493c0b36176d0d20c22b060eaf31efbc2b8f2 | open-telemetry/opentelemetry-erlang | otel_tracer_provider_sup.erl | %%%------------------------------------------------------------------------
Copyright 2022 , OpenTelemetry Authors
Licensed under the Apache License , Version 2.0 ( the " License " ) ;
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% -2.0
%%
%% Unl... | null | https://raw.githubusercontent.com/open-telemetry/opentelemetry-erlang/2ff5849d01f77fc143c83aa13f1d64fe2a7e5c48/apps/opentelemetry/src/otel_tracer_provider_sup.erl | erlang | ------------------------------------------------------------------------
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-2.0
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o... | Copyright 2022 , OpenTelemetry Authors
Licensed under the Apache License , Version 2.0 ( the " License " ) ;
distributed under the License is distributed on an " AS IS " BASIS ,
-module(otel_tracer_provider_sup).
-behaviour(supervisor).
-export([start_link/0]).
-export([init/1]).
-define(SERVER, ?MODULE).
st... |
9128b7a8aa48cc9d1c393547ea437125a159ba50fbb43fd3fbe06c278605a020 | nibbula/yew | terminal-table.lisp | ;;;
;;; terminal-table.lisp - Table renderer for terminals.
;;;
(defpackage :terminal-table
(:documentation "Table renderer for terminals.")
(:use :cl :dlib :terminal :table :table-print :fatchar :fatchar-io
:collections :char-util :dlib-misc)
(:export
#:terminal-table-renderer
#:terminal-box-table-render... | null | https://raw.githubusercontent.com/nibbula/yew/2cf1e75bdc8ee8a9e713f29a5952e9eb571aed51/io/terminal-table.lisp | lisp |
terminal-table.lisp - Table renderer for terminals.
@@@ This whole thing is crap becuase it copy & pastes most of the
text-table-renderer method. We should make it not do that, and just
call to them appropriately.
(declare (ignore table))
Lines
@@@ to implement x
(defmethod table-output-header ((renderer term... |
(defpackage :terminal-table
(:documentation "Table renderer for terminals.")
(:use :cl :dlib :terminal :table :table-print :fatchar :fatchar-io
:collections :char-util :dlib-misc)
(:export
#:terminal-table-renderer
#:terminal-box-table-renderer
))
(in-package :terminal-table)
(defclass terminal-table-... |
c46e99850249672070a0822f5c9dd7803249685dd5c2398fc839f5394c0ad654 | ucsd-progsys/dsolve | bad-dag-map.ml | (* let i = () *)
(**************************************************************)
(************************ List Graph API **********************)
(**************************************************************)
let hassert x = ()
let show x = x
let flap f xs = List.flatten (List.map f xs)
(*********************... | null | https://raw.githubusercontent.com/ucsd-progsys/dsolve/bfbbb8ed9bbf352d74561e9f9127ab07b7882c0c/negtests/bad-dag-map.ml | ocaml | let i = ()
************************************************************
*********************** List Graph API *********************
************************************************************
************************************************************
*********************** List Graph API *********************
**... |
let hassert x = ()
let show x = x
let flap f xs = List.flatten (List.map f xs)
let new_node n g =
let _ = hassert (not (Myhash.mem g n)) in
Myhash.set g n []
let new_edge g n n' =
let _ = show g in
let _ = hassert (Myhash.mem g n) in
let _ = hassert (Myhash.mem g n') in
let ns = Myhash.get g ... |
1f1869ca477d15014978f2d8c66907dfdfb9fe72bab8d75909b80c39a2224d42 | slipstream/SlipStreamServer | utils_test.clj | (ns com.sixsq.slipstream.ssclj.resources.quota.utils-test
(:require
[clojure.data.json :as json]
[clojure.test :refer :all]
[com.sixsq.slipstream.db.filter.parser :as parser]
[com.sixsq.slipstream.ssclj.app.params :as p]
[com.sixsq.slipstream.ssclj.middleware.authn-info-header :refer [authn-info-h... | null | https://raw.githubusercontent.com/slipstream/SlipStreamServer/3ee5c516877699746c61c48fc72779fe3d4e4652/cimi-resources/test/com/sixsq/slipstream/ssclj/resources/quota/utils_test.clj | clojure | used to keep track of user name
create some virtual machine documents to test quota queries
create the quota
user view: OK
admin view: OK | (ns com.sixsq.slipstream.ssclj.resources.quota.utils-test
(:require
[clojure.data.json :as json]
[clojure.test :refer :all]
[com.sixsq.slipstream.db.filter.parser :as parser]
[com.sixsq.slipstream.ssclj.app.params :as p]
[com.sixsq.slipstream.ssclj.middleware.authn-info-header :refer [authn-info-h... |
127aa1fffe110925d3be1ec0c6931940b56db6c5483c958b8689e43424e8f54e | xxyzz/SICP | Exercise_2_66.rkt | #lang racket/base
(define (get-key tree) (car tree))
(define (value tree) (cadr tree))
(define (left-branch tree) (caddr tree))
(define (right-branch tree) (cadddr tree))
(define (make-tree key value left right)
(list key value left right))
(define (lookup key tree)
(cond [(null? tree) #f]
[(= key (... | null | https://raw.githubusercontent.com/xxyzz/SICP/e26aea1c58fd896297dbf5406f7fcd32bb4f8f78/2_Building_Abstractions_with_Data/2.3_Symbolic_Data/Exercise_2_66.rkt | racket | #lang racket/base
(define (get-key tree) (car tree))
(define (value tree) (cadr tree))
(define (left-branch tree) (caddr tree))
(define (right-branch tree) (cadddr tree))
(define (make-tree key value left right)
(list key value left right))
(define (lookup key tree)
(cond [(null? tree) #f]
[(= key (... | |
954a5edb7b7687a3877f29e9b903484a68cbc1c65ac17cb950fd1385b08821d9 | cmsc430/www | interp-prims.rkt | #lang racket
(require "ast.rkt")
(provide interp-prim1 interp-prim2)
;; Op1 Value -> Answer
(define (interp-prim1 p1 v)
(match (list p1 v)
[(list 'add1 (? integer?)) (add1 v)]
[(list 'sub1 (? integer?)) (sub1 v)]
[(list 'zero? (? integer?)) (zero? v)]
[(list 'char? v) ... | null | https://raw.githubusercontent.com/cmsc430/www/c3ab9b783e0e42a50a56267c675b882f2803eda8/langs/hustle/interp-prims.rkt | racket | Op1 Value -> Answer
Op2 Value Value -> Answer
Any -> Boolean | #lang racket
(require "ast.rkt")
(provide interp-prim1 interp-prim2)
(define (interp-prim1 p1 v)
(match (list p1 v)
[(list 'add1 (? integer?)) (add1 v)]
[(list 'sub1 (? integer?)) (sub1 v)]
[(list 'zero? (? integer?)) (zero? v)]
[(list 'char? v) (c... |
5fd9ae6fd32202832538486b29219004698eb0ebe674fe36013028b88381c19b | xclerc/ocamljava | javatopmain.ml |
* This file is part of compiler .
* Copyright ( C ) 2007 - 2015 .
* Original file ( toplevel / opttopmain.ml in the OCaml source
* distribution ) is Copyright ( C ) INRIA .
*
* compiler is free software ; you can redistribute it and/or modify
* it under the terms of the Q Public License as ... | null | https://raw.githubusercontent.com/xclerc/ocamljava/8330bfdfd01d0c348f2ba2f0f23d8f5a8f6015b1/compiler/toplevel/javatopmain.ml | ocaml |
* This file is part of compiler .
* Copyright ( C ) 2007 - 2015 .
* Original file ( toplevel / opttopmain.ml in the OCaml source
* distribution ) is Copyright ( C ) INRIA .
*
* compiler is free software ; you can redistribute it and/or modify
* it under the terms of the Q Public License as ... | |
3380a924d03fc91e512e1de7fd0ccfe608610c6a65e8384f0426b4e1ecb01de4 | iokasimov/pandora | Object.hs | module Pandora.Pattern.Object (module Exports) where
import Pandora.Pattern.Object.Lattice as Exports
import Pandora.Pattern.Object.Semilattice as Exports
import Pandora.Pattern.Object.Ring as Exports
import Pandora.Pattern.Object.Group as Exports
import Pandora.Pattern.Object.Monoid as Exports
import Pandora.Pattern.... | null | https://raw.githubusercontent.com/iokasimov/pandora/4ff22ccf1c9824e3072d2ea0163b923798528b3a/Pandora/Pattern/Object.hs | haskell | module Pandora.Pattern.Object (module Exports) where
import Pandora.Pattern.Object.Lattice as Exports
import Pandora.Pattern.Object.Semilattice as Exports
import Pandora.Pattern.Object.Ring as Exports
import Pandora.Pattern.Object.Group as Exports
import Pandora.Pattern.Object.Monoid as Exports
import Pandora.Pattern.... | |
adc9cad6d6079f876155f1fc262cecb2c96c78339aa6a157707c4d2f4d71c956 | Atry/Control.Dsl | State.hs | # LANGUAGE MultiParamTypeClasses #
# LANGUAGE FlexibleInstances #
# LANGUAGE RebindableSyntax #
{-# LANGUAGE GADTs #-}
{- |
Description : Mutable variables
This module provides keywords to 'Put' and 'Get' the value on multiple mutable variables in a @do@ block.
-}
module Control.Dsl.State
( module Control.Dsl.State... | null | https://raw.githubusercontent.com/Atry/Control.Dsl/f19da265c8ea537af95e448e6107fa503d5363c2/src/Control/Dsl/State.hs | haskell | # LANGUAGE GADTs #
|
Description : Mutable variables
This module provides keywords to 'Put' and 'Get' the value on multiple mutable variables in a @do@ block.
| # LANGUAGE MultiParamTypeClasses #
# LANGUAGE FlexibleInstances #
# LANGUAGE RebindableSyntax #
module Control.Dsl.State
( module Control.Dsl.State.Put
, module Control.Dsl.State.Get
, module Control.Dsl.State.State
)
where
import Control.Dsl.State.Put
import Control.Dsl.State.Get
import ... |
7e74d8c13c6946fb6a318bd616033bd86875947d5f71a8be2ee2e73b9835454a | parenthesin/microservice-boilerplate-malli | system_test.clj | (ns integration.parenthesin.system-test
(:require [clojure.test :refer [use-fixtures]]
[integration.parenthesin.util :as aux]
[integration.parenthesin.util.database :as util.database]
[integration.parenthesin.util.http :as util.http]
[integration.parenthesin.util.webser... | null | https://raw.githubusercontent.com/parenthesin/microservice-boilerplate-malli/b4bd9fa95f3457dfac47b7b64e00e4f14ba7060c/test/integration/parenthesin/system_test.clj | clojure | (ns integration.parenthesin.system-test
(:require [clojure.test :refer [use-fixtures]]
[integration.parenthesin.util :as aux]
[integration.parenthesin.util.database :as util.database]
[integration.parenthesin.util.http :as util.http]
[integration.parenthesin.util.webser... | |
348b34288ed8ea77a26ebb20ee364e8147c3a40f9ffb1cae08ac9aec67d5e8a8 | hopbit/sonic-pi-snippets | dp_str_s1.sps | # key: dp str s1
# point_line: 0
# point_index: 0
# --
# DP STR S1
class BeatACapella < BeatStrategy
def initialize(sample_path)
@sample_path = sample_path
end
def get
nil
end
end
class BeatDNB < BeatStrategy
def initialize(sample_path)
@sample_path = sample_path
end
def get
{
'sa... | null | https://raw.githubusercontent.com/hopbit/sonic-pi-snippets/2232854ac9587fc2f9f684ba04d7476e2dbaa288/dp/dp_str_s1.sps | scheme | # key: dp str s1
# point_line: 0
# point_index: 0
# --
# DP STR S1
class BeatACapella < BeatStrategy
def initialize(sample_path)
@sample_path = sample_path
end
def get
nil
end
end
class BeatDNB < BeatStrategy
def initialize(sample_path)
@sample_path = sample_path
end
def get
{
'sa... | |
703b021ebe73750a0e1c9812ffba8e4f60cd2421cc078d01e91ce31e8f0a8197 | adityaathalye/sicp | ch1-3-4-general-procedures.scm | Ch . 1.3.4 Abstractions and first - class procedures
; A general method that finds the fixed point of some
; transformation of the function.
(define (fixed-point-of-transform g transform guess)
(fixed-point (transform g) guess))
(define (sqrt x)
(fixed-point-of-transform (lambda (y) (/ x y))
... | null | https://raw.githubusercontent.com/adityaathalye/sicp/c8b62c366dade1d5101238a32267dab177808105/ch1-3-4-general-procedures.scm | scheme | A general method that finds the fixed point of some
transformation of the function.
Prerequisite code
Average damping can be expressed as:
tolerance intended for fixed-point procedure
procedure to compute fixed-point f(x) = x | Ch . 1.3.4 Abstractions and first - class procedures
(define (fixed-point-of-transform g transform guess)
(fixed-point (transform g) guess))
(define (sqrt x)
(fixed-point-of-transform (lambda (y) (/ x y))
average-damp
1.0))
... |
87c08e42449f8ffcb0ede63f02e5767e8ffb20e0740d0d6d6cf117200f3a564d | metosin/malli | instrument_app.cljs | (ns malli.instrument-app
(:require
[malli.instrument :as mi-new]
malli.helpers
[malli.core :as m]
[clojure.test.check.generators :as gen]
[malli.experimental.time.generator]
[malli.dev.pretty :as pretty]
[malli.generator :as mg]
[malli.experimental :as mx]
[malli.experimental.time ... | null | https://raw.githubusercontent.com/metosin/malli/372ad8119300d1ed054a383e184c431b8494c697/app/malli/instrument_app.cljs | clojure | (m/=> sum [:=> [:cat :int :int] :int])
(comment
(m/=> plus1 [:=> [:cat :int] :int])
multi-arity function
[:function
[:=> [:cat :int] :int]
[:=> [:cat :int :int [:* :int]] :int]])
[:=> [:cat] [:int]]
(mi-new/unstrument!)
(plus-many "hi")
works b/c there is no schema for this arity:
(multi-arity-variadic-fn 'a ... | (ns malli.instrument-app
(:require
[malli.instrument :as mi-new]
malli.helpers
[malli.core :as m]
[clojure.test.check.generators :as gen]
[malli.experimental.time.generator]
[malli.dev.pretty :as pretty]
[malli.generator :as mg]
[malli.experimental :as mx]
[malli.experimental.time ... |
d62f714c3d6286fe75a4da146c217485a77da78bd98dc8045ff82a244491afda | hstreamdb/hstream | AckSpec.hs | module HStream.AckSpec (spec) where
import Data.Map.Strict as Map
import Data.Maybe (fromJust)
import HStream.Server.Core.Common (getCommitRecordId,
insertAckedRecordId, isSuccessor)
import HStream.Server.Ty... | null | https://raw.githubusercontent.com/hstreamdb/hstream/8775c4e016d5bda78b26b92d3ba11ce6726e66d8/hstream/test/HStream/AckSpec.hs | haskell | module HStream.AckSpec (spec) where
import Data.Map.Strict as Map
import Data.Maybe (fromJust)
import HStream.Server.Core.Common (getCommitRecordId,
insertAckedRecordId, isSuccessor)
import HStream.Server.Ty... | |
e63d7cc827800f18abb4243579da307aaf65f55352d42a9cd979d58619c70552 | ryanpbrewster/haskell | longest_lines.hs | -- longest_lines.hs
- Write a program to read a multiple line text file and write the ' N ' longest
- lines to stdout . Where the file to be read is specified on the command line .
-
- Input sample :
-
- Your program should read an input file ( the first argument to your program ) .
- The first lin... | null | https://raw.githubusercontent.com/ryanpbrewster/haskell/6edd0afe234008a48b4871032dedfd143ca6e412/CodeEval/longest_lines.hs | haskell | longest_lines.hs |
- Write a program to read a multiple line text file and write the ' N ' longest
- lines to stdout . Where the file to be read is specified on the command line .
-
- Input sample :
-
- Your program should read an input file ( the first argument to your program ) .
- The first line contains the value... |
36fdb79b0378c123fa0795ed5b85fbfbeeaaf337df661a0e9ed26f9d6165f328 | cbaggers/varjo | cltl2.lisp | #||
Maybe implement these?
||#
sb-cltl2:variable-information
sb-cltl2:compiler-let
sb-cltl2:declaration-information
sb-cltl2:define-declaration
sb-cltl2:enclose
sb-cltl2:function-information
sb-cltl2:macroexpand-all
sb-cltl2:parse-macro
sb-cltl2:augment-environment
| null | https://raw.githubusercontent.com/cbaggers/varjo/9e77f30220053155d2ef8870ceba157f75e538d4/protocode/cltl2.lisp | lisp |
Maybe implement these?
|
sb-cltl2:variable-information
sb-cltl2:compiler-let
sb-cltl2:declaration-information
sb-cltl2:define-declaration
sb-cltl2:enclose
sb-cltl2:function-information
sb-cltl2:macroexpand-all
sb-cltl2:parse-macro
sb-cltl2:augment-environment
|
ebf11807e69a025cd1c17d2901befa6874ec6f8f96cbbf06be162998bfa9caea | spechub/Hets | Resolver.hs | {-# LANGUAGE OverloadedStrings #-}
module PGIP.GraphQL.Resolver (resolve) where
import qualified PGIP.GraphQL.Resolver.DGraph as DGraphResolver
import qualified PGIP.GraphQL.Resolver.OMS as OMSResolver
import qualified PGIP.GraphQL.Resolver.Serialization as SerializationResolver
import qualified PGIP.GraphQL.Resolver... | null | https://raw.githubusercontent.com/spechub/Hets/f582640a174df08d4c965d7c0a1ab24d1a31000d/PGIP/GraphQL/Resolver.hs | haskell | # LANGUAGE OverloadedStrings # |
module PGIP.GraphQL.Resolver (resolve) where
import qualified PGIP.GraphQL.Resolver.DGraph as DGraphResolver
import qualified PGIP.GraphQL.Resolver.OMS as OMSResolver
import qualified PGIP.GraphQL.Resolver.Serialization as SerializationResolver
import qualified PGIP.GraphQL.Resolver.Signature as SignatureResolver
imp... |
401aee36c100430e9fbfeb3f27d3c39b73ae222fa7224df9defea22a03d3b445 | awslabs/s2n-bignum | bignum_mul_4_8_alt.ml |
* Copyright Amazon.com , Inc. or its affiliates . All Rights Reserved .
* SPDX - License - Identifier : Apache-2.0 OR ISC
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0 OR ISC
*)
(* =================================================================... | null | https://raw.githubusercontent.com/awslabs/s2n-bignum/824c15f908d7a343af1b2f378cfedd36e880bdde/arm/proofs/bignum_mul_4_8_alt.ml | ocaml | =========================================================================
=========================================================================
*** print_literal_from_elf "arm/fastmul/bignum_mul_4_8_alt.o";;
***
arm_ADDS X13 X13 X11
arm_ADDS X13 X13 X11
arm_ADDS X14 X14 X11
arm_ADDS X14 X14 X11
arm_AD... |
* Copyright Amazon.com , Inc. or its affiliates . All Rights Reserved .
* SPDX - License - Identifier : Apache-2.0 OR ISC
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0 OR ISC
*)
4x4->8 multiply optimized for uarchs with higher multiplier throug... |
274219a93bcbe641ee0fac020b897c9bc55a45cf07edc340f130d41bf1b94780 | exercism/erlang | example.erl | -module(example).
-export([sum/2]).
-import(lists, [foldl/3, seq/2, any/2]).
sum(Multiples, A) ->
foldl(fun(X, Sum) -> case multiple(Multiples, X) of
true -> Sum + X;
false -> Sum
end
end,
0,
seq(1, A-1)).
multiple(... | null | https://raw.githubusercontent.com/exercism/erlang/57ac2707dae643682950715e74eb271f732e2100/exercises/practice/sum-of-multiples/.meta/example.erl | erlang | -module(example).
-export([sum/2]).
-import(lists, [foldl/3, seq/2, any/2]).
sum(Multiples, A) ->
foldl(fun(X, Sum) -> case multiple(Multiples, X) of
true -> Sum + X;
false -> Sum
end
end,
0,
seq(1, A-1)).
multiple(... | |
d04934d573a0a2696644b3d41abca6a8d6e2e4051642583f78b6e8cdd56ab1a2 | exercism/erlang | raindrops.erl | -module(raindrops).
-export([convert/1]).
convert(_Number) -> undefined.
| null | https://raw.githubusercontent.com/exercism/erlang/57ac2707dae643682950715e74eb271f732e2100/exercises/practice/raindrops/src/raindrops.erl | erlang | -module(raindrops).
-export([convert/1]).
convert(_Number) -> undefined.
| |
c83add64bab474f94169a09369052419d7d992a52d438f0e4459f5122792e69d | dharrigan/startrek | login-polish-bad-password.clj | #!/usr/bin/env bb
;;
;;
;;
(require '[org.httpkit.client :as http])
(def riker "")
(def password "BAD-password")
(defn login
[]
(let [{:keys [body] :as response} @(http/post (str ":8080/api/public/officers/login") {:basic-auth [riker password]
... | null | https://raw.githubusercontent.com/dharrigan/startrek/9255c433102227adfc73a51fa78ca227fa8e05ca/scripts/bb/login-polish-bad-password.clj | clojure | #!/usr/bin/env bb
(require '[org.httpkit.client :as http])
(def riker "")
(def password "BAD-password")
(defn login
[]
(let [{:keys [body] :as response} @(http/post (str ":8080/api/public/officers/login") {:basic-auth [riker password]
... | |
b529b87a97b7adbbe433cba58216b26c3e00929861016b42731aa1d73d8069b4 | cerner/clara-rules | inspect.cljc | (ns clara.tools.inspect
"Tooling to inspect a rule session. The two major methods here are:
* inspect, which returns a data structure describing the session that can be used by tooling.
* explain-activations, which uses inspect and prints a human-readable description covering
why each rule activation or q... | null | https://raw.githubusercontent.com/cerner/clara-rules/8107a5ab7fdb475e323c0bcb39084a83454deb1c/src/main/clojure/clara/tools/inspect.cljc | clojure | A structured explanation of why a rule or query matched.
This is derived from the Rete-style tokens, but this token
is designed to propagate all context needed to easily inspect
the state of rules.
Bound variables
Schema of an inspected rule session.
Unsupported and irrelevant node types will have a node-type ... | (ns clara.tools.inspect
"Tooling to inspect a rule session. The two major methods here are:
* inspect, which returns a data structure describing the session that can be used by tooling.
* explain-activations, which uses inspect and prints a human-readable description covering
why each rule activation or q... |
79c2829f61e8b049702eef17358fa97a1bd2f5e747440ba044ecb80025bf5a76 | daigotanaka/mern-cljs | macros.clj | (ns mern-utils.macros)
(defmacro node-require
"Macro to load node module"
[module module-path]
`(do
(defonce ~'node-module-table (atom {}))
(swap! ~'node-module-table assoc (keyword ~module-path) (cljs.nodejs/require ~module-path))
(def ~module ((keyword ~module-path) (deref ~'node-module-table)))
... | null | https://raw.githubusercontent.com/daigotanaka/mern-cljs/a9dedbb3b622f96dd0b06832733b4fd961e6437d/mern_utils/src/mern_utils/macros.clj | clojure | (ns mern-utils.macros)
(defmacro node-require
"Macro to load node module"
[module module-path]
`(do
(defonce ~'node-module-table (atom {}))
(swap! ~'node-module-table assoc (keyword ~module-path) (cljs.nodejs/require ~module-path))
(def ~module ((keyword ~module-path) (deref ~'node-module-table)))
... | |
f5196dd755e164bba6c06e8051019f55efad9a4c7a62e98f580127568a1ace2f | alxchk/cl-libssh2 | libssh2-libc-cffi.lisp | (in-package :libssh2)
(include "sys/types.h" "sys/stat.h")
(cstruct +stat+ "struct stat"
(dev "st_dev" :type :unsigned-int)
(ino "st_ino" :type :unsigned-int)
(mode "st_mode" :type :unsigned-int)
(nlink "st_nlink" :type :unsigned-int)
(uid "st_uid" :type :unsigned-int)
... | null | https://raw.githubusercontent.com/alxchk/cl-libssh2/22481c176702eb211b223014fe1d040e9132a019/src/libssh2-libc-cffi.lisp | lisp | (in-package :libssh2)
(include "sys/types.h" "sys/stat.h")
(cstruct +stat+ "struct stat"
(dev "st_dev" :type :unsigned-int)
(ino "st_ino" :type :unsigned-int)
(mode "st_mode" :type :unsigned-int)
(nlink "st_nlink" :type :unsigned-int)
(uid "st_uid" :type :unsigned-int)
... | |
58639cb1dce1bbec3839f1df75b801d34898dd6b758b577e6d8c8719f6117e14 | mfoemmel/erlang-otp | percept_SUITE.erl | %%
%% %CopyrightBegin%
%%
Copyright Ericsson AB 2007 - 2009 . All Rights Reserved .
%%
The contents of this file are subject to the Erlang Public License ,
Version 1.1 , ( the " License " ) ; you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Pub... | null | https://raw.githubusercontent.com/mfoemmel/erlang-otp/9c6fdd21e4e6573ca6f567053ff3ac454d742bc2/lib/percept/test/percept_SUITE.erl | erlang |
%CopyrightBegin%
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at /.
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limita... | Copyright Ericsson AB 2007 - 2009 . All Rights Reserved .
The contents of this file are subject to the Erlang Public License ,
Version 1.1 , ( the " License " ) ; you may not use this file except in
Software distributed under the License is distributed on an " AS IS "
-module(percept_SUITE).
-include("test_ser... |
a6a9c4351daf9ee2f34a11aaa59572a7b7daf716a3ad629e4ad2020f4616d135 | brendanhay/gogol | Patch.hs | # LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DuplicateRecordFields #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE LambdaCase #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE PatternSynonyms #
# LANGUAGE RecordWildCards #
{-# LANGUAGE St... | null | https://raw.githubusercontent.com/brendanhay/gogol/77394c4e0f5bd729e6fe27119701c45f9d5e1e9a/lib/services/gogol-datafusion/gen/Gogol/DataFusion/Projects/Locations/Instances/Patch.hs | haskell | # LANGUAGE OverloadedStrings #
# LANGUAGE StrictData #
|
Stability : auto-generated
* Resource
** Constructing a Request
| A resource alias for @datafusion.projects.locations.instances.patch@ method which the
'DataFusionProjectsLocationsInstancesPatch' request conforms to.
/See:/ 'newDataFusionProjectsLocat... | # LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DuplicateRecordFields #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE LambdaCase #
# LANGUAGE PatternSynonyms #
# LANGUAGE RecordWildCards #
# LANGUAGE TypeFamilies #
# LANGUAGE TypeOperators... |
94c9c29d835d92f29b15119cac7e083abc3c1718915fbe4c6e31202b23d42039 | Zilliqa/scilla | IPCUtil.ml |
This file is part of scilla .
Copyright ( c ) 2018 - present Zilliqa Research Pvt . Ltd.
scilla is free software : you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation , either version 3 of the License , or ( at y... | null | https://raw.githubusercontent.com/Zilliqa/scilla/35af3814eace7c722ad966f0e2eee07d59d5a8af/src/eval/IPCUtil.ml | ocaml | This error matches for the error returned by jsonrpccpp
defines `typ_of_err_t`
* Send msg via output channel [oc] with a delimiting character "0xA". |
This file is part of scilla .
Copyright ( c ) 2018 - present Zilliqa Research Pvt . Ltd.
scilla is free software : you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation , either version 3 of the License , or ( at y... |
6820ae4d8dc85125b8c7ca5f6bf25e92d017d7ec94c4c35b43f0d02b4756ca88 | clojure-interop/java-jdk | core.clj | (ns javax.swing.tree.core
(:refer-clojure :only [require comment defn ->])
(:import ))
(require '[javax.swing.tree.AbstractLayoutCache$NodeDimensions])
(require '[javax.swing.tree.AbstractLayoutCache])
(require '[javax.swing.tree.DefaultMutableTreeNode])
(require '[javax.swing.tree.DefaultTreeCellEditor])
(require... | null | https://raw.githubusercontent.com/clojure-interop/java-jdk/8d7a223e0f9a0965eb0332fad595cf7649d9d96e/javax.swing/src/javax/swing/tree/core.clj | clojure | (ns javax.swing.tree.core
(:refer-clojure :only [require comment defn ->])
(:import ))
(require '[javax.swing.tree.AbstractLayoutCache$NodeDimensions])
(require '[javax.swing.tree.AbstractLayoutCache])
(require '[javax.swing.tree.DefaultMutableTreeNode])
(require '[javax.swing.tree.DefaultTreeCellEditor])
(require... | |
893de4272bb98ab4f4b879c092a016e2277383fa599bb6b255181575e3f131d0 | emilaxelsson/ag-graph | TypeFam.hs | {-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
# LANGUAGE FlexibleInstances #
# LANGUAGE GADTs #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE PolyKinds #
{-# LANGUAGE ScopedTypeVariables #-}
# LANGUAGE TypeFamili... | null | https://raw.githubusercontent.com/emilaxelsson/ag-graph/50fb1ebb819e1ed0bd3b97e8a9f82bb9310e782f/src/Projection/TypeFam.hs | haskell | # LANGUAGE ConstraintKinds #
# LANGUAGE DataKinds #
# LANGUAGE FlexibleContexts #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE TypeOperators #
| Path to a node in a binary tree.
| Result of searching for a unique occurrence of a node in a binary tree.
'Ambiguous' is the absorptive (... | # LANGUAGE FlexibleInstances #
# LANGUAGE GADTs #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE PolyKinds #
# LANGUAGE TypeFamilies #
# LANGUAGE UndecidableInstances #
module Projection.TypeFam (pr, (:<)) where
import Prelude hiding (Either (..))
data Pos = Here | Left ... |
629c7ba6c1be076a7a54134a272b05abdfd0a2bbb13d49ce0b4f866a0b0b4aba | lspector/Clojush | code.clj | (ns clojush.instructions.code
(:use [clojush.pushstate]
[clojush.util]
[clojush.globals])
(:require [clojure.math.numeric-tower :as math]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; code and exec instructions
(define-registered exec_noop ^{:st... | null | https://raw.githubusercontent.com/lspector/Clojush/685b991535607cf942ae1500557171a0739982c3/src/clojush/instructions/code.clj | clojure |
code and exec instructions
Differs from code.do*range only in the source of the code and the recursive call.
differs from code.do*count only in the source of the code and the recursive call
differs from code.do*times only in the source of the code and the recursive call
differs from code.if in the source of t... | (ns clojush.instructions.code
(:use [clojush.pushstate]
[clojush.util]
[clojush.globals])
(:require [clojure.math.numeric-tower :as math]))
(define-registered exec_noop ^{:stack-types [:exec]} (fn [state] state))
(define-registered code_noop ^{:stack-types [:code]} (fn [state] state))
(define-reg... |
4b4aa4e2b05144ccc9b7ade0d788b83ca604f10c13f12de4e423b8efec7fe0a8 | tiredpixel/isoxya-api | Type.hs | module Isoxya.DB.Type (
Crawl(..),
CrawlId ,
CrawlId'(..),
CrawlStatus(..),
Page(..),
PageId(..),
PageURL(..),
PageV(..),
Processor(..),
ProcessorId(..),
ProcessorURL(..),
Site(..),
SiteId(..),
SiteURL(..),
SiteV(..),
Streamer(..),
StreamerId(..),
... | null | https://raw.githubusercontent.com/tiredpixel/isoxya-api/1022ee6db77f744c77541c53ef6f15f56884f939/src/Isoxya/DB/Type.hs | haskell | module Isoxya.DB.Type (
Crawl(..),
CrawlId ,
CrawlId'(..),
CrawlStatus(..),
Page(..),
PageId(..),
PageURL(..),
PageV(..),
Processor(..),
ProcessorId(..),
ProcessorURL(..),
Site(..),
SiteId(..),
SiteURL(..),
SiteV(..),
Streamer(..),
StreamerId(..),
... | |
5b6f2875dc427b8ade3d925ccab6e4cb2af2df99b8a29b619accea5955fc53d2 | restyled-io/restyled.io | MarketplaceSpec.hs | module Restyled.MarketplaceSpec
( spec
) where
import Restyled.Test
import Restyled.Marketplace
import Restyled.Test.Graphula
import Restyled.Time
spec :: Spec
spec = withApp $ do
describe "marketplacePlanAllows" $ do
it "always allows public repos" $ graph $ do
repo <- node @Repo () ... | null | https://raw.githubusercontent.com/restyled-io/restyled.io/134019dffb54f84bddb905e8e21131b4e33f7850/test/Restyled/MarketplaceSpec.hs | haskell | We want to check for the Expired case without actually comparing the
expiredAt value, since we might fail on ms differences. In the unexpected
message. | module Restyled.MarketplaceSpec
( spec
) where
import Restyled.Test
import Restyled.Marketplace
import Restyled.Test.Graphula
import Restyled.Time
spec :: Spec
spec = withApp $ do
describe "marketplacePlanAllows" $ do
it "always allows public repos" $ graph $ do
repo <- node @Repo () ... |
64265a4c362ed01edc36c59475d7011f3189a8f3799ef0c5d30e9862e76e388a | huangz1990/SICP-answers | 45-another-split.scm | 45-another.scm
(define (split big-combiner small-combiner)
(define (inner painter n)
(if (= n 0)
painter
(let ((smaller (inner painter (- n 1))))
(big-combiner painter
(small-combiner smaller smaller)))))
inner)
| null | https://raw.githubusercontent.com/huangz1990/SICP-answers/15e3475003ef10eb738cf93c1932277bc56bacbe/chp2/code/45-another-split.scm | scheme | 45-another.scm
(define (split big-combiner small-combiner)
(define (inner painter n)
(if (= n 0)
painter
(let ((smaller (inner painter (- n 1))))
(big-combiner painter
(small-combiner smaller smaller)))))
inner)
| |
e76c80e5da89e79b9134465d31d6e506fda90342cc28c6eaee9bdb44e8057207 | opencog/miner | miner-rule-utils.scm | (use-modules (opencog exec))
(use-modules (opencog logger))
(use-modules (opencog ure))
(use-modules (srfi srfi-1))
Given an atom created with minsup - eval , get the pattern , db and
;; ms
;;
get - pattern and get - db also work for surp constructs
(define (get-pattern minsup-f)
(cog-outgoing-atom (gdr minsup-f... | null | https://raw.githubusercontent.com/opencog/miner/4774a964306f9c60fd2355dde5ded4f2008c772b/opencog/miner/scm/miner/rules/miner-rule-utils.scm | scheme | ms
Wrap the single argument in List in case it is itself a list | (use-modules (opencog exec))
(use-modules (opencog logger))
(use-modules (opencog ure))
(use-modules (srfi srfi-1))
Given an atom created with minsup - eval , get the pattern , db and
get - pattern and get - db also work for surp constructs
(define (get-pattern minsup-f)
(cog-outgoing-atom (gdr minsup-f) 0))
(de... |
3c34350ba936e7739c4c979112aa79f1106c19d51fb284283a976757d1ec0684 | plumatic/grab-bag | deploy.clj | (ns monitoring.deploy
(:use plumbing.core)
(:require
[plumbing.graph :as graph]
[plumbing.parallel :as parallel]
[service.core :as service]
[service.observer :as service-observer]
[monitoring.necromancer.core :as necromancer]
[monitoring.monitor :as monitor]
[monitoring.monitors.machines :as mo... | null | https://raw.githubusercontent.com/plumatic/grab-bag/a15e943322fbbf6f00790ce5614ba6f90de1a9b5/service/monitoring/src/monitoring/deploy.clj | clojure | (ns monitoring.deploy
(:use plumbing.core)
(:require
[plumbing.graph :as graph]
[plumbing.parallel :as parallel]
[service.core :as service]
[service.observer :as service-observer]
[monitoring.necromancer.core :as necromancer]
[monitoring.monitor :as monitor]
[monitoring.monitors.machines :as mo... | |
3a74dee4d4f1dc19c3c28b922f4a035210b1eb6a86ac9b7a0345d0202db4125c | gregr/ina | tty.scm | Control Sequence Introducer ( CSI ) codes
Title control ( title position 0 , 1 , or 2 ) ; some terminals use \e\\ instead of \a ?
(define (ec:title-set title (position 0))
(string-append "\e]" (number->string position) ";" title "\a"))
;; Display control
(define ec:display-save "\e[?47h")
(define ec:display-... | null | https://raw.githubusercontent.com/gregr/ina/c854de83c9ed9f5dbaa77405881777c572fbb39c/nscheme/include/tty.scm | scheme | some terminals use \e\\ instead of \a ?
Display control
<lines>;<cols > t
<x - digits > R
NOTE: these are less standard
\e[nE beginning of next line
\e[nG move to column on same line
\e[nS scroll up
Mouse input reporting
xterm style
button press: \e[<0;column;rowM
button release: \e[<0;column;rowm
... | Control Sequence Introducer ( CSI ) codes
(define (ec:title-set title (position 0))
(string-append "\e]" (number->string position) ";" title "\a"))
(define ec:display-save "\e[?47h")
(define ec:display-restore "\e[?47l")
(define ec:display-size "\e[18t")
(define ec:display-clear-after "\e[0J")
(define ec... |
48e33956440a346c411edeab45dca0ac770e777702b09a467c786b711b6259b6 | ghcjs/ghcjs | cgrun046.hs | module Main where
import System.IO
-- !!! CAF space leaks
main = lots_of_xs 10000
lots_of_xs 0 = return ()
lots_of_xs n = putChar 'x' >> lots_of_xs (n-1)
| null | https://raw.githubusercontent.com/ghcjs/ghcjs/e4cd4232a31f6371c761acd93853702f4c7ca74c/test/ghc/codeGen/cgrun046.hs | haskell | !!! CAF space leaks | module Main where
import System.IO
main = lots_of_xs 10000
lots_of_xs 0 = return ()
lots_of_xs n = putChar 'x' >> lots_of_xs (n-1)
|
af9bb92b33491e8b94932854be3bf6b1d79433bb7cfabef93f68420e87ee5405 | shayne-fletcher/zen | link.ml | The rules are as follows :
- You can initialize a link set with a sink ;
- You can add links to a set such that :
- The first link 's sink must be of the set 's sink type ;
- Additional links can have as sink types the set sink type or ,
the source types of previously added links .
Th... | null | https://raw.githubusercontent.com/shayne-fletcher/zen/10a1d0b9bf261bb133918dd62fb1593c3d4d21cb/ocaml/link/link.ml | ocaml | Types for objects in the domain : sources, sinks, sets and links
A type for membership evidence. A value of type [('sink, 'set)
accepts] is a witness that ['set] will accept a link with sink type
['sink]
Abstract so that there is no means of faking evidence
The result of the [create_set] operation
The [create_s... | The rules are as follows :
- You can initialize a link set with a sink ;
- You can add links to a set such that :
- The first link 's sink must be of the set 's sink type ;
- Additional links can have as sink types the set sink type or ,
the source types of previously added links .
Th... |
864dfc5482aecfe3c45f45bdc8e43cf7c912ad2783a7f042a25a4ce49d738718 | replikativ/replikativ | realize.cljc | (ns replikativ.realize
"Functions to realize commited transactions."
(:require [clojure.set :as set]
[konserve.core :as k]
[replikativ.environ :refer [store-blob-trans-id store-blob-trans-value
store-blob-trans]]
#?(:clj [kabel.platform-log... | null | https://raw.githubusercontent.com/replikativ/replikativ/1533a7e43e46bfb70e8c8eb34dc5708e611a478d/src/replikativ/realize.cljc | clojure | (ns replikativ.realize
"Functions to realize commited transactions."
(:require [clojure.set :as set]
[konserve.core :as k]
[replikativ.environ :refer [store-blob-trans-id store-blob-trans-value
store-blob-trans]]
#?(:clj [kabel.platform-log... | |
6181b541926e239885a834108ac5531af06c6e4211c7572d0f62e2a2e6169435 | apache/couchdb-couch-replicator | couch_replicator_selector_tests.erl | Licensed under the Apache License , Version 2.0 ( the " License " ) ; you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% -2.0
%
% Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an " A... | null | https://raw.githubusercontent.com/apache/couchdb-couch-replicator/d00b981445c03622497088eb872059ab4f48b298/test/couch_replicator_selector_tests.erl | erlang | use this file except in compliance with the License. You may obtain a copy of
the License at
-2.0
Unless required by applicable law or agreed to in writing, software
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations... | Licensed under the Apache License , Version 2.0 ( the " License " ) ; you may not
distributed under the License is distributed on an " AS IS " BASIS , WITHOUT
-module(couch_replicator_selector_tests).
-include_lib("couch/include/couch_eunit.hrl").
-include_lib("couch/include/couch_db.hrl").
-include_lib("couch_re... |
6484a70ce2a110fbc559012b1b2ae45d8917031eacdfb19aa6ddb9dffd0573a3 | SquidDev/illuaminate | token.ml | (** Represents any kind of token *)
open IlluaminateCore
open Node
open Syntax
open Syntax.UnOp
open Syntax.BinOp
open! Token
open! Grammar
open Lens
type lexer_token =
| Token of Token.t
| Trivial of trivial
let make_token leading_trivia trailing_trivia span =
let mk contents = Node { leading_trivia; trailing... | null | https://raw.githubusercontent.com/SquidDev/illuaminate/06a499ba9ac51b605249add0ab2987d1868f8836/src/parser/token.ml | ocaml | * Represents any kind of token |
open IlluaminateCore
open Node
open Syntax
open Syntax.UnOp
open Syntax.BinOp
open! Token
open! Grammar
open Lens
type lexer_token =
| Token of Token.t
| Trivial of trivial
let make_token leading_trivia trailing_trivia span =
let mk contents = Node { leading_trivia; trailing_trivia; span; contents } in
let m... |
1c5911ff06d013369a075c530c9c03bbe2d47dc42e490fe8844566b99b4baf51 | M4GNV5/Geschwindigkeitsficken | X64Assembly.hs | module Brainfuck.Output.X64Assembly (compileStatements) where
import Data.Maybe
import Data.Char
import Data.Ratio
import Data.List
import Data.Ord
import Numeric
import Brainfuck
ptr = "%rbx"
reg1 = "%al"
reg2 = "%cl"
reg3 ... | null | https://raw.githubusercontent.com/M4GNV5/Geschwindigkeitsficken/1567ea4213f72212b43f97629809f255b6b5f8a3/src/Brainfuck/Output/X64Assembly.hs | haskell | TODO use %r11b too? Then it would need to be stored in environment.S | module Brainfuck.Output.X64Assembly (compileStatements) where
import Data.Maybe
import Data.Char
import Data.Ratio
import Data.List
import Data.Ord
import Numeric
import Brainfuck
ptr = "%rbx"
reg1 = "%al"
reg2 = "%cl"
reg3 ... |
1e95e4e43b7befee4b5daa115aedc416af4d4f71c353f3e89ac4043964ddce7e | iokasimov/pandora | Ring.hs | module Pandora.Pattern.Object.Ring (Ring) where
import Pandora.Pattern.Object.Group (Group)
{- |
> When providing a new instance, you should ensure it satisfies:
> * Commutativity of addition: x + y ≡ y + x
-}
class Group a => Ring a where
| null | https://raw.githubusercontent.com/iokasimov/pandora/4ff22ccf1c9824e3072d2ea0163b923798528b3a/Pandora/Pattern/Object/Ring.hs | haskell | |
> When providing a new instance, you should ensure it satisfies:
> * Commutativity of addition: x + y ≡ y + x
| module Pandora.Pattern.Object.Ring (Ring) where
import Pandora.Pattern.Object.Group (Group)
class Group a => Ring a where
|
a53718599568b4ef258a862a8c800d08473c9e192745f11cdcef095045c2e0b0 | tgass/macbeth | BoardState.hs | module Macbeth.Wx.Game.BoardState where
import Control.Concurrent.STM
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.Maybe
import Data.Maybe
import Data.MultiSet (MultiSet)
import qualified Data.MultiSet as MultiSet
import ... | null | https://raw.githubusercontent.com/tgass/macbeth/c64b3cc9b641444688b14a2838ee554932f0e9e6/macbeth-wx/src/Macbeth/Wx/Game/BoardState.hs | haskell | macbeth waiting for the user to make a move | module Macbeth.Wx.Game.BoardState where
import Control.Concurrent.STM
import Control.Monad
import Control.Monad.IO.Class
import Control.Monad.Trans.Maybe
import Data.Maybe
import Data.MultiSet (MultiSet)
import qualified Data.MultiSet as MultiSet
import ... |
aa02d69840471aef42b8102eb38a7f6729a1f24822676ec3a2a545da39c1f596 | thedavidmeister/xoroshiro128 | performance.cljc | (ns xoroshiro128.test.performance
(:require
cljc-long.core
xoroshiro128.xoroshiro128
xoroshiro128.state
#?(:clj criterium.core)
[clojure.test :refer [deftest is]]))
#?(:clj (set! *warn-on-reflection* true))
#?(:clj (set! *unchecked-math* :warn-on-boxed))
(defn bench
[f]
#?(:clj (criterium.core/bench (f))... | null | https://raw.githubusercontent.com/thedavidmeister/xoroshiro128/b4d5be3255e3fa8b78289aa5e7e8e41f14f71aca/test/xoroshiro128/test/performance.cljc | clojure | (ns xoroshiro128.test.performance
(:require
cljc-long.core
xoroshiro128.xoroshiro128
xoroshiro128.state
#?(:clj criterium.core)
[clojure.test :refer [deftest is]]))
#?(:clj (set! *warn-on-reflection* true))
#?(:clj (set! *unchecked-math* :warn-on-boxed))
(defn bench
[f]
#?(:clj (criterium.core/bench (f))... | |
e1faefe7d49479266eb6b5eb10282d1da28df933041a81e746ab5c43fff3c498 | links-lang/links | unionfind.ml | (**************************************************************************)
Mini , a type inference engine based on constraint solving .
Copyright ( C ) 2006 . ,
and .
(* ... | null | https://raw.githubusercontent.com/links-lang/links/2923893c80677b67cacc6747a25b5bcd65c4c2b6/core/unionfind.ml | ocaml | ************************************************************************
This program is free software; you can redistribute it and/or modify
This program is distribute... | Mini , a type inference engine based on constraint solving .
Copyright ( C ) 2006 . ,
and .
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; version 2 of the Licen... |
f1205430ec987e0f2da542655c3b757ba8337bc4e9470e0921d97c8c46179712 | metosin/ring-swagger | coerce_test.clj | (ns ring.swagger.coerce-test
(:require [midje.sweet :refer :all]
[schema.core :as s]
[ring.swagger.coerce :as rsc]
[ring.swagger.extension :as extension]
[schema.coerce :as sc])
(:import [org.joda.time LocalDate DateTime LocalTime]
[java.util Date UUID]))
... | null | https://raw.githubusercontent.com/metosin/ring-swagger/0ef9046174dec0ebd4cbf97d6cc5c6846ef11996/test/ring/swagger/coerce_test.clj | clojure | (ns ring.swagger.coerce-test
(:require [midje.sweet :refer :all]
[schema.core :as s]
[ring.swagger.coerce :as rsc]
[ring.swagger.extension :as extension]
[schema.coerce :as sc])
(:import [org.joda.time LocalDate DateTime LocalTime]
[java.util Date UUID]))
... | |
25019ef22ba8aabae5425fc9ad47719a696f9a5a73ecef3387dade056cd810d4 | OCamlPro/ezjs | amcharts3.ml | open Js_of_ocaml
open Ezjs_bind
let jsdeps = ref [
"/amcharts/amcharts.js";
"/amcharts/pie.js";
"/amcharts/serial.js";
"/amcharts/plugins/export/export.js";
"/amcharts/themes/light.js"
]
class type export =
object
method enabled : bool_field
method divId : Js.js_string Js.t Js.opt Js.p... | null | https://raw.githubusercontent.com/OCamlPro/ezjs/4dc09b1e9eeecd46f3717036303ac704cc49b9a1/libs/amcharts3/amcharts3.ml | ocaml | makes it 3D
makes it 3D
do not modify
do not modify
Read-only
Read-only
method balloon : AmBalloon.t TODO
"left" or "right"
Read-only
method maximumDate : Date.t TODO
Read-only
method minimumDate : Date.t TODO
Read-only
do not modify
do not modify | open Js_of_ocaml
open Ezjs_bind
let jsdeps = ref [
"/amcharts/amcharts.js";
"/amcharts/pie.js";
"/amcharts/serial.js";
"/amcharts/plugins/export/export.js";
"/amcharts/themes/light.js"
]
class type export =
object
method enabled : bool_field
method divId : Js.js_string Js.t Js.opt Js.p... |
16304c84e1d921f121dbf0c5760ab2c7266af573667273eb270e7b435d036656 | ulises/sliver | node.clj | (ns sliver.node
(:require [co.paralleluniverse.pulsar.core :as c]
[sliver.handshake :as h]
[sliver.handler :as ha]
[sliver.primitive :as p]
[sliver.reaper :as r]
[sliver.server-thread :as s]
[sliver.util :as util]
[taoensso.timbre :as... | null | https://raw.githubusercontent.com/ulises/sliver/a0b600e157e41298f026e030868465b618fbd73c/src/sliver/node.clj | clojure | (ns sliver.node
(:require [co.paralleluniverse.pulsar.core :as c]
[sliver.handshake :as h]
[sliver.handler :as ha]
[sliver.primitive :as p]
[sliver.reaper :as r]
[sliver.server-thread :as s]
[sliver.util :as util]
[taoensso.timbre :as... | |
5b7bc70e83b8605237c18a8c969c5d4eb6826506c290cfdc2c771c0566d8140c | crategus/cl-cffi-gtk | rtest-gtk-accel-label.lisp | (def-suite gtk-accel-label :in gtk-suite)
(in-suite gtk-accel-label)
;;; --- Types and Values -------------------------------------------------------
;;; GtkAccelLabel
(test gtk-accel-label-class
;; Type check
(is (g-type-is-object "GtkAccelLabel"))
;; Check the registered name
(is (eq 'gtk-accel-label
... | null | https://raw.githubusercontent.com/crategus/cl-cffi-gtk/7f5a09f78d8004a71efa82794265f2587fff98ab/test/rtest-gtk-accel-label.lisp | lisp | --- Types and Values -------------------------------------------------------
GtkAccelLabel
Type check
Check the registered name
Check the type initializer
Check the parent
Check the children
Check the interfaces
Check the class properties
Check the style properties.
Check the class definition
--- Proper... | (def-suite gtk-accel-label :in gtk-suite)
(in-suite gtk-accel-label)
(test gtk-accel-label-class
(is (g-type-is-object "GtkAccelLabel"))
(is (eq 'gtk-accel-label
(registered-object-type-by-name "GtkAccelLabel")))
(is (eq (gtype "GtkAccelLabel")
(gtype (foreign-funcall "gtk_accel_label_get_t... |
7f4237185804def38398d998f5a08eecb4d08a4d87dd07b580cfdace7e1184b3 | UnixJunkie/oranger | RF.mli |
type filename = string
type mode = Regression
| Classification
val train: ?debug:bool -> ?nprocs:int ->
mode -> int -> int option -> filename -> string -> filename -> bool
* [ train ~debug ~nprocs mode nb_trees mtry data_fn dep_var_name out_fn ]
will train a Random Forests model with [ nb_trees ] ,... | null | https://raw.githubusercontent.com/UnixJunkie/oranger/9cb037512abf0331ed26d848b1a0cb7ccad250e0/src/RF.mli | ocaml |
type filename = string
type mode = Regression
| Classification
val train: ?debug:bool -> ?nprocs:int ->
mode -> int -> int option -> filename -> string -> filename -> bool
* [ train ~debug ~nprocs mode nb_trees mtry data_fn dep_var_name out_fn ]
will train a Random Forests model with [ nb_trees ] ,... | |
df389141a62622c2f809b46c2c289183519148e424e368295894788b08e5244b | racket/games | array.rkt | #lang racket
(provide array-make array-ref array-set!
array-mult array-mult-vector
array-det array-sub array-inv)
;; creates a square matrix, nxn
(define (array-make n)
(define a (make-vector n #f))
(for ([i (in-range n)])
(vector-set! a i (make-vector n 0.0)))
a)
;; returns an array elem... | null | https://raw.githubusercontent.com/racket/games/e57376f067be51257ed12cdf3e4509a00ffd533d/jewel/array.rkt | racket | creates a square matrix, nxn
returns an array element
sets an array element
matrix - matrix multiplication
vector - matrix multiplication
calculates the determinant of a matrix
create sub-matrix
return the determinant
creates a sub-matrix, except row 'in' and column 'jn'
calculates the inverse of a matrix
(d... | #lang racket
(provide array-make array-ref array-set!
array-mult array-mult-vector
array-det array-sub array-inv)
(define (array-make n)
(define a (make-vector n #f))
(for ([i (in-range n)])
(vector-set! a i (make-vector n 0.0)))
a)
(define (array-ref m i j)
(vector-ref (vector-ref m i)... |
cd3744d7834c46ef27ad043fc455defd5f222d0eb07c83ec812af2780c319435 | gothinkster/clojurescript-reframe-realworld-example-app | db.cljs | (ns conduit.db
(:require [cljs.reader]
[re-frame.core :refer [reg-cofx]]))
;; -- Default app-db Value ---------------------------------------------------
;;
When the application first starts , this will be the value put in app - db
;; Look in:
;; 1. `core.cljs` for "(dispatch-sync [:initialise-db]... | null | https://raw.githubusercontent.com/gothinkster/clojurescript-reframe-realworld-example-app/20d28a7ae3f38659f6fed848dc376d8a71587640/src/conduit/db.cljs | clojure | -- Default app-db Value ---------------------------------------------------
Look in:
1. `core.cljs` for "(dispatch-sync [:initialise-db])"
what gets put into app-db by default.
-- Local Storage ----------------------------------------------------------
Part of the conduit challenge is to store a user in ... | (ns conduit.db
(:require [cljs.reader]
[re-frame.core :refer [reg-cofx]]))
When the application first starts , this will be the value put in app - db
2 . ` events.cljs ` for the registration of : initialise - db handler
(defn set-user-ls
"Puts user into localStorage"
[user]
sorted - map w... |
494deb8a03a6a4ec2f8e94d3825b84e7361d4fcf3e294518d9e693cad818e390 | danr/hipspec | Scope.hs | # LANGUAGE FlexibleContexts , MultiParamTypeClasses , FlexibleInstances ,
TypeSynonymInstances , ScopedTypeVariables , FunctionalDependencies #
TypeSynonymInstances,ScopedTypeVariables,FunctionalDependencies #-}
| Some common utilites for a MonadReader that keeps track of variables in scop... | null | https://raw.githubusercontent.com/danr/hipspec/a114db84abd5fee8ce0b026abc5380da11147aa9/src/HipSpec/Lang/Scope.hs | haskell | | Make a scope
| Extend the scope with a list of variables
| Removes an entry from the scope
| Clear the scope
| The empty scope
| True if the variable is in scope
| Returns only the elments that are in scope
| Gets the current scope | # LANGUAGE FlexibleContexts , MultiParamTypeClasses , FlexibleInstances ,
TypeSynonymInstances , ScopedTypeVariables , FunctionalDependencies #
TypeSynonymInstances,ScopedTypeVariables,FunctionalDependencies #-}
| Some common utilites for a MonadReader that keeps track of variables in scop... |
3cddbab1e77b203c91a92e11342ae4f51aac996fe38746b31765cd69ab1e2133 | quan-nh/adventofcode | day3.clj | (ns adventofcode2016.day3
(:require [clojure.java.io :as io]
[clojure.string :as str]))
(def input (slurp (io/resource "2016/day3")))
(defn possible? [[a b c]]
(and (> (+ a b) c)
(> (+ a c) b)
(> (+ b c) a)))
(defn parse-triangle [triangle]
(let [[a b c] (str/split (str/trim triangle)... | null | https://raw.githubusercontent.com/quan-nh/adventofcode/98542934a121d1df85dd271d28fedc1f25b98206/src/adventofcode2016/day3.clj | clojure | part1
part2 | (ns adventofcode2016.day3
(:require [clojure.java.io :as io]
[clojure.string :as str]))
(def input (slurp (io/resource "2016/day3")))
(defn possible? [[a b c]]
(and (> (+ a b) c)
(> (+ a c) b)
(> (+ b c) a)))
(defn parse-triangle [triangle]
(let [[a b c] (str/split (str/trim triangle)... |
b868129ea30866cc5acc1f0311cb1be15620b6fc993d717c85da17019ce27b0d | cabol/cross_db | xdb_exception.erl | %%%-------------------------------------------------------------------
%%% @doc
%%% Common exceptions.
%%% @end
%%%-------------------------------------------------------------------
-module(xdb_exception).
-export([
invalid_changeset_error/1,
no_primary_key_field_error/1,
no_primary_key_value_error/2,
multipl... | null | https://raw.githubusercontent.com/cabol/cross_db/365bb3b6cffde1b4da7109ed2594a0a3f1a4a949/src/xdb_exception.erl | erlang | -------------------------------------------------------------------
@doc
Common exceptions.
@end
-------------------------------------------------------------------
===================================================================
API
=================================================================== | -module(xdb_exception).
-export([
invalid_changeset_error/1,
no_primary_key_field_error/1,
no_primary_key_value_error/2,
multiple_results_error/2,
no_results_error/1,
stale_entry_error/2,
no_transaction_is_active/0,
invalid_query_error/2
]).
-spec invalid_changeset_error(xdb_changeset:t()) -> no_retu... |
50c460fbe64f277fb26817a5061cf1fed425f00c0c21a318a8688d581a16b25f | ocaml-sf/learn-ocaml-corpus | solution.ml | let rec weight (t : tree) =
match t with
| Leaf ->
0
| Node (t1, t2) ->
weight t1 + weight t2 + 1
let rec height (t : tree) =
match t with
| Leaf ->
0
| Node (t1, t2) ->
max (height t1) (height t2) + 1
(* Counting the binary trees of weight [w], in a naive way.
Not efficient (no... | null | https://raw.githubusercontent.com/ocaml-sf/learn-ocaml-corpus/7dcf4d72b49863a3e37e41b3c3097aa4c6101a69/exercises/fpottier/counting_trees/solution.ml | ocaml | Counting the binary trees of weight [w], in a naive way.
Not efficient (no memoization) and not elegant (explicit
mutable partial sum).
Counting the binary trees of weight [i], for every [i] ranging
from [0] to [w], using dynamic programming. An array is used to
store the results.
Base case.
Step.
... | let rec weight (t : tree) =
match t with
| Leaf ->
0
| Node (t1, t2) ->
weight t1 + weight t2 + 1
let rec height (t : tree) =
match t with
| Leaf ->
0
| Node (t1, t2) ->
max (height t1) (height t2) + 1
let rec naive_trees_of_weight w =
if w = 0 then
1
else
let w = w - ... |
0d4e687ed45b96fc21fadeeb437d17cdc91b69588e66291c0c004eec9ab75b0c | nirum-lang/nirum | HtmlSpec.hs | # LANGUAGE QuasiQuotes #
module Nirum.Docs.HtmlSpec where
import Test.Hspec.Meta
import Text.InterpolatedString.Perl6 (q)
import Nirum.Docs (Html)
import Nirum.Docs.Html (render)
import Nirum.DocsSpec (sampleDocument)
expectedHtml :: Html
expectedHtml = [q|<h1>Hello</h1>
<p>Tight list:</p>
<ul>
<li>List test</li>
<l... | null | https://raw.githubusercontent.com/nirum-lang/nirum/4d4488b0524874abc6e693479a5cc70c961bad33/test/Nirum/Docs/HtmlSpec.hs | haskell | # LANGUAGE QuasiQuotes #
module Nirum.Docs.HtmlSpec where
import Test.Hspec.Meta
import Text.InterpolatedString.Perl6 (q)
import Nirum.Docs (Html)
import Nirum.Docs.Html (render)
import Nirum.DocsSpec (sampleDocument)
expectedHtml :: Html
expectedHtml = [q|<h1>Hello</h1>
<p>Tight list:</p>
<ul>
<li>List test</li>
<l... | |
45c4f00c9ff11438795adfc1f4448b1967a5c4c2d9e670f38b4f87a2a2041c3b | district0x/district-designer | syncer.cljs | (ns tokens.server.syncer)
(defn add-token-factory []
)
(defn update-token-contract []
)
(defn remove-token-contract []
)
(defn add-district-token-contract []
)
(defn remove-district-token-contract []
)
(defn add-token-contract-misconfig-report []
)
(defn resolve-token-contract-misconfig-report ... | null | https://raw.githubusercontent.com/district0x/district-designer/3f2a585b866b6e173f2cb7b32ecadcffa33e2804/src/tokens/server/syncer.cljs | clojure | (ns tokens.server.syncer)
(defn add-token-factory []
)
(defn update-token-contract []
)
(defn remove-token-contract []
)
(defn add-district-token-contract []
)
(defn remove-district-token-contract []
)
(defn add-token-contract-misconfig-report []
)
(defn resolve-token-contract-misconfig-report ... | |
a8c359735973042b42f765ed8cf78560e34f1c70680c78ba96133f60a09b4eb7 | dmitryvk/sbcl-win32-threads | run-program.impure.lisp | ;;;; various RUN-PROGRAM tests with side effects
This software is part of the SBCL system . See the README file for
;;;; more information.
;;;;
While most of SBCL is derived from the CMU CL system , the test
;;;; files (like this one) were written from scratch after the fork
from CMU CL .
;;;;
;;;; This software... | null | https://raw.githubusercontent.com/dmitryvk/sbcl-win32-threads/5abfd64b00a0937ba2df2919f177697d1d91bde4/tests/run-program.impure.lisp | lisp | various RUN-PROGRAM tests with side effects
more information.
files (like this one) were written from scratch after the fork
This software is in the public domain and is provided with
absolutely no warranty. See the COPYING and CREDITS files for
more information.
In addition to definitions lower down the impur... |
This software is part of the SBCL system . See the README file for
While most of SBCL is derived from the CMU CL system , the test
from CMU CL .
(cl:in-package :cl-user)
is the sigchld handler that RUN - PROGRAM sets up , which interfers
( sometimes the handler will manage to WAIT3 a process before
(with-... |
0d0ff0952800ee5dab4efeb62610fd16eac01141a2e48b5500713f10b46182e2 | RichiH/git-annex | Files.hs | git - annex extra config files
-
- Copyright 2012 < >
-
- Licensed under the GNU GPL version 3 or higher .
-
- Copyright 2012 Joey Hess <>
-
- Licensed under the GNU GPL version 3 or higher.
-}
# OPTIONS_GHC -fno - warn - tabs #
module Config.Files where
import Common
import Utility.Tmp
impo... | null | https://raw.githubusercontent.com/RichiH/git-annex/bbcad2b0af8cd9264d0cb86e6ca126ae626171f3/Config/Files.hs | haskell | ~/.config/git-annex/file
Returns anything listed in the autostart file (which may not exist).
Ignore any relative paths; some old buggy versions added eg "."
Adds a directory to the autostart file. If the directory is already
- present, it's moved to the top, so it will be used as the default
- when opening the... | git - annex extra config files
-
- Copyright 2012 < >
-
- Licensed under the GNU GPL version 3 or higher .
-
- Copyright 2012 Joey Hess <>
-
- Licensed under the GNU GPL version 3 or higher.
-}
# OPTIONS_GHC -fno - warn - tabs #
module Config.Files where
import Common
import Utility.Tmp
impo... |
58b47ff6b56085fed6f77d43b3a2f8b4a0df9558b6580be3f49bf1e4fc1ad286 | pedestal/samples | user.clj | Copyright 2013 Relevance , Inc.
; The use and distribution terms for this software are covered by the
Eclipse Public License 1.0 ( )
; which can be found in the file epl-v10.html at the root of this distribution.
;
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this licens... | null | https://raw.githubusercontent.com/pedestal/samples/caaf04afe255586f8f4e1235deeb0c1904179355/chat/chat-server/dev/user.clj | clojure | The use and distribution terms for this software are covered by the
which can be found in the file epl-v10.html at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not remove this notice, or any other, from this software. | Copyright 2013 Relevance , Inc.
Eclipse Public License 1.0 ( )
(defn dev
[]
(require 'dev)
(in-ns 'dev)
#_(dev/start)) |
1727369312f8c45d7fb3f0284a2ba64c42023a60f71165d8548833f5449c41ca | commercialhaskell/stack | Build.hs | # LANGUAGE NoImplicitPrelude #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE RecordWildCards #
-- | Configuration options for building.
module Stack.Types.Config.Build
( BuildOpts (..)
, BuildCommand (..)
, defaultBuildOpts
, defaultBuildOptsCLI
, BuildOptsCLI (..)
, BuildOptsMonoid (..)
, TestOpts (.... | null | https://raw.githubusercontent.com/commercialhaskell/stack/80429690da92c634cb129f99f1507dbc47a70d45/src/Stack/Types/Config/Build.hs | haskell | # LANGUAGE OverloadedStrings #
| Configuration options for building.
| Build options that is interpreted by the build command. This is built up
^ Build haddocks?
^ Options to pass to haddock
^ Open haddocks in the browser?
^ Build haddocks for dependencies?
^ Build haddocks for all symbols and packages, like
int... | # LANGUAGE NoImplicitPrelude #
# LANGUAGE RecordWildCards #
module Stack.Types.Config.Build
( BuildOpts (..)
, BuildCommand (..)
, defaultBuildOpts
, defaultBuildOptsCLI
, BuildOptsCLI (..)
, BuildOptsMonoid (..)
, TestOpts (..)
, defaultTestOpts
, TestOptsMonoid (..)
, HaddockOpts (..)
, defa... |
02f9c56c274d5eeaeb63479ec0b731ae91b67833f498002132635bc01ca3a657 | programaker-project/Programaker-Core | automate_template_engine_matching.erl | %%%-------------------------------------------------------------------
%% @doc automate_template_engine interface.
%% @end
%%%-------------------------------------------------------------------
-module(automate_template_engine_matching).
%% API
-export([ match/4
]).
-define(BACKEND, automate_template_engine_... | null | https://raw.githubusercontent.com/programaker-project/Programaker-Core/e9a14b09d6a82edf4bb3976a7369e5cee2373624/backend/apps/automate_template_engine/src/automate_template_engine_matching.erl | erlang | -------------------------------------------------------------------
@doc automate_template_engine interface.
@end
-------------------------------------------------------------------
API
====================================================================
API functions
===============================================... |
-module(automate_template_engine_matching).
-export([ match/4
]).
-define(BACKEND, automate_template_engine_mnesia_backend).
-include("records.hrl").
-include("../../automate_bot_engine/src/program_records.hrl").
match(Owner, Thread, TemplateId, InputValue) ->
case ?BACKEND:get_template(Owner, TemplateI... |
a150a92cbea2a889ddcc0fc079ea64a72c7b29c1c4418343a1a74535ed68e042 | brendanhay/gogol | List.hs | # LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DuplicateRecordFields #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE LambdaCase #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE PatternSynonyms #
# LANGUAGE RecordWildCards #
{-# LANGUAGE St... | null | https://raw.githubusercontent.com/brendanhay/gogol/fffd4d98a1996d0ffd4cf64545c5e8af9c976cda/lib/services/gogol-youtube/gen/Gogol/YouTube/VideoCategories/List.hs | haskell | # LANGUAGE OverloadedStrings #
# LANGUAGE StrictData #
|
Stability : auto-generated
Retrieves a list of resources, possibly filtered.
/See:/ </ YouTube Data API v3 Reference> for @youtube.videoCategories.list@.
* Resource
** Constructing a Request
| A resource alias for @youtube.videoCategories.list@ method ... | # LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DuplicateRecordFields #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE LambdaCase #
# LANGUAGE PatternSynonyms #
# LANGUAGE RecordWildCards #
# LANGUAGE TypeFamilies #
# LANGUAGE TypeOperators... |
831d3177e9632de05f2f4c9199dac62c7732fad019dd9853199c2b9c61559850 | lambda-pi-plus/lambda-pi-plus | Context.hs | --{-# OPTIONS_GHC -F -pgmF she #-}
{-# LANGUAGE DeriveGeneric #-}
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
{-# LANGUAGE GADTs #-}
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE KindSignatures #
# LANGUAGE MultiParamTypeClasses ... | null | https://raw.githubusercontent.com/lambda-pi-plus/lambda-pi-plus/78eba7ebb7b2ed94f7cb06f0d1aca4d07eb3626f/src/PatternUnify/Context.hs | haskell | {-# OPTIONS_GHC -F -pgmF she #-}
# LANGUAGE DeriveGeneric #
# LANGUAGE GADTs #
# LANGUAGE PatternSynonyms #
# LANGUAGE TemplateHaskell #
# LANGUAGE TypeSynonymInstances #
# LANGUAGE UndecidableInstances #
This module defines unification problems, meta... | # LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE KindSignatures #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE StandaloneDeriving #
module PatternUnify.Context wher... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.