_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 |
|---|---|---|---|---|---|---|---|---|
aa4e8726033ce20e69a2e7a5e598e8bb25c4f68b93bd86dac2ecf9fea7c4fb52 | samrushing/irken-compiler | t_match_record.scm |
(include "lib/core.scm")
(define thing
{a=x b=2} -> x
{a=3 b=y} -> y
{a=m b=n} -> (+ m n)
)
;; =>
;; (define (thing r)
;; (match r.a r.b with
;; x 2 -> x
;; 3 y -> y
;; ))
(printn (thing {a=3 b=1}))
(printn (thing {a=3 b=2}))
(printn (thing {a=4 b=5}))
| null | https://raw.githubusercontent.com/samrushing/irken-compiler/690da48852d55497f873738df54f14e8e135d006/tests/t_match_record.scm | scheme | =>
(define (thing r)
(match r.a r.b with
x 2 -> x
3 y -> y
)) |
(include "lib/core.scm")
(define thing
{a=x b=2} -> x
{a=3 b=y} -> y
{a=m b=n} -> (+ m n)
)
(printn (thing {a=3 b=1}))
(printn (thing {a=3 b=2}))
(printn (thing {a=4 b=5}))
|
6d7b12d212268fc7d151b297e30bcf4a9b293145dbbf34eed0b0fcfe07d6847e | regex-generate/regenerate | regex.ml | type 'a cset = 'a list
type 'a t
= One
| Set of bool * 'a cset
| Seq of 'a t * 'a t
| Or of 'a t * 'a t
| And of 'a t * 'a t
| Not of 'a t
| Rep of int * int option * 'a t
(** Smart constructors *)
let epsilon = One
let void = Set (true, [])
let atom c = Set (true, [c])
let char c = atom c
let charset ... | null | https://raw.githubusercontent.com/regex-generate/regenerate/a616d6c2faf4a55f794ac9b6fbf03acca91fbeb9/lib/regex.ml | ocaml | * Smart constructors
* QCheck utilities | type 'a cset = 'a list
type 'a t
= One
| Set of bool * 'a cset
| Seq of 'a t * 'a t
| Or of 'a t * 'a t
| And of 'a t * 'a t
| Not of 'a t
| Rep of int * int option * 'a t
let epsilon = One
let void = Set (true, [])
let atom c = Set (true, [c])
let char c = atom c
let charset cs = Set (true, cs)
let co... |
a50b3cbc2488dad7a2610aea24c5b3b2a32cabc7ea6cf21efec9c58cf88a6d6e | ghc/ghc | Env.hs | ( c ) The University of Glasgow 2002 - 2006
{-# LANGUAGE RankNTypes #-}
module GHC.Iface.Env (
newGlobalBinder, newInteractiveBinder,
externaliseName,
lookupIfaceTop,
lookupOrig, lookupNameCache, lookupOrigNameCache,
newIfaceName, newIfaceNames,
extendIfaceIdEnv, exte... | null | https://raw.githubusercontent.com/ghc/ghc/3c0f0c6d99486502c72e6514a40e7264baaa6afc/compiler/GHC/Iface/Env.hs | haskell | # LANGUAGE RankNTypes #
Name-cache stuff
Used for source code and interface files, to make the
Name for a thing, given its Module and OccName
The cache may already have a binding for this thing,
because we may have seen an occurrence before, but now is the
moment when we know its Module and SrcLoc in their full ... | ( c ) The University of Glasgow 2002 - 2006
module GHC.Iface.Env (
newGlobalBinder, newInteractiveBinder,
externaliseName,
lookupIfaceTop,
lookupOrig, lookupNameCache, lookupOrigNameCache,
newIfaceName, newIfaceNames,
extendIfaceIdEnv, extendIfaceTyVarEnv,
tcI... |
724dbb44fc51df5ba268e83710f6e6c73ffbc8d2290a041ede494bcba1e7db5a | adityavkk/N-Body-Simulations | Spec.hs | import Test.Hspec
main :: IO ()
main = hspec test
test = describe "testing" $
it "tests" $
1 `shouldBe` 1
| null | https://raw.githubusercontent.com/adityavkk/N-Body-Simulations/23e379e513b3254cd7144408fe132a5280ff9ce6/Barnes-Hut/test/Spec.hs | haskell | import Test.Hspec
main :: IO ()
main = hspec test
test = describe "testing" $
it "tests" $
1 `shouldBe` 1
| |
6d5737884ceadeec9c2245335677861b80e8d08b526267f429808be14206df36 | prg-titech/Kani-CUDA | while.rkt | #lang rosette
;; T x; => (define x (new-vec T))
- NOTE : T x = e ; を ( define x e ) と書いてはならない . vector が共有される可能性がある.
代わりに ( begin ( define x ( new - vec T ) ) ( vec - set ! x e ) ) と書く.
x = e ; = > ( vec - set ! x e )
;; threadIdx.x => (tid)
;; arr[ix]; => (array-ref arr ix)
;; arr[ix] = e => ... | null | https://raw.githubusercontent.com/prg-titech/Kani-CUDA/e97c4bede43a5fc4031a7d2cfc32d71b01ac26c4/Emulator/while.rkt | racket | T x; => (define x (new-vec T))
を ( define x e ) と書いてはならない . vector が共有される可能性がある.
= > ( vec - set ! x e )
threadIdx.x => (tid)
arr[ix]; => (array-ref arr ix)
arr[ix] = e => array-set!
if, while -> if-, while
syncthreads -> barrier
syntax
arithmetic/Boolean operators
thread ID
vector/array
ba... | #lang rosette
代わりに ( begin ( define x ( new - vec T ) ) ( vec - set ! x e ) ) と書く.
(provide
if- while : = :=
/LS is for avoiding naming conflicts
+/LS eq?/LS !/LS &&/LS </LS >/LS quotient/LS
ntid tid
new-vec scalar->vec new-sh-array vec-set! array-ref! array-set! make-element element-content... |
c420f3ef16e1bcc861914f2473c9e45cfd06eaba735c00dbf0b6ef8fc52efbc4 | replikativ/datahike | db.cljc | (ns ^:no-doc datahike.db
(:require
[clojure.data :as data]
[clojure.walk :refer [postwalk]]
#?(:clj [clojure.pprint :as pp])
[datahike.config :as dc]
[datahike.constants :as c :refer [ue0 e0 tx0 utx0 emax txmax system-schema]]
[datahike.datom :as dd :refer [datom datom-tx datom-added]]
[datahike.... | null | https://raw.githubusercontent.com/replikativ/datahike/3625234370d336aa7e4caa77ec07566d340ca910/src/datahike/db.cljc | clojure | ----------------------------------------------------------------------------
macros and funcs to support writing defrecords and updating
code taken from prismatic:
----------------------------------------------------------------------------
----------------------------------------------------------------------... | (ns ^:no-doc datahike.db
(:require
[clojure.data :as data]
[clojure.walk :refer [postwalk]]
#?(:clj [clojure.pprint :as pp])
[datahike.config :as dc]
[datahike.constants :as c :refer [ue0 e0 tx0 utx0 emax txmax system-schema]]
[datahike.datom :as dd :refer [datom datom-tx datom-added]]
[datahike.... |
321347b3aa5a49c009905d04c8192b9f9422ef6f2877db6b3567b1a2733c174b | zippy/anansi | irc_bridge_out.clj | (ns anansi.test.streamscapes.channels.irc-bridge-out
(:use [anansi.streamscapes.channels.irc-bridge-out] :reload)
(:use [anansi.ceptr]
[anansi.receptor.scape]
[anansi.receptor.user :only [user-def]]
[anansi.streamscapes.streamscapes]
[anansi.streamscapes.contact :only [contact-def]]
... | null | https://raw.githubusercontent.com/zippy/anansi/881aa279e5e7836f3002fc2ef7623f2ee1860c9a/test/anansi/test/streamscapes/channels/irc_bridge_out.clj | clojure | (ns anansi.test.streamscapes.channels.irc-bridge-out
(:use [anansi.streamscapes.channels.irc-bridge-out] :reload)
(:use [anansi.ceptr]
[anansi.receptor.scape]
[anansi.receptor.user :only [user-def]]
[anansi.streamscapes.streamscapes]
[anansi.streamscapes.contact :only [contact-def]]
... | |
d6aa191fbe76fb2d26334da8ddb7a201838049c1dd67ab802bb9fa30f5db0eb1 | sadiqj/ocaml-esp32 | module_constraints.ml | module type S = sig val y : float end;;
module type T = sig val x : float val y : float end;;
type t = T : (module S) -> t;;
let rec x = let module M = (val m) in T (module M)
and (m : (module T)) = (module (struct let x = 10.0 and y = 20.0 end));;
| null | https://raw.githubusercontent.com/sadiqj/ocaml-esp32/33aad4ca2becb9701eb90d779c1b1183aefeb578/testsuite/tests/letrec-disallowed/module_constraints.ml | ocaml | module type S = sig val y : float end;;
module type T = sig val x : float val y : float end;;
type t = T : (module S) -> t;;
let rec x = let module M = (val m) in T (module M)
and (m : (module T)) = (module (struct let x = 10.0 and y = 20.0 end));;
| |
089f35bdf0cb019f26872074b40cc5bb2e01405b53ce4eb44dcdffc2ab379f55 | jesperes/aoc_erlang | aoc2020_day09.erl | %%%=============================================================================
%%% @doc Advent of code puzzle solution
%%% @end
%%%=============================================================================
-module(aoc2020_day09).
-behavior(aoc_puzzle).
-export([ parse/1
, solve1/1
, solve2/1
... | null | https://raw.githubusercontent.com/jesperes/aoc_erlang/ec0786088fb9ab886ee57e17ea0149ba3e91810a/src/2020/aoc2020_day09.erl | erlang | =============================================================================
@doc Advent of code puzzle solution
@end
=============================================================================
------------------------------------------------------------------------------
@doc info/0
Returns info about this puzz... | -module(aoc2020_day09).
-behavior(aoc_puzzle).
-export([ parse/1
, solve1/1
, solve2/1
, info/0
]).
-include("aoc_puzzle.hrl").
-spec info() -> aoc_puzzle().
info() ->
#aoc_puzzle{ module = ?MODULE
, year = 2020
, day = 9
, name = "Encoding Err... |
ddaef702dfb6dfd104fb6dbd6ed1bf5d86c401b0d97ecafffcce9d34c6b443f2 | weavejester/flupot-pixi | core.cljs | (ns example.core
(:require [brutha.core :as br]
[flupot.pixi :as pixi]
[flupot.dom :as dom]))
(enable-console-print!)
(defn- blur-filter [blur]
(let [filter (PIXI.filters.BlurFilter.)]
(set! (.-blur filter) blur)
filter))
(def canvas
(let [filter (blur-filter 15)]
(.log js/c... | null | https://raw.githubusercontent.com/weavejester/flupot-pixi/958e42dc5ee5121e77f8776d402c71b096e71da5/example/src/example/core.cljs | clojure | (ns example.core
(:require [brutha.core :as br]
[flupot.pixi :as pixi]
[flupot.dom :as dom]))
(enable-console-print!)
(defn- blur-filter [blur]
(let [filter (PIXI.filters.BlurFilter.)]
(set! (.-blur filter) blur)
filter))
(def canvas
(let [filter (blur-filter 15)]
(.log js/c... | |
9b7e137ab6be44493bf790fc08c08305284c4c7f51624f742b33a223d689c72b | robrix/sequoia | Negate.hs | # LANGUAGE TypeFamilies #
module Sequoia.Calculus.Negate
( -- * Negate
NegateIntro(..)
, negateL'
, negateR'
, shiftN
, dnePK
, dniPK
, negateLK
, negateRK
, negateLK'
, negateRK'
-- * Connectives
, module Sequoia.Connective.Negate
) where
import Data.Profunctor
import Prelude hiding (init)
import Sequoia.Calculus... | null | https://raw.githubusercontent.com/robrix/sequoia/e4fae1100fa977a656f2fc654762f23d4448ad76/src/Sequoia/Calculus/Negate.hs | haskell | * Negate
* Connectives
Negate
----------------------------------
----------------------------------
----------------------------------
----------------------------------
----------------------------------
--------------------------------------
------------------------------------
----------------------------... | # LANGUAGE TypeFamilies #
module Sequoia.Calculus.Negate
NegateIntro(..)
, negateL'
, negateR'
, shiftN
, dnePK
, dniPK
, negateLK
, negateRK
, negateLK'
, negateRK'
, module Sequoia.Connective.Negate
) where
import Data.Profunctor
import Prelude hiding (init)
import Sequoia.Calculus.Context
import Sequoia.Calculus.... |
9c8493d59de18fd6b426a22345a9eb32aaf92113c26cf219fabaf5a6fd639dc0 | coccinelle/coccinelle | file_transform.ml |
* This file is part of Coccinelle , licensed under the terms of the GPL v2 .
* See copyright.txt in the Coccinelle source code for more information .
* The Coccinelle source code can be obtained at
* This file is part of Coccinelle, licensed under the terms of the GPL v2.
* See copyright.txt in the Cocci... | null | https://raw.githubusercontent.com/coccinelle/coccinelle/57cbff0c5768e22bb2d8c20e8dae74294515c6b3/tools/spgen/source/file_transform.ml | ocaml | -------------------------------------------------------------------------
-------------------------------------------------------------------------
GENERAL PURPOSE FUNCTIONS
-------------------------------------------------------------------------
REGEXES AND STRING MATCH FUNCTIONS
returns true if str matche... |
* This file is part of Coccinelle , licensed under the terms of the GPL v2 .
* See copyright.txt in the Coccinelle source code for more information .
* The Coccinelle source code can be obtained at
* This file is part of Coccinelle, licensed under the terms of the GPL v2.
* See copyright.txt in the Cocci... |
b24f5f90c1d68a49867def7fab9db65aa8dc6e14df922ac184e212f0485ce370 | ghc/packages-directory | Util.hs | {-# LANGUAGE BangPatterns #-}
# LANGUAGE CPP #
-- | A rudimentary testing framework
module Util where
import Prelude ()
import System.Directory.Internal.Prelude
import System.Directory
import Data.Time.Clock (NominalDiffTime, UTCTime, diffUTCTime)
#if MIN_VERSION_base(4, 7, 0)
import System.Environment (getEnvironment,... | null | https://raw.githubusercontent.com/ghc/packages-directory/75165a9d69bebba96e0e3a1e519ab481d1362dd2/tests/Util.hs | haskell | # LANGUAGE BangPatterns #
| A rudimentary testing framework
| Traverse the directory tree in preorder.
Environment variables may be sensitive, so don't log them. | # LANGUAGE CPP #
module Util where
import Prelude ()
import System.Directory.Internal.Prelude
import System.Directory
import Data.Time.Clock (NominalDiffTime, UTCTime, diffUTCTime)
#if MIN_VERSION_base(4, 7, 0)
import System.Environment (getEnvironment, setEnv, unsetEnv)
#elif !defined(mingw32_HOST_OS)
import qualified... |
3e996743f556918b5abbb52b56f7e96f7421f82512aacdea4d924bddda14435d | RedHatQE/katello.auto | repositories.clj | (ns katello.repositories
(:require [webdriver :as browser]
[katello :as kt]
(katello [tasks :as tasks]
[organizations :as organization]
[navigation :as nav]
[providers :as provider] ;to load navigation
[... | null | https://raw.githubusercontent.com/RedHatQE/katello.auto/79fec96581044bce5db5350d0da325e517024962/src/katello/repositories.clj | clojure | to load navigation
Locators
Tasks | (ns katello.repositories
(:require [webdriver :as browser]
[katello :as kt]
(katello [tasks :as tasks]
[organizations :as organization]
[navigation :as nav]
[notifications :as notification]
[ui :as ui]
... |
dc3df65c71f6ac9a53acf0c22f3009a8038228f8348c63c8352bdd806833fab1 | alavrik/piqi | check.ml |
Copyright 2009 , 2010 , 2011 , 2012 , 2013 , 2014 , 2015 , 2017
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... | null | https://raw.githubusercontent.com/alavrik/piqi/bcea4d44997966198dc295df0609591fa787b1d2/src/check.ml | ocaml | command-line arguments
main convert cycle |
Copyright 2009 , 2010 , 2011 , 2012 , 2013 , 2014 , 2015 , 2017
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... |
9f5f31d19812a5f8eb57a889808836c87d685d810f6daa9ecdbfee13b68b2241 | Bost/corona_cases | tables.clj | ;; (printf "Current-ns [%s] loading %s ...\n" *ns* 'corona.tables)
;; (ns corona.tables
;; (:require
;; [corona.countries :as ccr]
;; ))
;; ;; (set! *warn-on-reflection* true)
;; (def ^:const regions
;; "
;; Contains \"Americas\" which is not a standard name. Bloody hell!
;; (United_Nations)#List"
;; ... | null | https://raw.githubusercontent.com/Bost/corona_cases/415d71a29d3e6864ec9095f6236bb86bdcb04647/src/corona/tables.clj | clojure | (printf "Current-ns [%s] loading %s ...\n" *ns* 'corona.tables)
(ns corona.tables
(:require
[corona.countries :as ccr]
))
;; (set! *warn-on-reflection* true)
(def ^:const regions
"
Contains \"Americas\" which is not a standard name. Bloody hell!
(United_Nations)#List"
[
; Congo - Brazzaville... |
[ " China " " Asia " " Eastern Asia " " 1427647786 " " 1433783686 " " +0.43 % " ]
[ " India " " Asia " " Southern Asia " " 1352642280 " " 1366417754 " " +1.02 % " ]
[ " United States " ... |
d216935f69e5f25cbaebb3d8335efe6c01dd91a1d0292b201f1c9978d4477925 | arttuka/reagent-material-ui | face_6_two_tone.cljs | (ns reagent-mui.icons.face-6-two-tone
"Imports @mui/icons-material/Face6TwoTone as a Reagent component."
(:require-macros [reagent-mui.util :refer [create-svg-icon e]])
(:require [react :as react]
["@mui/material/SvgIcon" :as SvgIcon]
[reagent-mui.util]))
(def face-6-two-tone (create-svg-... | null | https://raw.githubusercontent.com/arttuka/reagent-material-ui/14103a696c41c0eb67fc07fc67cd8799efd88cb9/src/icons/reagent_mui/icons/face_6_two_tone.cljs | clojure | (ns reagent-mui.icons.face-6-two-tone
"Imports @mui/icons-material/Face6TwoTone as a Reagent component."
(:require-macros [reagent-mui.util :refer [create-svg-icon e]])
(:require [react :as react]
["@mui/material/SvgIcon" :as SvgIcon]
[reagent-mui.util]))
(def face-6-two-tone (create-svg-... | |
372719972dd6f78a861c2c3ac551f3729b0d8aefd61c08c3770ae647d9d1c602 | gogins/csound-extended-nudruz | nudruz-csound.lisp | ; C O M M O N M U S I C C F F I I N T E R F A C E T O C S O U N D
;
Copyright ( C ) 2016
;
; This file belongs to Csound.
;
; This software 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 ;... | null | https://raw.githubusercontent.com/gogins/csound-extended-nudruz/4551d54890f4adbadc5db8f46cc24af8e92fb9e9/sources/nudruz-csound.lisp | lisp | C O M M O N M U S I C C F F I I N T E R F A C E T O C S O U N D
This file belongs to Csound.
This software is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
either
This software is distributed in the hope that it will be useful,
but WITHOUT ... | Copyright ( C ) 2016
version 2.1 of the License , or ( at your option ) any later version .
You should have received a copy of the GNU Lesser General Public
Foundation , Inc. , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 USA
with regard to include / csound.h . This file is not intended to be... |
accc49fcc5424ca9f930d7b5638c848f9b89fc019b1a1701b34be1c9374b561d | hawkir/calispel | null-queue.lisp | (in-package #:calispel)
(defclass null-queue (jpl-queues:queue)
()
(:documentation "The null queue. Used for unbuffered CHANNELs.
Think of it as the NULL class, but for queues."))
(defmethod jpl-queues:empty? ((queue null-queue))
t)
(defmethod jpl-queues:full? ((queue null-queue))
t)
(defmethod jpl-queues... | null | https://raw.githubusercontent.com/hawkir/calispel/e9f2f9c1af97f4d7bb4c8ac25fb2a8f3e8fada7a/null-queue.lisp | lisp | We can guarantee that no matching OBJECT is in this QUEUE.
Since NULL-QUEUE has no state, we can keep a single instance.
(EQ +NULL-QUEUE+ (MAKE-INSTANCE 'NULL-QUEUE)) is false. | (in-package #:calispel)
(defclass null-queue (jpl-queues:queue)
()
(:documentation "The null queue. Used for unbuffered CHANNELs.
Think of it as the NULL class, but for queues."))
(defmethod jpl-queues:empty? ((queue null-queue))
t)
(defmethod jpl-queues:full? ((queue null-queue))
t)
(defmethod jpl-queues... |
72db66393d7f7849650567936aaf9460c051b6647681d086307e7c8a84447149 | ninjudd/jiraph | typed.clj | (ns flatland.jiraph.typed
(:use [flatland.jiraph.core :only [layer]]
[flatland.jiraph.layer :only [Basic Optimized Schema
get-node schema update-in-node query-fn]]
[flatland.jiraph.wrapped-layer :only [defwrapped update-wrap-read forward-reads]]
[clojure.c... | null | https://raw.githubusercontent.com/ninjudd/jiraph/e2897cf4770ead40e574261cd294d2c6701703e8/src/flatland/jiraph/typed.clj | clojure | something not under edges
just [id :edges]
the type - lookup function is derived from it at
construction time, and is always used instead because it is much faster. type-lookup is a
function taking a node-id and returning (if the node's type is valid as a from-edge on this | (ns flatland.jiraph.typed
(:use [flatland.jiraph.core :only [layer]]
[flatland.jiraph.layer :only [Basic Optimized Schema
get-node schema update-in-node query-fn]]
[flatland.jiraph.wrapped-layer :only [defwrapped update-wrap-read forward-reads]]
[clojure.c... |
42845542ff03ae9ae2874867be3142be92740a409542086169ebe455069e4736 | janestreet/bonsai | bonsai_web_ui_reorderable_list.mli | open! Core
open! Bonsai_web
(** A vertical list component which moves items into their proper place during
drag and drop. Items use absolute positioning for explicit layout; that is,
the nth item is [n * item_height] pixels from the top of the container.
Items outside the list may be dragged into the list... | null | https://raw.githubusercontent.com/janestreet/bonsai/33e9a58fc55ec12095959dc5ef4fd681021c1083/web_ui/reorderable_list/src/bonsai_web_ui_reorderable_list.mli | ocaml | * A vertical list component which moves items into their proper place during
drag and drop. Items use absolute positioning for explicit layout; that is,
the nth item is [n * item_height] pixels from the top of the container.
Items outside the list may be dragged into the list to extend it.
* The drag-and-d... | open! Core
open! Bonsai_web
val list
: ('source, 'cmp) Bonsai.comparator
-> dnd:('source, int) Bonsai_web_ui_drag_and_drop.t Bonsai.Value.t
-> ?enable_debug_overlay:bool
-> ?extra_item_attrs:Vdom.Attr.t Bonsai.Value.t
-> ?left:Css_gen.Length.t
-> ?right:Css_gen.Length.t
-> ?empty_list_placeholder:(item... |
b5ad93f76970a714c222371cb629ec28a1e0ac427f9e15019a35f1e85a8081e6 | tolysz/ghcjs-stack | Tree.hs | # LANGUAGE DeriveFunctor , , DeriveTraversable #
module Distribution.Client.Dependency.Modular.Tree
( FailReason(..)
, POption(..)
, Tree(..)
, TreeF(..)
, ana
, cata
, choices
, dchoices
, inn
, innM
, para
, trav
, zeroOrOneChoices
) where
import Control.Monad... | null | https://raw.githubusercontent.com/tolysz/ghcjs-stack/83d5be83e87286d984e89635d5926702c55b9f29/special/cabal-next/cabal-install/Distribution/Client/Dependency/Modular/Tree.hs | haskell | | Type of the search tree. Inlining the choice nodes for now.
Bool indicates whether it's trivial
Above, a choice is called trivial if it clearly does not matter. The
special case of triviality we actually consider is if there are no new
dependencies introduced by this node.
A (flag) choice is called weak if we ... | # LANGUAGE DeriveFunctor , , DeriveTraversable #
module Distribution.Client.Dependency.Modular.Tree
( FailReason(..)
, POption(..)
, Tree(..)
, TreeF(..)
, ana
, cata
, choices
, dchoices
, inn
, innM
, para
, trav
, zeroOrOneChoices
) where
import Control.Monad... |
e3d67a40f60f4cc6e67b444f43b88db7e02fbd1b4c7564b083a0f6578a306a67 | dmitryvk/sbcl-win32-threads | physenvanal.lisp | ;;;; This file implements the environment analysis phase for the
;;;; compiler. This phase annotates IR1 with a hierarchy environment
;;;; structures, determining the physical environment that each LAMBDA
;;;; allocates its variables and finding what values are closed over
;;;; by each physical environment.
This sof... | null | https://raw.githubusercontent.com/dmitryvk/sbcl-win32-threads/5abfd64b00a0937ba2df2919f177697d1d91bde4/src/compiler/physenvanal.lisp | lisp | This file implements the environment analysis phase for the
compiler. This phase annotates IR1 with a hierarchy environment
structures, determining the physical environment that each LAMBDA
allocates its variables and finding what values are closed over
by each physical environment.
more information.
public dom... |
This software is part of the SBCL system . See the README file for
This software is derived from the CMU CL system , which was
written at Carnegie Mellon University and released into the
(in-package "SB!C")
1 . Make a PHYSENV structure for each non - LET LAMBDA , assigning
the LAMBDA - PHYSENV for all... |
f0178fb80fd59a9d5cf4c9c9fd19cc710b8cf91648f843af753f5e2618a300f1 | xvw/preface | monoid.mli | (** A [Monoid] is a type [t] which provides a binary associative operation
[combine] and a neutral element ([neutral]). In other words, a [Monoid] is a
{!module:Semigroup} with a neutral element. *)
(** {2 Laws}
To ensure that the derived combiners work properly, a functor should respect
these laws:
... | null | https://raw.githubusercontent.com/xvw/preface/51892a7ce2ddfef69de963265da3617968cdb7ad/lib/preface_specs/monoid.mli | ocaml | * A [Monoid] is a type [t] which provides a binary associative operation
[combine] and a neutral element ([neutral]). In other words, a [Monoid] is a
{!module:Semigroup} with a neutral element.
* {2 Laws}
To ensure that the derived combiners work properly, a functor should respect
these laws:
+ [... |
* { 1 Minimal definition }
module type WITH_NEUTRAL = sig
type t
* the type held by the [ Monoid ] .
val neutral : t
end
module type WITH_NEUTRAL_AND_COMBINE = sig
type t
* the type held by the [ Monoid ] .
include Semigroup.CORE with type t := t
* @inline
include WITH_NEUTRAL with type t := t
* @inlin... |
516421a1568a5ebfd0812a287888fe7efc85f71112575f9c1f68fee2234c2d18 | cognitect-labs/test-runner | samples_test.clj | (ns cognitect.test-runner.samples-test
(:require [clojure.test :as t :refer [deftest is testing]]))
(deftest math-works
(testing "basic addition and subtraction"
(is (= 42 (+ 40 2)))
(is (= 42 (- 44 2)))))
(deftest ^:integration test-i
(is (= 1 1)))
| null | https://raw.githubusercontent.com/cognitect-labs/test-runner/b6b3193fcc42659d7e46ecd1884a228993441182/test/cognitect/test_runner/samples_test.clj | clojure | (ns cognitect.test-runner.samples-test
(:require [clojure.test :as t :refer [deftest is testing]]))
(deftest math-works
(testing "basic addition and subtraction"
(is (= 42 (+ 40 2)))
(is (= 42 (- 44 2)))))
(deftest ^:integration test-i
(is (= 1 1)))
| |
a47f9e4fad8f6dda475af725435934e04cf860b2c0841d74e2185b1f347f0cfa | incoherentsoftware/defect-process | AI.hs | module Enemy.All.Spear.AI
( thinkAI
) where
import Control.Monad.State (execState, modify, unless)
import Attack
import Configs
import Configs.All.Enemy
import Configs.All.Enemy.Spear
import Configs.All.Settings
import Configs.All.Settings.Debug
import Constants
import Enemy as E
import Enemy.All.Spear.AI.Run... | null | https://raw.githubusercontent.com/incoherentsoftware/defect-process/8797aad1d93bff5aadd7226c39a48f45cf76746e/src/Enemy/All/Spear/AI.hs | haskell | module Enemy.All.Spear.AI
( thinkAI
) where
import Control.Monad.State (execState, modify, unless)
import Attack
import Configs
import Configs.All.Enemy
import Configs.All.Enemy.Spear
import Configs.All.Settings
import Configs.All.Settings.Debug
import Constants
import Enemy as E
import Enemy.All.Spear.AI.Run... | |
9d50970bb4d156f79e32c5068b54f1ed7d2c61977478bdd970212b10f356e9dc | fgatherlet/cl-webdriver | base.lisp | (in-package :webdriver)
;;; ------------------------------ condition
(define-condition protocol-error (error)
((http-status :initarg :http-status :initform nil)
(oss-status :initarg :oss-status :initform nil)
(response :initarg :response :initform nil)
(response-source :initarg :response-source :initform n... | null | https://raw.githubusercontent.com/fgatherlet/cl-webdriver/80acda412f8da718b3379c78dc5f59199836ea7d/src/base.lisp | lisp | ------------------------------ condition
------------------------------ wd-obj
from jsown::val-safe
------------------------------
------------------------------ short hand to handle capabilities. | (in-package :webdriver)
(define-condition protocol-error (error)
((http-status :initarg :http-status :initform nil)
(oss-status :initarg :oss-status :initform nil)
(response :initarg :response :initform nil)
(response-source :initarg :response-source :initform nil)
))
(defmethod print-object ((error pr... |
cd0d89336f85c85fa7fa36b639593c757c66eae312e8783d03fb9fd0d35dd29f | AlexKnauth/debug | typed-with-reader.rkt | #lang debug typed/racket
(require typed/debug/report)
(module+ test
(require typed/rackunit))
(define x 2)
(define (f) #R x #R (+ x 4))
(module+ test
(define p (open-output-string))
(parameterize ([current-error-port p])
#R (f))
(check-equal? (get-output-string p) "x = 2\n(+ x 4) = 6\n(f) = 6\n"))
| null | https://raw.githubusercontent.com/AlexKnauth/debug/4f0fb0b018221ed0bb3216d580f33af389954cde/typed/debug/test/typed-with-reader.rkt | racket | #lang debug typed/racket
(require typed/debug/report)
(module+ test
(require typed/rackunit))
(define x 2)
(define (f) #R x #R (+ x 4))
(module+ test
(define p (open-output-string))
(parameterize ([current-error-port p])
#R (f))
(check-equal? (get-output-string p) "x = 2\n(+ x 4) = 6\n(f) = 6\n"))
| |
1868ae3bf23c28957bdba9b9413401741c03fc0fc3a3e615443e564e4a66c1a2 | OCamlPro/ocp-build | hello_cppo.ml |
let () =
#ifdef TOTO
print_endline "TODO is defined"
#else
print_endline "TODO is not defined"
#endif
| null | https://raw.githubusercontent.com/OCamlPro/ocp-build/56aff560bb438c12b2929feaf8379bc6f31b9840/docs/examples/03_cppo/hello_cppo.ml | ocaml |
let () =
#ifdef TOTO
print_endline "TODO is defined"
#else
print_endline "TODO is not defined"
#endif
| |
14f203a8691dee4021501cc072f7c799d5361fda10de7ab33308391ce9859818 | CyberCat-Institute/open-game-engine | ChooseReservePrice.hs | # LANGUAGE DataKinds #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE TupleSections #
# LANGUAGE MultiParamTypeClasses , FlexibleInstances , FlexibleContexts , TemplateHaskell #
# LANGUAGE DeriveGeneric #
# LANGUAGE QuasiQuotes #
module Examples.Auctions.ChooseReservePrice where
import OpenGames
import OpenGames.Pre... | null | https://raw.githubusercontent.com/CyberCat-Institute/open-game-engine/86031c42bf13178554c21cd7ab9e9d18f1ca6963/src/Examples/Auctions/ChooseReservePrice.hs | haskell | # LANGUAGE OverloadedStrings #
--------
A Model
--------
0. Auxiliary function
-------------------
Draws a value and creates a pair of _value_ _name_
---:
---:
B Analysis
--------------
0. Strategies
-------------
---------------------- | # LANGUAGE DataKinds #
# LANGUAGE TupleSections #
# LANGUAGE MultiParamTypeClasses , FlexibleInstances , FlexibleContexts , TemplateHaskell #
# LANGUAGE DeriveGeneric #
# LANGUAGE QuasiQuotes #
module Examples.Auctions.ChooseReservePrice where
import OpenGames
import OpenGames.Preprocessor
import Examples.Auctions.... |
4077aac511dd499646a106ad3c0b35c43d85fa7cbae10643ba041829b7682dd7 | dag/all-about-monads | example8.hs | Author :
Maintainer : < >
Time - stamp : < Fri Aug 15 17:54:59 2003 >
License : GPL
Maintainer: Jeff Newbern <>
Time-stamp: <Fri Aug 15 17:54:59 2003>
License: GPL
-}
DESCRIPTION
Example 8 - Using the ap function
Usage : Compile the code and execute the resulting pr... | null | https://raw.githubusercontent.com/dag/all-about-monads/f5efbe7276a090cb1a3ce7ebb97ac28b1b13572e/examples/example8.hs | haskell | lookup the commands and fold ap into the command list to
compute a result. | Author :
Maintainer : < >
Time - stamp : < Fri Aug 15 17:54:59 2003 >
License : GPL
Maintainer: Jeff Newbern <>
Time-stamp: <Fri Aug 15 17:54:59 2003>
License: GPL
-}
DESCRIPTION
Example 8 - Using the ap function
Usage : Compile the code and execute the resulting pr... |
36abe89fac6e96eb72f0f571b79fed24acf9629582a637959d8f1d7ac80cc625 | metasoarous/datsys | utils.cljc | (ns dat.sys.utils)
(defn deref-or-value
[val-or-atom]
(if (satisfies? #?(:cljs IDeref :clj clojure.lang.IDeref) val-or-atom) @val-or-atom val-or-atom))
(defn deep-merge
"Like merge, but merges maps recursively."
[& maps]
(if (every? #(or (map? %) (nil? %)) maps)
(apply merge-with deep-merge maps)
(l... | null | https://raw.githubusercontent.com/metasoarous/datsys/67f506525d66887737ef058c866adb0c847be925/src/cljc/dat/sys/utils.cljc | clojure | (ns dat.sys.utils)
(defn deref-or-value
[val-or-atom]
(if (satisfies? #?(:cljs IDeref :clj clojure.lang.IDeref) val-or-atom) @val-or-atom val-or-atom))
(defn deep-merge
"Like merge, but merges maps recursively."
[& maps]
(if (every? #(or (map? %) (nil? %)) maps)
(apply merge-with deep-merge maps)
(l... | |
a4011d3c9c0b7afa2466cfe1cc971938dd3c329221e1f89d28b3e47d780152a5 | ermine/sulci | plugin_1april.ml |
* ( c ) 2008 - 2010
* (c) 2008-2010 Anastasia Gornostaeva
*)
open XMPP
open JID
open Hooks
type rate = {
lastrate: float;
lasttime: float
}
let maxrate = ref 400.0
let init_rate () =
{ lastrate = 0.0; lasttime = Unix.gettimeofday ()}
from evgs
S(n)=a*C / T+(1 - a)*S(n-1 )
S(0)=0 ; 0 < a... | null | https://raw.githubusercontent.com/ermine/sulci/3ee4bd609b01e2093a6d37bf74579728d0a93b70/src/plugin_1april.ml | ocaml |
* ( c ) 2008 - 2010
* (c) 2008-2010 Anastasia Gornostaeva
*)
open XMPP
open JID
open Hooks
type rate = {
lastrate: float;
lasttime: float
}
let maxrate = ref 400.0
let init_rate () =
{ lastrate = 0.0; lasttime = Unix.gettimeofday ()}
from evgs
S(n)=a*C / T+(1 - a)*S(n-1 )
S(0)=0 ; 0 < a... | |
216d56890e0421ab8e70cdaf499283e7117fbceacca2b5aa764dc13bdeeb436a | racket/rhombus-prototype | repetition.rkt | #lang racket/base
(require (for-syntax racket/base
syntax/parse/pre
"operator-parse.rkt"
enforest
enforest/property
enforest/syntax-local
enforest/operator
enforest/transfor... | null | https://raw.githubusercontent.com/racket/rhombus-prototype/4e66c1361bdde51c2df9332644800baead49e86f/rhombus/private/repetition.rkt | racket | `element-static-infos` can be an identifier, which means both that static
information can be looked up on demand
Form in a repetition context: | #lang racket/base
(require (for-syntax racket/base
syntax/parse/pre
"operator-parse.rkt"
enforest
enforest/property
enforest/syntax-local
enforest/operator
enforest/transfor... |
142074237f48b381baf24ccfc93a7a7805c15f9e96c4d26ab128d1893a8d6d53 | Psi-Prod/ppx_system | system.ml | type t = Darwin | FreeBSD | NetBSD | OpenBSD | Unix | Win32
let to_string = function
| Darwin -> "Darwin"
| FreeBSD -> "FreeBSD"
| NetBSD -> "NetBSD"
| OpenBSD -> "OpenBSD"
| Unix -> "Unix"
| Win32 -> "Win32"
let get () =
if Sys.win32 then Ok Win32
else
match Uname.sysname () with
| "Darwin" -... | null | https://raw.githubusercontent.com/Psi-Prod/ppx_system/ed75ae15f07ee0002145671821c9fc2288e04ba8/lib/system.ml | ocaml | type t = Darwin | FreeBSD | NetBSD | OpenBSD | Unix | Win32
let to_string = function
| Darwin -> "Darwin"
| FreeBSD -> "FreeBSD"
| NetBSD -> "NetBSD"
| OpenBSD -> "OpenBSD"
| Unix -> "Unix"
| Win32 -> "Win32"
let get () =
if Sys.win32 then Ok Win32
else
match Uname.sysname () with
| "Darwin" -... | |
2cbfa24a50a7a2b60febb3ee8d7ed709b587cfcc7c3410c9325c0e4fc5d42643 | snapframework/snap-server | TestSuite.hs | # LANGUAGE CPP #
# LANGUAGE ScopedTypeVariables #
module Main where
import Control.Concurrent (killThread, takeMVar)
import qualified Control.Exception as E
import Control.Monad (liftM)
impor... | null | https://raw.githubusercontent.com/snapframework/snap-server/f9c6e00630a8a78705aceafa0ac046ae70e1310e/test/TestSuite.hs | haskell | ----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------------------------------------------------------------------------- | # LANGUAGE CPP #
# LANGUAGE ScopedTypeVariables #
module Main where
import Control.Concurrent (killThread, takeMVar)
import qualified Control.Exception as E
import Control.Monad (liftM)
impor... |
8d9e774824e13673017c054a3df1436951a3ba651e72ae7da08c59ee89865d1f | oblivia-simplex/roper | ropush-vars.lisp | (in-package :ropush)
;; some dynamic defs, to prevent unbound variable errors
(defvar $$push nil)
(defvar $$pop)
(defvar $$peek)
(defvar $$depth)
(defvar $$stack-of)
;(defun $pop ())
;(defun $push ())
;(defun $depth ())
;(defun $peek ())
(defvar $stacks)
(defvar $counter)
(defvar $unicorn)
(defvar $halt)
(defvar $type... | null | https://raw.githubusercontent.com/oblivia-simplex/roper/7714ccf677359126ca82446843030fac89c6655a/lisp/roper/ropush-vars.lisp | lisp | some dynamic defs, to prevent unbound variable errors
(defun $pop ())
(defun $push ())
(defun $depth ())
(defun $peek ())
the list provided in ropush-params is meant to be editable.
this list furnishes the defaults.
the :womb stack can be used as both a secondary exec stack, to
facilitate the rearrangement of ins... | (in-package :ropush)
(defvar $$push nil)
(defvar $$pop)
(defvar $$peek)
(defvar $$depth)
(defvar $$stack-of)
(defvar $stacks)
(defvar $counter)
(defvar $unicorn)
(defvar $halt)
(defvar $types)
(deftype bytes () '(vector (unsigned-byte 8)))
(defun debugging (&optional on)
(if (and (not on) (member :debugging *featu... |
888ad6049b7bf9ad3dc234333be75420c41d81f74dbda52455305199a1478aaa | startalkIM/ejabberd | mod_private_riak.erl | %%%-------------------------------------------------------------------
@author < >
( C ) 2016 ,
%%% @doc
%%%
%%% @end
Created : 13 Apr 2016 by < >
%%%-------------------------------------------------------------------
-module(mod_private_riak).
-behaviour(mod_private).
%% API
-export([init/2, set_data/... | null | https://raw.githubusercontent.com/startalkIM/ejabberd/718d86cd2f5681099fad14dab5f2541ddc612c8b/src/mod_private_riak.erl | erlang | -------------------------------------------------------------------
@doc
@end
-------------------------------------------------------------------
API
===================================================================
API
===================================================================
=========================... | @author < >
( C ) 2016 ,
Created : 13 Apr 2016 by < >
-module(mod_private_riak).
-behaviour(mod_private).
-export([init/2, set_data/3, get_data/3, get_all_data/2, remove_user/2,
import/2]).
-include("jlib.hrl").
-include("mod_private.hrl").
init(_Host, _Opts) ->
ok.
set_data(LUser, LServer, Da... |
be1549e482edf4de9beb5902446ca71651923f01f851d47816dbc7b851d3c527 | hyperfiddle/electric | monad_state_joinr.clj | (ns dustin.y2020.monad-state-joinr)
(defmacro run-state [init state-symb bindings & body]
(let [steps
(->> (for [[l expr] (partition 2 bindings)]
[l `(let [state# (deref ~state-symb)
[new-state# res#] (~(first expr) state# ~@(rest expr))
~'_ ... | null | https://raw.githubusercontent.com/hyperfiddle/electric/1c6c3891cbf13123fef8d33e6555d300f0dac134/scratch/dustin/y2020/monad_state_joinr.clj | clojure | (ns dustin.y2020.monad-state-joinr)
(defmacro run-state [init state-symb bindings & body]
(let [steps
(->> (for [[l expr] (partition 2 bindings)]
[l `(let [state# (deref ~state-symb)
[new-state# res#] (~(first expr) state# ~@(rest expr))
~'_ ... | |
40d463a8affd9cca4341b2163b30d2940e0c658e008378ffdcac29fbc1b55824 | ekmett/coda | Trie.hs | {-# language CPP #-}
# language GADTs #
# language RankNTypes #
# language LambdaCase #
-- |
--
-- Well-Quasi-Orders using tries
module Termination.Trie
( Trie(..)
, runTrie
, finite
, finiteOrd
, finiteHash
, history
) where
import Data.Functor
import Data.Functor.Identity
import Data.Functor.Compose
... | null | https://raw.githubusercontent.com/ekmett/coda/bca7e36ab00036f92d94eb86298712ab1dbf9b8d/src/termination/Termination/Trie.hs | haskell | # language CPP #
|
Well-Quasi-Orders using tries
| A well quasi-order: A reflexive, transitive relation such that
encoded as a procedure for maintaining 'xs' in an easily testable form
This is an experiment to see if we can use a trie-based encoding.
How to handle orders?
side-condition: needs 'a' to be finitel... | # language GADTs #
# language RankNTypes #
# language LambdaCase #
module Termination.Trie
( Trie(..)
, runTrie
, finite
, finiteOrd
, finiteHash
, history
) where
import Data.Functor
import Data.Functor.Identity
import Data.Functor.Compose
import Data.Functor.Contravariant
import Data.Functor.Contrava... |
69eb915bb40e11726c5a85648ea607a5c85f25f41f859caf1996bac8499c6b2d | namin/staged-miniKanren | tests-dl-strict.scm | (load "staged-load.scm")
Adapted from the nnf code in ' The Semantic Web Explained ' by
Szeredi , , and . Cambridge University
Press , 2014 .
(define nnf
(lambda (concept)
`(letrec ((number?
(lambda (n)
(match n
[`z #t]
[`(s . ,n-1)... | null | https://raw.githubusercontent.com/namin/staged-miniKanren/019d0e68fd1fe49589a845a695a4d6fd39c9e4a2/tests-dl-strict.scm | scheme | simulate an error
#f ;; really an error
Note the difference in order w.r.t. the unstaged version. | (load "staged-load.scm")
Adapted from the nnf code in ' The Semantic Web Explained ' by
Szeredi , , and . Cambridge University
Press , 2014 .
(define nnf
(lambda (concept)
`(letrec ((number?
(lambda (n)
(match n
[`z #t]
[`(s . ,n-1)... |
25be60a17cb2757f2a12b9bf64f03c3b7ee3a7dc70ab0398a1d7648c43df60a5 | kellino/microML | ParseTree.hs | module Repl.ParseTree (showTree) where
import Data.Tree
import Data.Tree.Pretty
import MicroML.Syntax
-- | pretty print the parse tree of an expression in the repl
exprToTree :: (String, Expr) -> Tree String
exprToTree (nm, ex) =
Node nm $ etoT ex
etoT :: Expr -> [Tree Name]
etoT (FixPoint e1) = [Node "rec" (e... | null | https://raw.githubusercontent.com/kellino/microML/26a4e0ad7542e26f51945eb92db19f63f69b6962/src/Repl/ParseTree.hs | haskell | | pretty print the parse tree of an expression in the repl | module Repl.ParseTree (showTree) where
import Data.Tree
import Data.Tree.Pretty
import MicroML.Syntax
exprToTree :: (String, Expr) -> Tree String
exprToTree (nm, ex) =
Node nm $ etoT ex
etoT :: Expr -> [Tree Name]
etoT (FixPoint e1) = [Node "rec" (etoT e1)]
etoT Nil = [Node "[]" []]
etoT (App e1 e2) = eto... |
c47e8f56d90a117bc06a9faa708236b07aa3c0a5404242f9c53305c79e85ce2b | janestreet/bonsai | bonsai_web_ui_file_from_web_file.ml | open Core
open Async_kernel
open Js_of_ocaml
let create file =
let read =
Ui_effect.of_sync_fun (fun on_progress ->
let file_reader = new%js File.fileReader in
let result = Ivar.create () in
let result =
Bonsai_web.Effect.of_deferred_fun
(fun () ->
let call_on_pro... | null | https://raw.githubusercontent.com/janestreet/bonsai/782fecd000a1f97b143a3f24b76efec96e36a398/web_ui/file/from_web_file/bonsai_web_ui_file_from_web_file.ml | ocaml | open Core
open Async_kernel
open Js_of_ocaml
let create file =
let read =
Ui_effect.of_sync_fun (fun on_progress ->
let file_reader = new%js File.fileReader in
let result = Ivar.create () in
let result =
Bonsai_web.Effect.of_deferred_fun
(fun () ->
let call_on_pro... | |
266c561f98c7f728aa939fa3340862009d4095c1647464488df6e86f918e943a | srid/ema | Ex00_Hello.hs | {-# LANGUAGE DeriveAnyClass #-}
# LANGUAGE UndecidableInstances #
| Most trivial Ema program
module Ema.Example.Ex00_Hello where
import Ema
Let 's newtype the unit route , because we have only one page to generate .
newtype Route = Route ()
deriving newtype
(Show, Eq, Ord, Generic, IsRoute)
instance EmaSi... | null | https://raw.githubusercontent.com/srid/ema/61faae56aa0f3c6ca815f344684cc566f6341662/ema-examples/src/Ema/Example/Ex00_Hello.hs | haskell | # LANGUAGE DeriveAnyClass # | # LANGUAGE UndecidableInstances #
| Most trivial Ema program
module Ema.Example.Ex00_Hello where
import Ema
Let 's newtype the unit route , because we have only one page to generate .
newtype Route = Route ()
deriving newtype
(Show, Eq, Ord, Generic, IsRoute)
instance EmaSite Route where
siteInput _ _ =... |
66ff55bd5b37989eb9edbf920272ab8b3c93beb8dcb8a42da1f1399c438de382 | aowens-21/racket-formatting | file-level.rkt | #lang racket/base
(require rackunit
racket/runtime-path
custom-syntax-format
racket/port
racket/file)
(define-runtime-path file-level-conds.rkt "file-level/01-conds.rkt")
(define-runtime-path file-level-expected.rkt "file-level/01-expected.rkt")
(define-runtime-path file-level-02-... | null | https://raw.githubusercontent.com/aowens-21/racket-formatting/88c60c53edbfe2d88c26c8e45e11387e98bd6213/custom-syntax-format/tests/custom-syntax-format/file-level.rkt | racket | fails
(check-equal? (format-file file-level-02-comments.rkt) | #lang racket/base
(require rackunit
racket/runtime-path
custom-syntax-format
racket/port
racket/file)
(define-runtime-path file-level-conds.rkt "file-level/01-conds.rkt")
(define-runtime-path file-level-expected.rkt "file-level/01-expected.rkt")
(define-runtime-path file-level-02-... |
dc1ac5c0be1d4e814f66ff4da9481f31d3381e9840c978e17bea5453cbaf8a35 | weavery/clarity.ml | lexer.mli | (* This is free and unencumbered software released into the public domain. *)
val read_token : Lexing.lexbuf -> token
| null | https://raw.githubusercontent.com/weavery/clarity.ml/20e48b275eaacd7fa71a7b9b7796977f0aba95cb/src/lexer.mli | ocaml | This is free and unencumbered software released into the public domain. |
val read_token : Lexing.lexbuf -> token
|
1b3d5e4526b738083972fcf0d2d8ac21ec892537d00bc67cd94def6a83746c86 | freckle/stackctl | VerboseOption.hs | module Stackctl.VerboseOption
( Verbosity
, verbositySetLogLevels
, HasVerboseOption(..)
, verboseOption
) where
import Stackctl.Prelude
import Blammo.Logging.LogSettings.LogLevels
import Options.Applicative
newtype Verbosity = Verbosity [()]
deriving newtype (Semigroup, Monoid)
verbositySetLogLevels ::... | null | https://raw.githubusercontent.com/freckle/stackctl/480255ddafd865ba8cfd06ed8afe67c22ff78020/src/Stackctl/VerboseOption.hs | haskell | module Stackctl.VerboseOption
( Verbosity
, verbositySetLogLevels
, HasVerboseOption(..)
, verboseOption
) where
import Stackctl.Prelude
import Blammo.Logging.LogSettings.LogLevels
import Options.Applicative
newtype Verbosity = Verbosity [()]
deriving newtype (Semigroup, Monoid)
verbositySetLogLevels ::... | |
c11a8ad8c9a5d60c4c8f58894787de74d37c1d5c83e6f303a6138e3bbf77acb3 | Clojure2D/clojure2d-examples | interval.clj | (ns rt4.in-one-weekend.ch12a.interval
(:refer-clojure :exclude [empty])
(:require [fastmath.core :as m]))
(set! *warn-on-reflection* true)
(set! *unchecked-math* :warn-on-boxed)
(m/use-primitive-operators)
(defprotocol IntervalProto
(contains [interval x]) ;; a <= x <= b
;; introduced due to the bug in the bo... | null | https://raw.githubusercontent.com/Clojure2D/clojure2d-examples/ead92d6f17744b91070e6308157364ad4eab8a1b/src/rt4/in_one_weekend/ch12a/interval.clj | clojure | a <= x <= b
introduced due to the bug in the book (in the time of writing this code), a < x <= b | (ns rt4.in-one-weekend.ch12a.interval
(:refer-clojure :exclude [empty])
(:require [fastmath.core :as m]))
(set! *warn-on-reflection* true)
(set! *unchecked-math* :warn-on-boxed)
(m/use-primitive-operators)
(defprotocol IntervalProto
(contains- [interval x])
(clamp [interval x]))
(defrecord Interval [^double... |
8bdfed25160fa84bf87e4ac97e5313da67c9809a653d673591d87f4abb121af0 | mathiasbourgoin/SPOC | belote.ml | open Spoc
ktype color = Spades | Hearts | Diamonds | Clubs ;;
ktype colval = {c:color; v : int32} ;;
ktype card =
Ace of color
| King of color
| Queen of color
| Jack of color
| Other of colval;;
let compute = kern cards trump values n ->
let value = fun a trump->
match a with
| Ace c -> 11... | null | https://raw.githubusercontent.com/mathiasbourgoin/SPOC/db8ac84fce7077caba1b2c33e9b2a01c1989620b/SpocLibs/Sarek/extension/tests/belote.ml | ocaml | let cards_c = Array.create n (King Spades)
and values_c = Array.create n 0 in | open Spoc
ktype color = Spades | Hearts | Diamonds | Clubs ;;
ktype colval = {c:color; v : int32} ;;
ktype card =
Ace of color
| King of color
| Queen of color
| Jack of color
| Other of colval;;
let compute = kern cards trump values n ->
let value = fun a trump->
match a with
| Ace c -> 11... |
adcc756c5b08eb9d8de325dbdc9b2070dedb72936cd12a746b1eae75476d06b1 | wdebeaum/step | youth.lisp | ;;;;
w::youth
;;;;
(define-words :pos W::n
:words (
(w::youth
(senses
((LF-PARENT ONT::lifecycle-stage)
(TEMPL bare-pred-TEMPL)
)
)
)
))
(define-words :pos W::n
:words (
(w::youth
(senses
((LF-PARENT ONT::person)
(TEMPL count-pred-TEMPL)
)
)
)
))
| null | https://raw.githubusercontent.com/wdebeaum/step/f38c07d9cd3a58d0e0183159d4445de9a0eafe26/src/LexiconManager/Data/new/youth.lisp | lisp | w::youth
(define-words :pos W::n
:words (
(w::youth
(senses
((LF-PARENT ONT::lifecycle-stage)
(TEMPL bare-pred-TEMPL)
)
)
)
))
(define-words :pos W::n
:words (
(w::youth
(senses
((LF-PARENT ONT::person)
(TEMPL count-pred-TEMPL)
)
)
)
))
| |
f2e4da29d9fc568ec32c021c9506011b47591174d51adb72e5738ed8b73ecba8 | exercism/haskell | Hexadecimal.hs | module Hexadecimal (hexToInt) where
{-# ANN digitToInt "HLint: ignore Use isDigit" #-}
digitToInt :: Char -> Maybe Int
digitToInt c
| c >= '0' && c <= '9' = Just $ n - fromEnum '0'
| c >= 'a' && c <= 'f' = Just $ n - fromEnum 'a' + 10
| c >= 'A' && c <= 'F' = Just $ n - fromEnum 'A' + 10
| otherwise ... | null | https://raw.githubusercontent.com/exercism/haskell/ae17e9fc5ca736a228db6dda5e3f3b057fa6f3d0/exercises/practice/hexadecimal/.meta/examples/success-standard/src/Hexadecimal.hs | haskell | # ANN digitToInt "HLint: ignore Use isDigit" # | module Hexadecimal (hexToInt) where
digitToInt :: Char -> Maybe Int
digitToInt c
| c >= '0' && c <= '9' = Just $ n - fromEnum '0'
| c >= 'a' && c <= 'f' = Just $ n - fromEnum 'a' + 10
| c >= 'A' && c <= 'F' = Just $ n - fromEnum 'A' + 10
| otherwise = Nothing
where n = fromEnum c
hexToInt :: Stri... |
e1d0ac78cc376d18698b901b0eb2e415e62d5b997933ca5a5e3e751d2b3a6078 | stepcut/plugins | Main.hs | import System.Plugins
import API
main = do
let plist = ["../Plugin1.o", "../Plugin2.o", "../Plugin3.o"]
plugins <- mapM (\p -> load p ["../api"] [] "resource") plist
let functions = map (valueOf . fromLoadSuc) plugins
-- apply the function from each plugin in turn
mapM_ (\f -> ... | null | https://raw.githubusercontent.com/stepcut/plugins/52c660b5bc71182627d14c1d333d0234050cac01/testsuite/multi/3plugins/prog/Main.hs | haskell | apply the function from each plugin in turn | import System.Plugins
import API
main = do
let plist = ["../Plugin1.o", "../Plugin2.o", "../Plugin3.o"]
plugins <- mapM (\p -> load p ["../api"] [] "resource") plist
let functions = map (valueOf . fromLoadSuc) plugins
mapM_ (\f -> putStrLn $ f "haskell is for hackers") functions
fromL... |
c8cafa9d6f603c19233445912ae9ab6628104688ba985cf49d3503ae1a36710c | lispgames/glkit | macros.lisp | (in-package :kit.gl.shader)
;; SHADER-DICTIONARIES
(defvar *shader-dictionaries* (make-hash-table))
(defun find-dictionary (name)
(or (gethash name *shader-dictionaries*)
(error "Shader dictionary not found: ~S" name)))
(defun define-dictionary (name programs &key (path *default-pathname-defaults*)
... | null | https://raw.githubusercontent.com/lispgames/glkit/0d8e7c5fed4231f2177afcf0f3ff66f196ed6a46/src/shader-dict/macros.lisp | lisp | SHADER-DICTIONARIES
do not redefine | (in-package :kit.gl.shader)
(defvar *shader-dictionaries* (make-hash-table))
(defun find-dictionary (name)
(or (gethash name *shader-dictionaries*)
(error "Shader dictionary not found: ~S" name)))
(defun define-dictionary (name programs &key (path *default-pathname-defaults*)
shade... |
c1fa1d508a35ffdbda1bbf81ff8f78843dfd07a9f60a406f6a89ff9cad025b5c | deadpendency/deadpendency | DetermineDependenciesGitHubC.hs | # LANGUAGE DataKinds #
module DD.Effect.DetermineDependencies.Carrier.DetermineDependenciesGitHubC
( DetermineDependenciesGitHubIOC (..),
)
where
import Common.Effect.AppEventEmit.AppEventEmit
import Common.Effect.AppEventEmit.Model.AppEventAdditional
import Common.Effect.AppEventEmit.Model.AppEventMessage
import... | null | https://raw.githubusercontent.com/deadpendency/deadpendency/170d6689658f81842168b90aa3d9e235d416c8bd/apps/dependency-determiner/src/DD/Effect/DetermineDependencies/Carrier/DetermineDependenciesGitHubC.hs | haskell | determine exact dep files to load
fetch files
convert files into the actual dependencies
apply final de-dup, ignore and validity checks
DETERMINE
FILE FETCH
FINAL MASSAGE
| Produce a final list of dependencies to be loaded
UTILITY
will not match symlinks from the root to subdirs, but there is apparently no wa... | # LANGUAGE DataKinds #
module DD.Effect.DetermineDependencies.Carrier.DetermineDependenciesGitHubC
( DetermineDependenciesGitHubIOC (..),
)
where
import Common.Effect.AppEventEmit.AppEventEmit
import Common.Effect.AppEventEmit.Model.AppEventAdditional
import Common.Effect.AppEventEmit.Model.AppEventMessage
import... |
348933db9ae4232d9a8206d349d187e0cbd532a3f7de4bca8acb6f905003e012 | IvanIvanov/fp2013 | solution.scm | (define (prepend l value)
(cond ((null? value) l)
((null? l) value)
((list? value) (cons (car value) (prepend l (cdr value))))
(else (cons value l))))
(define (number->list n)
(let loop ((number n)
(digits '()))
(if (< number 10)
(cons number digits)
(loop (... | null | https://raw.githubusercontent.com/IvanIvanov/fp2013/2ac1bb1102cb65e0ecbfa8d2fb3ca69953ae4ecf/lab4/homeworks/04/solution.scm | scheme | (define (prepend l value)
(cond ((null? value) l)
((null? l) value)
((list? value) (cons (car value) (prepend l (cdr value))))
(else (cons value l))))
(define (number->list n)
(let loop ((number n)
(digits '()))
(if (< number 10)
(cons number digits)
(loop (... | |
14dd1bedbd3c1c4fe3c8cfa056ce7f3c96ade0c2a0f2909ce78a705be1bfbede | esl/MongooseIM | mam_lookup_sql.erl | %% Makes a SELECT SQL query
-module(mam_lookup_sql).
-export([lookup_query/5]).
-include("mongoose_logger.hrl").
-include("mongoose_mam.hrl").
-type offset_limit() :: all | {Offset :: non_neg_integer(), Limit :: non_neg_integer()}.
-type sql_part() :: iolist() | binary().
-type env_vars() :: mod_mam_rdbms_arch:env_va... | null | https://raw.githubusercontent.com/esl/MongooseIM/da0d32d2d3d68ac387fd66c7e22c3740743a2beb/src/mam/mam_lookup_sql.erl | erlang | Makes a SELECT SQL query
The ONLY usage of Env is in these functions:
The rest of code should treat Env as opaque (i.e. the code just passes Env around).
This function uses some fields from Env:
- host_type
- table
- index_hint_fn
- columns_sql_fn
- column_to_id_fn
Filters are in format {Op, Column, Value}
... | -module(mam_lookup_sql).
-export([lookup_query/5]).
-include("mongoose_logger.hrl").
-include("mongoose_mam.hrl").
-type offset_limit() :: all | {Offset :: non_neg_integer(), Limit :: non_neg_integer()}.
-type sql_part() :: iolist() | binary().
-type env_vars() :: mod_mam_rdbms_arch:env_vars().
-type query_type() :: ... |
26d00893786339a5f25c9359605d1b6148698dea0bc100f1b191c0fa6189baca | INRIA/zelus | node_base.ml | (**************************************************************************)
(* *)
(* Zelus *)
(* A synchronous language for hybrid systems *)
(* ... | null | https://raw.githubusercontent.com/INRIA/zelus/685428574b0f9100ad5a41bbaa416cd7a2506d5e/lib/std/node_base.ml | ocaml | ************************************************************************
Zelus
A synchronous language for hybrid systems
... | and
Copyright 2012 - 2019 . All rights reserved .
and zero - crossing detection mechanism are embedded into the step function
[ solve f ( input , t ) = next_t , result ]
- f : ' a -C- > ' b is the hybrid node ;
- stop_time : float is the stop time... |
f86dfb5d24d70373eee9150ae1790e808bef055e2b628d4c35a8bf8cd520d5ad | ucsd-progsys/liquid-fixpoint | Simplify.hs | --------------------------------------------------------------------------------
-- | This module contains common functions used in the implementations of
in both and PLE.hs .
--------------------------------------------------------------------------------
{-# LANGUAGE PartialTypeSignatures #-}
# LANGUAGE... | null | https://raw.githubusercontent.com/ucsd-progsys/liquid-fixpoint/a8f3f05cd9a99a56afa64a6699d7ba12417ef5b1/src/Language/Fixpoint/Solver/Simplify.hs | haskell | ------------------------------------------------------------------------------
| This module contains common functions used in the implementations of
------------------------------------------------------------------------------
# LANGUAGE PartialTypeSignatures #
# LANGUAGE ViewPatterns #
# OPTIONS_GH... | in both and PLE.hs .
# LANGUAGE FlexibleInstances #
# LANGUAGE ExistentialQuantification #
module Language.Fixpoint.Solver.Simplify (applyBooleanFolding, applyConstantFolding, applySetFolding, isSetPred) where
import Language.Fixpoint.Types hiding (simplify)
import Language.Fix... |
74258a8e7c7b9208fea788e14f07c1514bcff621a54713daad3c43d694514165 | clojure-interop/aws-api | AWSStepFunctions.clj | (ns com.amazonaws.services.stepfunctions.AWSStepFunctions
"Interface for accessing AWS SFN.
Note: Do not directly implement this interface, new methods are added to it regularly. Extend from
AbstractAWSStepFunctions instead.
AWS Step Functions
AWS Step Functions is a service that lets you coordinate the c... | null | https://raw.githubusercontent.com/clojure-interop/aws-api/59249b43d3bfaff0a79f5f4f8b7bc22518a3bf14/com.amazonaws.services.stepfunctions/src/com/amazonaws/services/stepfunctions/AWSStepFunctions.clj | clojure | (ns com.amazonaws.services.stepfunctions.AWSStepFunctions
"Interface for accessing AWS SFN.
Note: Do not directly implement this interface, new methods are added to it regularly. Extend from
AbstractAWSStepFunctions instead.
AWS Step Functions
AWS Step Functions is a service that lets you coordinate the c... | |
695e8d850a4ee4095bc9dce8cd2cab623ebeeae34d0a51e48fcbae5af78a2e71 | mirleft/ocaml-tls | x509_lwt.ml | open Lwt
let failure msg = fail @@ Failure msg
let catch_invalid_arg th h =
Lwt.catch (fun () -> th)
(function
| Invalid_argument msg -> h msg
| exn -> fail exn)
let (</>) a b = a ^ "/" ^ b
let o f g x = f (g x)
let read_file path =
let open Lwt_io in
open_file ~mode:Input pa... | null | https://raw.githubusercontent.com/mirleft/ocaml-tls/3b7736f61c684bb11170e444126fea7df1ec7d69/lwt/x509_lwt.ml | ocaml | open Lwt
let failure msg = fail @@ Failure msg
let catch_invalid_arg th h =
Lwt.catch (fun () -> th)
(function
| Invalid_argument msg -> h msg
| exn -> fail exn)
let (</>) a b = a ^ "/" ^ b
let o f g x = f (g x)
let read_file path =
let open Lwt_io in
open_file ~mode:Input pa... | |
c29cbc8a24daea70d457d955a85c181485c73dd1de3cc25e7583329bf5a31a68 | alexandergunnarson/quantum | auth.cljc | (ns quantum.test.apis.amazon.cloud-drive.auth
(:require [quantum.apis.amazon.cloud-drive.auth :as ns]))
(defn test:retrieve-authorization-code [user])
(defn test:initial-auth-tokens-from-code [user code])
(defn test:refresh-token!
[user])
| null | https://raw.githubusercontent.com/alexandergunnarson/quantum/0c655af439734709566110949f9f2f482e468509/test/quantum/test/apis/amazon/cloud_drive/auth.cljc | clojure | (ns quantum.test.apis.amazon.cloud-drive.auth
(:require [quantum.apis.amazon.cloud-drive.auth :as ns]))
(defn test:retrieve-authorization-code [user])
(defn test:initial-auth-tokens-from-code [user code])
(defn test:refresh-token!
[user])
| |
d14c37128330dd9296a79eb5c4bcbe299eb51c619f676204db09927eb4d69976 | yuce/teacup_nats | nats.erl | Copyright 2016 < >
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... | null | https://raw.githubusercontent.com/yuce/teacup_nats/5f25180f0b664085ccf5c7f4657726c688f8d5c4/src/nats.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 or implied.
See the License for the specific language governing permiss... | Copyright 2016 < >
Licensed under the Apache License , Version 2.0 ( the " License " ) ;
distributed under the License is distributed on an " AS IS " BASIS ,
-module(nats).
-export([new/0,
new/1]).
-export([connect/2,
connect/3,
pub/2,
pub/3,
sub/2,
su... |
67767a779bb3089a541af722bd4632bd36d2bd5a859405b004d9386f58892170 | bendyworks/api-server | UserSpec.hs | # LANGUAGE QuasiQuotes #
module Api.Types.UserSpec (main, spec) where
import Data.Aeson (Result (..), fromJSON, toJSON)
import Data.Aeson.QQ (aesonQQ)
import Api.Types.Fields
import Api.Types.User
import Test.Hspec
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "Login" $ do
let login = Logi... | null | https://raw.githubusercontent.com/bendyworks/api-server/9dd6d7c2599bd1c5a7e898a417a7aeb319415dd2/test/Api/Types/UserSpec.hs | haskell | # LANGUAGE QuasiQuotes #
module Api.Types.UserSpec (main, spec) where
import Data.Aeson (Result (..), fromJSON, toJSON)
import Data.Aeson.QQ (aesonQQ)
import Api.Types.Fields
import Api.Types.User
import Test.Hspec
main :: IO ()
main = hspec spec
spec :: Spec
spec = do
describe "Login" $ do
let login = Logi... | |
eed2cec0391774ff3d8c1b2c5c4291ff33396b43aeda818cc8e7374d204959c5 | fpco/unliftio | Concurrent.hs | {-# LANGUAGE RankNTypes #-}
-- | Unlifted "Control.Concurrent".
--
-- This module is not reexported by "UnliftIO",
use it only if " UnliftIO.Async " is not enough .
--
-- @since 0.1.1.0
module UnliftIO.Concurrent
(
-- * Concurrent Haskell
ThreadId,
-- * Basic concurrency operations
myThreadId, fork... | null | https://raw.githubusercontent.com/fpco/unliftio/d7ac43b9ae69efea0ca911aa556852e9f95af128/unliftio/src/UnliftIO/Concurrent.hs | haskell | # LANGUAGE RankNTypes #
| Unlifted "Control.Concurrent".
This module is not reexported by "UnliftIO",
@since 0.1.1.0
* Concurrent Haskell
* Basic concurrency operations
** Threads with affinity
* Scheduling
** Waiting
* Communication abstractions
* Bound Threads
* Weak references to ThreadIds
| Lifted ver... | use it only if " UnliftIO.Async " is not enough .
module UnliftIO.Concurrent
(
ThreadId,
myThreadId, forkIO, forkWithUnmask, forkIOWithUnmask, forkFinally, killThread, throwTo,
forkOn, forkOnWithUnmask, getNumCapabilities, setNumCapabilities,
threadCapability,
yield,
threadDelay, thread... |
563e1a225dcd27f33f74d1854964f4bcf28661fdd6fdb59ff5e24c0b3db42c0a | hellonico/origami-fun | writing.clj | (ns opencv4.video.writing
(:require [opencv4.core :refer :all])
(:require [opencv4.utils :as u])
(:import
[org.opencv.videoio Videoio VideoCapture VideoWriter]
[org.opencv.video Video]))
(def capture (VideoCapture.))
(def outputVideo (VideoWriter.))
( VideoWriter / fourcc \M \P \E \G )
( VideoWrite... | null | https://raw.githubusercontent.com/hellonico/origami-fun/80117788530d942eaa9a80e2995b37409fa24889/test/opencv4/video/writing.clj | clojure | (cvt-color! buffer COLOR_RGB2GRAY)
(rotate! buffer ROTATE_90_CLOCKWISE)
(put-text buffer "Funny text inside the box"
(flip! buffer -1)
(.release outputVideo) | (ns opencv4.video.writing
(:require [opencv4.core :refer :all])
(:require [opencv4.utils :as u])
(:import
[org.opencv.videoio Videoio VideoCapture VideoWriter]
[org.opencv.video Video]))
(def capture (VideoCapture.))
(def outputVideo (VideoWriter.))
( VideoWriter / fourcc \M \P \E \G )
( VideoWrite... |
f4858b96afa5a9d14f279e78d575da9a6c46b0eccf66424f45d6ec9f90555e56 | Haskell-OpenAPI-Code-Generator/Stripe-Haskell-Library | SourceTypeP24.hs | {-# LANGUAGE MultiWayIf #-}
CHANGE WITH CAUTION : This is a generated code file generated by -OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator .
{-# LANGUAGE OverloadedStrings #-}
| Contains the types generated from the schema SourceTypeP24
module StripeAPI.Types.SourceTypeP24 where
import qualified C... | null | https://raw.githubusercontent.com/Haskell-OpenAPI-Code-Generator/Stripe-Haskell-Library/ba4401f083ff054f8da68c741f762407919de42f/src/StripeAPI/Types/SourceTypeP24.hs | haskell | # LANGUAGE MultiWayIf #
# LANGUAGE OverloadedStrings #
| reference
| Create a new 'SourceTypeP24' with all required fields. | CHANGE WITH CAUTION : This is a generated code file generated by -OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator .
| Contains the types generated from the schema SourceTypeP24
module StripeAPI.Types.SourceTypeP24 where
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified ... |
a17f75d3efbe0a347caa5aab74159158d17c82ae89fc92794d26b00157f877a8 | nyu-acsys/drift | a-mapi.ml |
let make_array (n:int) (i:int) = assert (0 <= i && i < n); 0
let update (i:int) (n:int) a (x:int) =
a i;
let ap j = assert (0 <= i && i < n); if i = j then x else a j in ap
let rec mapi_helper (hf: int -> int) hi hn (ha: int -> int) (hb: int -> int) : int -> int =
if (hi < hn) then
let hb2 = update hi hn hb ... | null | https://raw.githubusercontent.com/nyu-acsys/drift/51a3160d74b761626180da4f7dd0bb950cfe40c0/tests/benchmarks/r_type/array/a-mapi.ml | ocaml |
let make_array (n:int) (i:int) = assert (0 <= i && i < n); 0
let update (i:int) (n:int) a (x:int) =
a i;
let ap j = assert (0 <= i && i < n); if i = j then x else a j in ap
let rec mapi_helper (hf: int -> int) hi hn (ha: int -> int) (hb: int -> int) : int -> int =
if (hi < hn) then
let hb2 = update hi hn hb ... | |
df2e14e75d4e65344e2b1280a447421fc6f1d5da47a91738d96ad76f9b906684 | input-output-hk/cardano-wallet | TxIn.hs | # LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
-- |
Copyright : © 2018 - 2022 IOHK
-- License: Apache-2.0
--
This module defines the ' ' type .
--
module Cardano.Wallet.Primitive.Types.Tx.TxIn
( TxIn (..)
) where
import Prelude
import Cardano.Wallet.Primitive.Types.Hash
( Hash (..) )
import Contr... | null | https://raw.githubusercontent.com/input-output-hk/cardano-wallet/157a6d5f977f4600373596b7cfa9700138e8e140/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn.hs | haskell | |
License: Apache-2.0
| # LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
Copyright : © 2018 - 2022 IOHK
This module defines the ' ' type .
module Cardano.Wallet.Primitive.Types.Tx.TxIn
( TxIn (..)
) where
import Prelude
import Cardano.Wallet.Primitive.Types.Hash
( Hash (..) )
import Control.DeepSeq
( NFData (..) )
imp... |
c6507edc30a61eb6e77a06d350991ba5a815403d86aad1405782f3728c2e830c | haskell/haskell-language-server | AutoForallClassMethod.hs | {-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE FlexibleContexts #-}
# LANGUAGE MultiParamTypeClasses #
import Data.Functor.Contravariant
class Semigroupal cat t1 t2 to f where
combine :: cat (to (f x y) (f x' y')) (f (t1 x x') (t2 y y'))
comux :: forall p a b c d. Semigroupal Op (,) (,) (,) p => p (a, c)... | null | https://raw.githubusercontent.com/haskell/haskell-language-server/f3ad27ba1634871b2240b8cd7de9f31b91a2e502/plugins/hls-tactics-plugin/new/test/golden/AutoForallClassMethod.hs | haskell | # LANGUAGE ExplicitForAll #
# LANGUAGE FlexibleContexts # | # LANGUAGE MultiParamTypeClasses #
import Data.Functor.Contravariant
class Semigroupal cat t1 t2 to f where
combine :: cat (to (f x y) (f x' y')) (f (t1 x x') (t2 y y'))
comux :: forall p a b c d. Semigroupal Op (,) (,) (,) p => p (a, c) (b, d) -> (p a b, p c d)
comux = _
|
4d922433009409235fb0048ad2fd56f8c601c8d6203122623a38c4394ed4906e | jordanthayer/ocaml-search | actionListener.ml | (** Action Listener for the visualization tool *)
type events =
| StepForward
| StepBack
| CycleSelected
| CycleContext
| Kill
| StoreImage
| NotRecognized
let keyToEvent k =
(** converts the keystroke [k] into the appropriate event.*)
match k with
| 'k' -> Kill
| 'e' -> StepForward
... | null | https://raw.githubusercontent.com/jordanthayer/ocaml-search/57cfc85417aa97ee5d8fbcdb84c333aae148175f/search_vis/actionListener.ml | ocaml | * Action Listener for the visualization tool
* converts the keystroke [k] into the appropriate event.
let get_event () =
(** Returns the current keystroke as an event |
type events =
| StepForward
| StepBack
| CycleSelected
| CycleContext
| Kill
| StoreImage
| NotRecognized
let keyToEvent k =
match k with
| 'k' -> Kill
| 'e' -> StepForward
| 'a' -> StepBack
| 'o' -> CycleContext
| _ -> (Verb.pe Verb.always "%s" (Wrutils.str "|%c| not ... |
451b9374a71c9fd9b2497d9f7b8f79c31d1069141ad7b715fc45c44df6ab3025 | andrewmcloud/consimilo | minhash.clj | (ns consimilo.minhash
(:require [consimilo.random-seed :as rseed]
[consimilo.sha1 :as sha]
[consimilo.config :as config]
[consimilo.minhash-util :as util]
[clojure.core :exclude [rand-int]]
[clojure.tools.logging :as log]))
;; prime number larger than sha1 ... | null | https://raw.githubusercontent.com/andrewmcloud/consimilo/db96c1695248c3486e1d23de5589b39f0e0bd49f/src/consimilo/minhash.clj | clojure | prime number larger than sha1 hash
build seeded vector permutations once. They are the same for every minhash
which allows incremental minhashing a single vector at a time. | (ns consimilo.minhash
(:require [consimilo.random-seed :as rseed]
[consimilo.sha1 :as sha]
[consimilo.config :as config]
[consimilo.minhash-util :as util]
[clojure.core :exclude [rand-int]]
[clojure.tools.logging :as log]))
(def large-prime 3064991081731777... |
a30d440cbeac2920f1a623cf12ac0b50a4c82711d4c3e36862f6d570677b22c1 | favonia/ocaml-objdump | ExamplesWithPointers.ml | let test x = Format.printf "%a@." Objdump.pp x
let () = test (fun () -> 1)
let () = test (("fst", "snd"), 2, 3.0, (), fun () -> ())
let f x = (42, fun () -> x)
let () = test (f 1000)
let rec f x = g x
and g x = f x
let () = test f
let () = test g
type _ Effect.t += F : unit Effect.t
let () = Effect.Deep.try_with Ef... | null | https://raw.githubusercontent.com/favonia/ocaml-objdump/11ba435afabb5eb0866a79225dad548b06a964cb/test/ExamplesWithPointers.ml | ocaml | let test x = Format.printf "%a@." Objdump.pp x
let () = test (fun () -> 1)
let () = test (("fst", "snd"), 2, 3.0, (), fun () -> ())
let f x = (42, fun () -> x)
let () = test (f 1000)
let rec f x = g x
and g x = f x
let () = test f
let () = test g
type _ Effect.t += F : unit Effect.t
let () = Effect.Deep.try_with Ef... | |
3ebbcdca387cb8e46f38220692dfddddca0e02fda5ac5bc644ad8474a6003a70 | tommaisey/aeon | pow.help.scm | ;; (pow a b)
;; Exponentiation, written ** in sclang. When the signal is negative
;; this function extends the usual definition of exponentiation and
;; returns neg(neg(a) ** b). This allows exponentiation of negative
signal values by noninteger exponents .
(audition
(out 0 (let ((a (mul (f-sin-osc ar 100 0) 0.1)... | null | https://raw.githubusercontent.com/tommaisey/aeon/80744a7235425c47a061ec8324d923c53ebedf15/libs/third-party/sc3/rsc3/help/ugen/binary-ops/pow.help.scm | scheme | (pow a b)
Exponentiation, written ** in sclang. When the signal is negative
this function extends the usual definition of exponentiation and
returns neg(neg(a) ** b). This allows exponentiation of negative
-users/2006-December/029998.html |
signal values by noninteger exponents .
(audition
(out 0 (let ((a (mul (f-sin-osc ar 100 0) 0.1)))
(mce2 a (pow a 10)))))
(let* ((n0 (mul-add (lf-noise2 kr 8) 200 300))
(n1 (mul-add (lf-noise2 kr 3) 10 20))
(s (blip ar n0 n1))
(x (mouse-x kr 1000 (mul sample-rate 0.5) 1 0.1))
(y ... |
e37a60d9686f0a24ddef9fc938d2861ec83a7bef61ba631a4f1d50797d85a014 | brendanhay/amazonka | WAFV2.hs | # OPTIONS_GHC -fno - warn - orphans #
# OPTIONS_GHC -fno - warn - unused - imports #
Derived from AWS service descriptions , licensed under Apache 2.0 .
-- |
-- Module : Test.Amazonka.Gen.WAFV2
Copyright : ( c ) 2013 - 2023
License : Mozilla Public License , v. 2.0 .
Maintainer : < brendan.... | null | https://raw.githubusercontent.com/brendanhay/amazonka/09f52b75d2cfdff221b439280d3279d22690d6a6/lib/services/amazonka-wafv2/test/Test/Amazonka/Gen/WAFV2.hs | haskell | |
Module : Test.Amazonka.Gen.WAFV2
Stability : auto-generated
Auto-generated: the actual test selection needs to be manually placed into
the top-level so that real test data can be incrementally added.
This commented snippet is what the entire set should look like:
fixtures :: TestTree
fixtures =
[... | # OPTIONS_GHC -fno - warn - orphans #
# OPTIONS_GHC -fno - warn - unused - imports #
Derived from AWS service descriptions , licensed under Apache 2.0 .
Copyright : ( c ) 2013 - 2023
License : Mozilla Public License , v. 2.0 .
Maintainer : < brendan.g.hay+ >
Portability : non - portable ( GHC ... |
624b731a73f17167739fd3ae90f1500beb6d173352f7042d5be3ed7d3cad9845 | letmaik/monadiccp | PriorityQueue.hs | Copyright ( c ) 2008 the authors listed at the following URL , and/or
the authors of referenced articles or incorporated external code :
(Haskell)?action=history&offset=20080608152146
Permission is hereby granted , free of charge , to any person obtaining
a copy of this software and associated documentation ... | null | https://raw.githubusercontent.com/letmaik/monadiccp/fe4498e46a7b9d9e387fd5e4ed5d0749a89d0188/src/Control/CP/PriorityQueue.hs | haskell | Declare the data type constructors.
Declare the exported interface functions.
Return an empty priority queue.
Return the highest-priority key.
Return the highest-priority key plus its associated value.
Insert a key/value pair into a queue.
Delete the highest-priority key/value pair and insert a new key/value pai... | Copyright ( c ) 2008 the authors listed at the following URL , and/or
the authors of referenced articles or incorporated external code :
(Haskell)?action=history&offset=20080608152146
Permission is hereby granted , free of charge , to any person obtaining
a copy of this software and associated documentation ... |
aea8c9a94c85ababe8a5c780d03b02a6ae945860d298d5889b0c94231107a0e3 | weavejester/ittyon | test_runner.cljs | (ns ittyon.test-runner
(:require [doo.runner :refer-macros [doo-tests]]
ittyon.client-server-test
ittyon.core-test))
(doo-tests 'ittyon.client-server-test
'ittyon.core-test)
| null | https://raw.githubusercontent.com/weavejester/ittyon/6776dac6f5f63060130226a2602cc6a5640575da/test/ittyon/test_runner.cljs | clojure | (ns ittyon.test-runner
(:require [doo.runner :refer-macros [doo-tests]]
ittyon.client-server-test
ittyon.core-test))
(doo-tests 'ittyon.client-server-test
'ittyon.core-test)
| |
b602b37113cf8b0f2e5e768ec2fa6fedf7b1d982ee9497b8617a1c4b5c133306 | mauny/the-functional-approach-to-programming | tree.ml | (* *)
(* Projet Formel *)
(* *)
CAML - light :
(* ... | null | https://raw.githubusercontent.com/mauny/the-functional-approach-to-programming/1ec8bed5d33d3a67bbd67d09afb3f5c3c8978838/cl-75/MLGRAPH.DIR/tree.ml | ocaml |
Projet Formel
********************************... | CAML - light :
45 rue d'Ulm
75005 PARIS
France
$ I d : tree.mlp , v 1.1 1997/08/14 11:34:25
Guy Cousineau... |
a41fff5b46557089ea74714c014e1946c2586afb66bcc7d8dd6849e0424297dd | rescript-lang/rescript-compiler | flow_ast_mapper.ml |
* Copyright ( c ) Meta Platforms , Inc. and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in t... | null | https://raw.githubusercontent.com/rescript-lang/rescript-compiler/0f3c02b13cb8a9c5e2586541622f4a0f5f561216/jscomp/js_parser/flow_ast_mapper.ml | ocaml | * previously, we conflated [function_expression] and [class_method]. callers should be
updated to override those individually.
Try to figure out if shorthand should still be true--if
key and value change differently, it should become false
Try to figure out if shorthand should still be true--if... |
* Copyright ( c ) Meta Platforms , Inc. and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in t... |
f5a11a65c27e1631e089e9c3d94ac3cce3ae16b44cbe609890b3674ac8a2341a | DerekCuevas/interview-cake-clj | core_test.clj | (ns word-cloud.core-test
(:require [clojure.test :refer :all]
[word-cloud.core :refer :all]))
(def sentence-a "After beating the eggs, Dana read the next step:")
(def sentence-b "Add milk and eggs, then add flour and sugar.")
(def sentence-c "Hi how are you?")
(def sentence-d "What when where why when wh... | null | https://raw.githubusercontent.com/DerekCuevas/interview-cake-clj/f17d3239bb30bcc17ced473f055a9859f9d1fb8d/word-cloud/test/word_cloud/core_test.clj | clojure | (ns word-cloud.core-test
(:require [clojure.test :refer :all]
[word-cloud.core :refer :all]))
(def sentence-a "After beating the eggs, Dana read the next step:")
(def sentence-b "Add milk and eggs, then add flour and sugar.")
(def sentence-c "Hi how are you?")
(def sentence-d "What when where why when wh... | |
e5c35e2448bfc775df44692c20478a5ee7077b7007c238fc18acfdd98d7467b4 | johnyob/dromedary | test_pr6690.ml | open! Import
open Util
let%expect_test "" =
let str =
{|
type 'a visit_action;;
type insert;;
type 'a local_visit_action;;
type ('a, 'result, 'visit_action) context =
| Local of 'insert. unit constraint 'result = 'a * 'insert and 'visit_action = 'a local_visit_action
... | null | https://raw.githubusercontent.com/johnyob/dromedary/a9359321492ff5c38c143385513e673d8d1f05a4/test/typing/gadts/test_pr6690.ml | ocaml | open! Import
open Util
let%expect_test "" =
let str =
{|
type 'a visit_action;;
type insert;;
type 'a local_visit_action;;
type ('a, 'result, 'visit_action) context =
| Local of 'insert. unit constraint 'result = 'a * 'insert and 'visit_action = 'a local_visit_action
... | |
58329a487fb412189a4058a9abad12928f71d27af5ab70f4c72418fe48668089 | simmone/racket-simple-xlsx | lib.rkt | #lang racket
(provide (contract-out
[squeeze-range-hash (-> (hash/c natural? number?) (listof (list/c natural? natural? number?)))]
[rgb? (-> string? boolean?)]
))
(define (rgb? color_string)
(if (or
(regexp-match #px"^([0-9]|[a-zA-Z]){6}$" color_string)
(regexp-match #px... | null | https://raw.githubusercontent.com/simmone/racket-simple-xlsx/e0ac3190b6700b0ee1dd80ed91a8f4318533d012/simple-xlsx/style/lib.rkt | racket | #lang racket
(provide (contract-out
[squeeze-range-hash (-> (hash/c natural? number?) (listof (list/c natural? natural? number?)))]
[rgb? (-> string? boolean?)]
))
(define (rgb? color_string)
(if (or
(regexp-match #px"^([0-9]|[a-zA-Z]){6}$" color_string)
(regexp-match #px... | |
b3137670ccfee1b396394f70a5103476f46e6f5b30a69432dfb103de5c2c13ee | mbutterick/quad | test-hello.rkt | #lang quadwriter/markdown
Hello world | null | https://raw.githubusercontent.com/mbutterick/quad/395447f35c2fb9fc7b6199ed185850906d80811d/qtest/test-hello.rkt | racket | #lang quadwriter/markdown
Hello world | |
c1e3e57c5a05758d87bbbb69a6e5d16b667e7bb382f09dff454dc21deead7370 | tommay/pokemon-go | Cost.hs | module Cost (
Cost,
new,
dust,
candy,
xlCandy,
needsXlCandy,
) where
import qualified Data.Ord as Ord
data Cost = Cost {
dust :: Int,
candy :: Int,
xlCandy :: Int
} deriving (Show)
instance Semigroup Cost where
Cost dust candy xlCandy <> Cost dust' candy' xlCandy' =
Cost (dust + dust') (candy... | null | https://raw.githubusercontent.com/tommay/pokemon-go/d2e35858b0a3cd25ddd14af674c7216560475914/src/Cost.hs | haskell | module Cost (
Cost,
new,
dust,
candy,
xlCandy,
needsXlCandy,
) where
import qualified Data.Ord as Ord
data Cost = Cost {
dust :: Int,
candy :: Int,
xlCandy :: Int
} deriving (Show)
instance Semigroup Cost where
Cost dust candy xlCandy <> Cost dust' candy' xlCandy' =
Cost (dust + dust') (candy... | |
6c937ee218b8555a8627cdf4143c9067c3b42aef068a303cfd533a000ceec26d | wies/grasshopper | reduction.ml | * { 5 Reduction from GRASS to SMT }
open Util
open Grass
open GrassUtil
open Axioms
open SimplifyGrass
(** Eliminate all implicit and explicit existential quantifiers using skolemization.
** Assumes that [f] is typed and in negation normal form. *)
let elim_exists =
let e = fresh_ident "?e" in
let rec elim_neq... | null | https://raw.githubusercontent.com/wies/grasshopper/108473b0a678f0d93fffec6da2ad6bcdce5bddb9/src/prover/reduction.ml | ocaml | * Eliminate all implicit and explicit existential quantifiers using skolemization.
** Assumes that [f] is typed and in negation normal form.
* Hoist all universally quantified subformulas to top level.
** Assumes that formulas [fs] are in negation normal form.
* Add axioms for frame predicates.
* Add axioms for fr... | * { 5 Reduction from GRASS to SMT }
open Util
open Grass
open GrassUtil
open Axioms
open SimplifyGrass
let elim_exists =
let e = fresh_ident "?e" in
let rec elim_neq seen_adts bvs = function
| BoolOp (Not, [Atom (App (Eq, [t1; t2], _), a)]) as f when bvs = [] ->
(match sort_of t1 with
| Set srt ->
le... |
114b77c09be9c6f8c6c2a6ca9a14bee5849f1d0b1656b860af05c3ed15489a40 | coord-e/mlml | mlmlc.ml | let () =
match Sys.argv with
| [|_; file|] -> Mlml.Compile.f file |> print_endline
| _ -> failwith "Invalid number of arguments"
;;
| null | https://raw.githubusercontent.com/coord-e/mlml/ec34b1fe8766901fab6842b790267f32b77a2861/bin/mlmlc.ml | ocaml | let () =
match Sys.argv with
| [|_; file|] -> Mlml.Compile.f file |> print_endline
| _ -> failwith "Invalid number of arguments"
;;
| |
d67f23dad114afc4f63fa20d0d4651b81bb541ee61601f15e1ab63780517bd16 | saleyn/util | user_default.erl | %%%vim:ts=2:sw=2:et
%%%------------------------------------------------------------------------
File :
%%%------------------------------------------------------------------------
%%% @doc This is an extension of the shell commands
%%% to do all the work! Either place this file in the
path accessi... | null | https://raw.githubusercontent.com/saleyn/util/17d567e8224c910bd7f987ed8432ae26efd4b36f/src/user_default.erl | erlang | vim:ts=2:sw=2:et
------------------------------------------------------------------------
------------------------------------------------------------------------
@doc This is an extension of the shell commands
to do all the work! Either place this file in the
add this line to the ~/.erlang file:
... | File :
path accessible to Erlang ( via ERL_LIBS ) or
` ` code : load_abs(os : getenv("HOME " ) + + " /.erlang / user_default " ) . ''
@author < >
` ` The contents of this file are subject to the Erlang Public License ,
Version 1.1 , ( the " License " ) ; you may not use this file e... |
220b04c7466f35d1462910f9fe41c3ca13ddd6f1215180022c5f013285566b3f | WorksHub/client | subs.cljs | (ns wh.jobs.jobsboard.subs
(:require [clojure.string :as str]
[goog.i18n.NumberFormat :as nf]
[re-frame.core :refer [reg-sub]]
[wh.common.data :refer [currency-symbols]]
[wh.common.job :as job]
[wh.common.subs]
[wh.common.user :as user-common]
... | null | https://raw.githubusercontent.com/WorksHub/client/77e4212a69dad049a9e784143915058acd918982/client/src/wh/jobs/jobsboard/subs.cljs | clojure | used e.g. on preset search pages
Non-existing tags is a list of tags that appeared in URL
but are not available in application DB. We want to display
this tags so user may remove these from filters and clear URL
This can return nil when salary ranges are not
yet fetched. In this case, the slider is not
rendered ... | (ns wh.jobs.jobsboard.subs
(:require [clojure.string :as str]
[goog.i18n.NumberFormat :as nf]
[re-frame.core :refer [reg-sub]]
[wh.common.data :refer [currency-symbols]]
[wh.common.job :as job]
[wh.common.subs]
[wh.common.user :as user-common]
... |
eac54b78226e66ff5c2911b0d4c6be57ff261e2ea66b8685392571eb488a7c4b | haskell/directory | Directory.hs | -----------------------------------------------------------------------------
-- |
-- Module : System.Directory
Copyright : ( c ) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer :
-- Stability : stable
-- Portability : portable
--
-- ... | null | https://raw.githubusercontent.com/haskell/directory/c1895b93a49a9723c949eefef71b0855b4ee5d51/System/Directory.hs | haskell | ---------------------------------------------------------------------------
|
Module : System.Directory
License : BSD-style (see the file libraries/base/LICENSE)
Maintainer :
Stability : stable
Portability : portable
System-independent interface to directory manipulation (FilePath API).
----... | Copyright : ( c ) The University of Glasgow 2001
module System.Directory
(
createDirectory
, createDirectoryIfMissing
, removeDirectory
, removeDirectoryRecursive
, removePathForcibly
, renameDirectory
, listDirectory
, getDirectoryContents
, getCurrentDirectory
, s... |
0ca9134edb6d816bfb5015b5a7e5ea2197da2aafd73f2c64471357e6e3631f9a | yogthos/krueger | core.clj | (ns krueger.test.db.core
(:require [krueger.db.core :refer [*db*] :as db]
[luminus-migrations.core :as migrations]
[clojure.test :refer :all]
[clojure.java.jdbc :as jdbc]
[krueger.config :refer [env]]
[mount.core :as mount]))
(use-fixtures
:once
(fn [f]... | null | https://raw.githubusercontent.com/yogthos/krueger/782e1f8ab358867102b907c5a80e56ee6bc6ff82/test/clj/krueger/test/db/core.clj | clojure | (ns krueger.test.db.core
(:require [krueger.db.core :refer [*db*] :as db]
[luminus-migrations.core :as migrations]
[clojure.test :refer :all]
[clojure.java.jdbc :as jdbc]
[krueger.config :refer [env]]
[mount.core :as mount]))
(use-fixtures
:once
(fn [f]... | |
4d7d3f2592a6df8e104755be9aa3b61fedd413bd48665eb19f527096e6d32562 | haskell-numerics/hmatrix | VectorShow.hs | # LANGUAGE DataKinds #
module Main
( main
) where
import Numeric.LinearAlgebra.Static
import qualified Numeric.LinearAlgebra as LA
import qualified Numeric.GSL.Minimization as Min
u :: R 4
u = vec4 10 20 30 40
v :: R 5
v = vec2 5 0 & 0 & 3 & 7
b :: L 4 3
b = matrix
[ 2, 0,-1
, 1, 1, 7
, 5, 3, 1... | null | https://raw.githubusercontent.com/haskell-numerics/hmatrix/2694f776c7b5034d239acb5d984c489417739225/examples/VectorShow.hs | haskell | # LANGUAGE DataKinds #
module Main
( main
) where
import Numeric.LinearAlgebra.Static
import qualified Numeric.LinearAlgebra as LA
import qualified Numeric.GSL.Minimization as Min
u :: R 4
u = vec4 10 20 30 40
v :: R 5
v = vec2 5 0 & 0 & 3 & 7
b :: L 4 3
b = matrix
[ 2, 0,-1
, 1, 1, 7
, 5, 3, 1... | |
e3b7bb9ba567b2e26718439a84f276793670eb64118d20405c8c1b773e1b959f | well-typed-lightbulbs/ocaml-esp32 | pipe_eof.ml | (* TEST
* hasunix
include unix
** bytecode
** native
*)
let drain pipe =
let max = 2048 in
let buf = Buffer.create 2048 in
let tmp = Bytes.create max in
while begin
try
let len = Unix.read pipe tmp 0 max in
Buffer.add_subbytes buf tmp 0 len;
len > 0
with Unix.Unix_error (Unix.EPIPE, _... | null | https://raw.githubusercontent.com/well-typed-lightbulbs/ocaml-esp32/c24fcbfbee0e3aa6bb71c9b467c60c6bac326cc7/testsuite/tests/lib-unix/common/pipe_eof.ml | ocaml | TEST
* hasunix
include unix
** bytecode
** native
|
let drain pipe =
let max = 2048 in
let buf = Buffer.create 2048 in
let tmp = Bytes.create max in
while begin
try
let len = Unix.read pipe tmp 0 max in
Buffer.add_subbytes buf tmp 0 len;
len > 0
with Unix.Unix_error (Unix.EPIPE, _, _) when false ->
false
end do () done;
Buffe... |
40d91d9c2c02171c9f173b4bbc96d725fcd0a3213cf67645397f623da53363d8 | venantius/glow | core.clj | (ns glow.core
(:require [glow.colorschemes :as colorschemes]
[glow.html :as html]
[glow.parse :as parse]
[glow.terminal :as terminal]
[instaparse.core :as insta]))
(defn highlight
"Given a string of valid Clojure source code, parse it and return a
syntax-highlighte... | null | https://raw.githubusercontent.com/venantius/glow/17698a3621ba2f7d09f7c786764a21b13f90f6c3/src/glow/core.clj | clojure | (ns glow.core
(:require [glow.colorschemes :as colorschemes]
[glow.html :as html]
[glow.parse :as parse]
[glow.terminal :as terminal]
[instaparse.core :as insta]))
(defn highlight
"Given a string of valid Clojure source code, parse it and return a
syntax-highlighte... | |
b0188e26055ce12d93409a2f8007d8d9cc5db96837bdf48b6912dfe7d5ca2614 | yutopp/rill | attribute.ml |
* Copyright yutopp 2016 - .
*
* Distributed under the Boost Software License , Version 1.0 .
* ( See accompanying file LICENSE_1_0.txt or copy at
* )
* Copyright yutopp 2016 - .
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* )... | null | https://raw.githubusercontent.com/yutopp/rill/375b67c03ab2087d0a2a833bd9e80f3e51e2694f/rillc/_migrating/attribute.ml | ocaml | it can treat simple nodes
default value |
* Copyright yutopp 2016 - .
*
* Distributed under the Boost Software License , Version 1.0 .
* ( See accompanying file LICENSE_1_0.txt or copy at
* )
* Copyright yutopp 2016 - .
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* )... |
65a9515ebd00f9d90a146cf6a88c12865c39c8fe3523229e58deb40add8908b1 | cpeikert/ALCHEMY | Arithmetic.hs | {-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
# LANGUAGE PartialTypeSignatures #
{-# LANGUAGE TemplateHaskell #-}
# LANGUAGE TypeApplications #
# LANGUAGE TypeFamilies #
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
# LANGUAGE Partial... | null | https://raw.githubusercontent.com/cpeikert/ALCHEMY/adbef64576c6f6885600da66f59c5a4ad91810b7/examples/Arithmetic.hs | haskell | # LANGUAGE DataKinds #
# LANGUAGE FlexibleContexts #
# LANGUAGE TemplateHaskell #
# LANGUAGE DataKinds #
# LANGUAGE FlexibleContexts #
# LANGUAGE TemplateHaskell #
# LANGUAGE Strict #
polymorphic over expr alone
-- print and size
putStrLn $ "PT expression: " ++ p... | # LANGUAGE PartialTypeSignatures #
# LANGUAGE TypeApplications #
# LANGUAGE TypeFamilies #
# LANGUAGE PartialTypeSignatures #
# LANGUAGE TypeApplications #
# LANGUAGE TypeFamilies #
# OPTIONS_GHC -fno - warn - partial - type - signatures #
# OPTIONS_GHC -fno - cse #
# OPTIONS_GHC -fno - ... |
dcab3b74e5119c6dcd018748c885d6f154681ba47f34d35bb31e88a8fa148ad0 | serokell/ariadne | Setup.hs | {-# OPTIONS_GHC -Wall -Wcompat -Werror #-}
import Distribution.PackageDescription
(BuildInfo(cSources, extraLibs), HookedBuildInfo, emptyBuildInfo)
import Distribution.Simple (defaultMainWithHooks, simpleUserHooks)
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo, withPrograms)
import Distribution.Simple.Pr... | null | https://raw.githubusercontent.com/serokell/ariadne/5f49ee53b6bbaf332cb6f110c75f7b971acdd452/ui/qt-lib/Setup.hs | haskell | # OPTIONS_GHC -Wall -Wcompat -Werror # |
import Distribution.PackageDescription
(BuildInfo(cSources, extraLibs), HookedBuildInfo, emptyBuildInfo)
import Distribution.Simple (defaultMainWithHooks, simpleUserHooks)
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo, withPrograms)
import Distribution.Simple.Program (Program, runDbProgram, simpleProgram... |
5f6fdc17e85c424d1257889711ba7accd15f269eab3d58e201de1e7eed57d508 | j-cr/speck | core_test.clj | (ns speck.v1.core-test
(:require [speck.v1.core :as speck :refer [|]]
[clojure.test :as test :refer [deftest testing is are]]
[clojure.spec.alpha :as s]
;; [clojure.spec.test.alpha :as s.test]
;; [orchestra.spec.test :as orchestra]
))
;; setup ------------... | null | https://raw.githubusercontent.com/j-cr/speck/dfa4068fd06a31471223feefd88e82afe4d61ceb/test/speck/v1/core_test.clj | clojure | [clojure.spec.test.alpha :as s.test]
[orchestra.spec.test :as orchestra]
setup --------------------------------------------------------------------------
tests --------------------------------------------------------------------------
same test cases as in previous, except now args are with s/or tag
[:arity-1 {:x... | (ns speck.v1.core-test
(:require [speck.v1.core :as speck :refer [|]]
[clojure.test :as test :refer [deftest testing is are]]
[clojure.spec.alpha :as s]
))
(set! *data-readers* (assoc *data-readers* '| #'speck/speck-reader))
(test/use-fixtures
:once (fn [body]
(bind... |
49fd508891d2727a3c09b8af592a906dea6f9ee51753b52d8900b0c8f97c4e52 | hjcapple/reading-sicp | exercise_3_19.scm | #lang sicp
P179 - [ 练习 3.19 ]
让 x1 每次用 cdr 前进 1,x2 每次用 cddr 前进 2 格。初始时 x2 在 x1 前面 。
; 这样当列表包含环时,x2 就会绕圈,从后面追上 x1。
; 因此当 x1 和 x2 相遇,就表示有环。当 x2 到达尾部,就表示不包含环。
这里不用判断 x1 是否到达尾部,因为 x2 每次前进 2 格,会比 x1 要快,不含环时,x2
(define (contains-cycle? x)
(define (contains-cycle-step? x1 x2)
(cond ((not (pair? x2)) false)
... | null | https://raw.githubusercontent.com/hjcapple/reading-sicp/7051d55dde841c06cf9326dc865d33d656702ecc/chapter_3/exercise_3_19.scm | scheme | 这样当列表包含环时,x2 就会绕圈,从后面追上 x1。
因此当 x1 和 x2 相遇,就表示有环。当 x2 到达尾部,就表示不包含环。
#f
#t
#t
#t
f
f
f | #lang sicp
P179 - [ 练习 3.19 ]
让 x1 每次用 cdr 前进 1,x2 每次用 cddr 前进 2 格。初始时 x2 在 x1 前面 。
这里不用判断 x1 是否到达尾部,因为 x2 每次前进 2 格,会比 x1 要快,不含环时,x2
(define (contains-cycle? x)
(define (contains-cycle-step? x1 x2)
(cond ((not (pair? x2)) false)
((not (pair? (cdr x2))) false)
((eq? x1 x2) true)
... |
570f3875336add551a2056dab9089b3e06b52f748b5ee1cb3eda7cf27cd42d94 | jwiegley/notes | TwanFree.hs | {-# LANGUAGE RankNTypes #-}
# LANGUAGE DeriveFunctor #
module TwanFree where
import Control.Monad.Free
data TermF r = PutChar Char r
| GetChar (Char -> r)
deriving Functor
data Term m = Term {
putChar :: Char -> m (),
getChar :: m Char
}
data TFree effect a = TFree { runTFree :: f... | null | https://raw.githubusercontent.com/jwiegley/notes/24574b02bfd869845faa1521854f90e4e8bf5e9a/gists/e420888b9551a4207eb3/TwanFree.hs | haskell | # LANGUAGE RankNTypes # | # LANGUAGE DeriveFunctor #
module TwanFree where
import Control.Monad.Free
data TermF r = PutChar Char r
| GetChar (Char -> r)
deriving Functor
data Term m = Term {
putChar :: Char -> m (),
getChar :: m Char
}
data TFree effect a = TFree { runTFree :: forall m. Monad m => effect m... |
03779d11bccceee3730a6b6a88c30efefa8764ac4e8df34d245eadd5d24e7f46 | Haskell-OpenAPI-Code-Generator/Stripe-Haskell-Library | RefundNextActionDisplayDetails.hs | {-# LANGUAGE MultiWayIf #-}
CHANGE WITH CAUTION : This is a generated code file generated by -OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator .
{-# LANGUAGE OverloadedStrings #-}
-- | Contains the types generated from the schema RefundNextActionDisplayDetails
module StripeAPI.Types.RefundNextActionDispl... | null | https://raw.githubusercontent.com/Haskell-OpenAPI-Code-Generator/Stripe-Haskell-Library/ba4401f083ff054f8da68c741f762407919de42f/src/StripeAPI/Types/RefundNextActionDisplayDetails.hs | haskell | # LANGUAGE MultiWayIf #
# LANGUAGE OverloadedStrings #
| Contains the types generated from the schema RefundNextActionDisplayDetails
# SOURCE #
| Defines the object schema located at @components.schemas.refund_next_action_display_details@ in the specification.
| email_sent:
| expires_at: The expiry timestamp.
| Cr... | CHANGE WITH CAUTION : This is a generated code file generated by -OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator .
module StripeAPI.Types.RefundNextActionDisplayDetails where
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
imp... |
8f6c9251dcfafd9e3cd91c14dfe9128a6751eee5484bfe0513b4bec6841635aa | jimcrayne/jhc | tcfail168.hs |
Test trac # 719 ( should n't give the entire do block in the error message )
module ShouldFail where
foo = do
putChar
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
p... | null | https://raw.githubusercontent.com/jimcrayne/jhc/1ff035af3d697f9175f8761c8d08edbffde03b4e/regress/tests/1_typecheck/4_fail/ghc/tcfail168.hs | haskell |
Test trac # 719 ( should n't give the entire do block in the error message )
module ShouldFail where
foo = do
putChar
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
putChar 'a'
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.