_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 |
|---|---|---|---|---|---|---|---|---|
ad967ce2902995309a8d14a77b19dda152be99be902efef779caf4569d8962d8 | ff-notes/ron | Common.hs | # LANGUAGE LambdaCase #
# LANGUAGE NamedFieldPuns #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE TemplateHaskell #
# LANGUAGE TupleSections #
import RON.Prelude
import qualified Data.ByteString.Lazy as BSL
import qualified Data.ByteString.Lazy.Char8 as BSLC
import Data.Either (partitionEithers)
i... | null | https://raw.githubusercontent.com/ff-notes/ron/0df2b7985996ecc498808ea7247d0d8de471da4f/ron-test/Common.hs | haskell | # LANGUAGE OverloadedStrings # | # LANGUAGE LambdaCase #
# LANGUAGE NamedFieldPuns #
# LANGUAGE TemplateHaskell #
# LANGUAGE TupleSections #
import RON.Prelude
import qualified Data.ByteString.Lazy as BSL
import qualified Data.ByteString.Lazy.Char8 as BSLC
import Data.Either (partitionEithers)
import Data.Foldable (conc... |
836d82a7c08f600a68ea48e0b0dc297d978f443029b76801ff4745919c5c768c | schemedoc/implementation-metadata | ikarus.scm | (short-title "Ikarus")
(title "Ikarus Scheme")
(homepage-url "-scheme.org/")
(homepage-url "/")
(wikipedia en "Ikarus (Scheme implementation)")
(issue-tracker-url "")
(community-forum-url "")
(repology "ikarus-scheme")
(person "Abdulaziz Ghuloum")
(documentation
(title "User's Guide")
(web-url "-scheme.org/ikarus-... | null | https://raw.githubusercontent.com/schemedoc/implementation-metadata/6280d9c4c73833dc5bd1c9bef9b45be6ea5beb68/schemes/ikarus.scm | scheme | (short-title "Ikarus")
(title "Ikarus Scheme")
(homepage-url "-scheme.org/")
(homepage-url "/")
(wikipedia en "Ikarus (Scheme implementation)")
(issue-tracker-url "")
(community-forum-url "")
(repology "ikarus-scheme")
(person "Abdulaziz Ghuloum")
(documentation
(title "User's Guide")
(web-url "-scheme.org/ikarus-... | |
8289065708a963f6c55b71ce5125af074af56e126ba1c87db72641e1e6ffa7d0 | facebook/pyre-check | marshal_tools.mli |
* 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/facebook/pyre-check/10c375bea52db5d10b71cb5206fac7da9549eb0c/source/hack_parallel/hack_parallel/utils/marshal_tools.mli | ocaml |
* 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... | |
3329c803ace032cd981965da687afcc64fb3e1ed9ae40990a708265714c455be | hansroland/reflex-dom-inbits | checkbox02.hs | {-# LANGUAGE OverloadedStrings #-}
import Reflex.Dom
import qualified Data.Text as T
main :: IO ()
main = mainWidget bodyElement
bodyElement :: MonadWidget t m => m ()
bodyElement = el "div" $ do
el "h2" $ text "Checkbox - User friendly"
cb <- el "label" $ do
cb1 <- checkbox True def
text "Click me"
... | null | https://raw.githubusercontent.com/hansroland/reflex-dom-inbits/3bf4ccf43aa45c5df7d3ce42dae38955f657ca33/src/checkbox02.hs | haskell | # LANGUAGE OverloadedStrings # | import Reflex.Dom
import qualified Data.Text as T
main :: IO ()
main = mainWidget bodyElement
bodyElement :: MonadWidget t m => m ()
bodyElement = el "div" $ do
el "h2" $ text "Checkbox - User friendly"
cb <- el "label" $ do
cb1 <- checkbox True def
text "Click me"
return cb1
el "p" blank
let dyn... |
f38c3570081b9c4b00f590b14e4f8d1fce21d02e86fa53cd7b44a740ef3739e1 | Opetushallitus/aipal | vastaajatunnus.clj | Copyright ( c ) 2014 The Finnish National Board of Education - Opetushallitus
;;
This program is free software : Licensed under the EUPL , Version 1.1 or - as
soon as they will be approved by the European Commission - subsequent versions
of the EUPL ( the " Licence " ) ;
;;
;; You may not use this work except... | null | https://raw.githubusercontent.com/Opetushallitus/aipal/767bd14ec7153dc97fdf688443b9687cdb70082f/e2e/src/aipal_e2e/arkisto/vastaajatunnus.clj | clojure |
You may not use this work except in compliance with the Licence.
You may obtain a copy of the Licence at: /
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | Copyright ( c ) 2014 The Finnish National Board of Education - Opetushallitus
This program is free software : Licensed under the EUPL , Version 1.1 or - as
soon as they will be approved by the European Commission - subsequent versions
European Union Public Licence for more details .
(ns aipal-e2e.arkisto.vas... |
5604466971082bcffa69e3cb50644e39804e4eb5e16bf8104811e7cd414908f0 | kumarshantanu/lein-clr | clr.clj | (ns leiningen.clr
(:require [clojure.pprint :as pp]
[clojure.string :as str]
[clojure.java.io :as io]
[leiningen.clr.internal :as in]
[leiningen.core.classpath :as lc])
(:import (java.io Reader BufferedReader File InputStream InputStreamReader
... | null | https://raw.githubusercontent.com/kumarshantanu/lein-clr/de43519353c3c4a8a4e1520faf7f9a576910382e/plugin/src/leiningen/clr.clj | clojure | ===== Project keys =====
===== Target paths =====
===== Project keys =====
========== Tasks ==========
available switch :all
run the namespace (r-ex)
run the tests | (ns leiningen.clr
(:require [clojure.pprint :as pp]
[clojure.string :as str]
[clojure.java.io :as io]
[leiningen.clr.internal :as in]
[leiningen.core.classpath :as lc])
(:import (java.io Reader BufferedReader File InputStream InputStreamReader
... |
9deca9264a2e0c105b5ebfe7fc1d4b6bea8ac1ddaa890972515092ad19d2db55 | mentat-collective/emmy | compile_test.cljc | #_"SPDX-License-Identifier: GPL-3.0"
(ns emmy.expression.compile-test
(:require #?(:cljs [goog.string :refer [format]])
[clojure.test :refer [is deftest testing]]
[clojure.walk :as w]
[emmy.abstract.number]
[emmy.expression.compile :as c]
[emmy.generic :as ... | null | https://raw.githubusercontent.com/mentat-collective/emmy/90a1de10e78187c70d546c3cfd63c8d32b783bed/test/emmy/expression/compile_test.cljc | clojure | #_"SPDX-License-Identifier: GPL-3.0"
(ns emmy.expression.compile-test
(:require #?(:cljs [goog.string :refer [format]])
[clojure.test :refer [is deftest testing]]
[clojure.walk :as w]
[emmy.abstract.number]
[emmy.expression.compile :as c]
[emmy.generic :as ... | |
eef54f8626c6c6b4fb6ceae36112d3a4d7ede2694d1602796249ee452f9beb60 | snowleopard/hadrian | Register.hs | module Rules.Register (configurePackage, registerPackage) where
import Distribution.ParseUtils
import Distribution.Version (Version)
import qualified Distribution.Compat.ReadP as Parse
import qualified Hadrian.Haskell.Cabal.Parse as Cabal
import Hadrian.Expression
import qualified System.Directory as IO
... | null | https://raw.githubusercontent.com/snowleopard/hadrian/b9a3f9521b315942e1dabb006688ee7c9902f5fe/src/Rules/Register.hs | haskell | | Register a package and initialise the corresponding package database if
TODO: Add proper error handling for partial functions.
Register a package.
Calling 'need' on @setupConfig@, triggers the package configuration.
We might need some package-db resource to limit read/write, see packageRules.
Copy and register ... | module Rules.Register (configurePackage, registerPackage) where
import Distribution.ParseUtils
import Distribution.Version (Version)
import qualified Distribution.Compat.ReadP as Parse
import qualified Hadrian.Haskell.Cabal.Parse as Cabal
import Hadrian.Expression
import qualified System.Directory as IO
... |
dd501da0783daff8e5994fe63581bea9eae6614364c45c3889e66fdc2e8209ab | MastodonC/kixi.hecuba | downloads.clj | (ns kixi.hecuba.api.downloads
(:require [clojure.tools.logging :as log]
[liberator.core :refer (defresource)]
[kixi.hecuba.api :refer (authorized?) :as api]
[kixipipe.storage.s3 :as s3]
[kixi.hecuba.security :refer (has-admin? has-programme-manager? has-project-manager?... | null | https://raw.githubusercontent.com/MastodonC/kixi.hecuba/467400bbe670e74420a2711f7d49e869ab2b3e21/src/clj/kixi/hecuba/api/downloads.clj | clojure | List of files is retrieved for a username (read from the current session) so only users who can upload files can also GET those files. Other users will get an empty list.
Downloads for entity
RESOURCES | (ns kixi.hecuba.api.downloads
(:require [clojure.tools.logging :as log]
[liberator.core :refer (defresource)]
[kixi.hecuba.api :refer (authorized?) :as api]
[kixipipe.storage.s3 :as s3]
[kixi.hecuba.security :refer (has-admin? has-programme-manager? has-project-manager?... |
6d6d3c6dd6793f6bf1f36d1d4a209dff375306607048d3d5f0a803fafc15f383 | metaocaml/ber-metaocaml | locs.ml | (* TEST *)
let print_loc loc =
print_endline loc
let print_file file =
print_endline file
let print_line line =
print_endline (Int.to_string line)
let print_module md =
print_endline md
let print_pos (file, line, col1, col2) =
Printf.printf "%s, %d, %d, %d\n" file line col1 col2
let () = print_loc __LOC... | null | https://raw.githubusercontent.com/metaocaml/ber-metaocaml/4992d1f87fc08ccb958817926cf9d1d739caf3a2/testsuite/tests/translprim/locs.ml | ocaml | TEST |
let print_loc loc =
print_endline loc
let print_file file =
print_endline file
let print_line line =
print_endline (Int.to_string line)
let print_module md =
print_endline md
let print_pos (file, line, col1, col2) =
Printf.printf "%s, %d, %d, %d\n" file line col1 col2
let () = print_loc __LOC__
let () ... |
b2b823645bf4993a4948c8400bb9a56ee25ac202c8b85da29af8199e2f3b292d | huangz1990/SICP-answers | 27-memo-fib.scm | ;;; 27-memo-fib.scm
(load "p184-table.scm")
(load "27-memoize.scm")
(define memo-fib
(memoize (lambda (n)
(cond ((= n 0)
0)
((= n 1)
1)
(else
(+ (memo-fib (- n 1))
... | null | https://raw.githubusercontent.com/huangz1990/SICP-answers/15e3475003ef10eb738cf93c1932277bc56bacbe/chp3/code/27-memo-fib.scm | scheme | 27-memo-fib.scm |
(load "p184-table.scm")
(load "27-memoize.scm")
(define memo-fib
(memoize (lambda (n)
(cond ((= n 0)
0)
((= n 1)
1)
(else
(+ (memo-fib (- n 1))
(memo-fib ... |
c8d6edd10d40b7a42a4ae5304f5a1c0e040b64d7d82d828813da8996d28d234b | i-am-tom/world-building-in-haskell | Kernel.hs | # LANGUAGE BlockArguments #
{-# LANGUAGE GADTs #-}
# LANGUAGE LambdaCase #
# LANGUAGE ViewPatterns #
module Map.Kernel where
import Control.Lens.Indexed (FunctorWithIndex (..))
import Data.Function ((&))
import Data.List.NonEmpty (NonEmpty (..))
import Data.Maybe (fromJust)
import Data.Vect (Vect (..))
import Map.Coor... | null | https://raw.githubusercontent.com/i-am-tom/world-building-in-haskell/fe7369b9069793ee6dd2a11e031a53b4af764d1a/src/Map/Kernel.hs | haskell | # LANGUAGE GADTs #
| Construct kernels for every point in the map. Each cell will be replaced
itself. This can be useful if you want to "smooth" an image, or detect
edges, or are trying to implement algorithms like marching squares.
'fromJust' is safe here as the radius will always be a natural number.
lot more ty... | # LANGUAGE BlockArguments #
# LANGUAGE LambdaCase #
# LANGUAGE ViewPatterns #
module Map.Kernel where
import Control.Lens.Indexed (FunctorWithIndex (..))
import Data.Function ((&))
import Data.List.NonEmpty (NonEmpty (..))
import Data.Maybe (fromJust)
import Data.Vect (Vect (..))
import Map.Coordinate ((.+))
import Ma... |
737d4cbdd618f3abddbd4a74514e7e65498344464cf5fd442af5add862e323f8 | emqx/emqx | emqx_ee_bridge_dynamo_SUITE.erl | %%--------------------------------------------------------------------
Copyright ( c ) 2022 - 2023 EMQ Technologies Co. , Ltd. All Rights Reserved .
%%--------------------------------------------------------------------
-module(emqx_ee_bridge_dynamo_SUITE).
-compile(nowarn_export_all).
-compile(export_all).
-inclu... | null | https://raw.githubusercontent.com/emqx/emqx/37c17b120f8d54d7a50f5aec3f2e330f5bb04677/lib-ee/emqx_ee_bridge/test/emqx_ee_bridge_dynamo_SUITE.erl | erlang | --------------------------------------------------------------------
--------------------------------------------------------------------
DB defaults
------------------------------------------------------------------------------
CT boilerplate
--------------------------------------------------------------------------... | Copyright ( c ) 2022 - 2023 EMQ Technologies Co. , Ltd. All Rights Reserved .
-module(emqx_ee_bridge_dynamo_SUITE).
-compile(nowarn_export_all).
-compile(export_all).
-include_lib("eunit/include/eunit.hrl").
-include_lib("common_test/include/ct.hrl").
-include_lib("snabbkaffe/include/snabbkaffe.hrl").
-define(TAB... |
1e1cbbc134325e3eb01a54368dd76f9915943b66732f7934436cd82e8b4b666d | simplegeo/erlang | ssl_handshake.erl | %%
%% %CopyrightBegin%
%%
Copyright Ericsson AB 2007 - 2009 . All Rights Reserved .
%%
The contents of this file are subject to the Erlang Public License ,
Version 1.1 , ( the " License " ) ; you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Pub... | null | https://raw.githubusercontent.com/simplegeo/erlang/15eda8de27ba73d176c7eeb3a70a64167f50e2c4/lib/ssl/src/ssl_handshake.erl | erlang |
%CopyrightBegin%
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at /.
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limita... | Copyright Ericsson AB 2007 - 2009 . All Rights Reserved .
The contents of this file are subject to the Erlang Public License ,
Version 1.1 , ( the " License " ) ; you may not use this file except in
Software distributed under the License is distributed on an " AS IS "
-module(ssl_handshake).
-include("ssl_ha... |
5e105d5f1dc5eb74a41ffd9adebe8b473608bc5cba501a5a9c29310583f543f0 | noelmarkham/learn-you-a-haskell-exercises | 13-for-a-few-monads-more.hs |
- We are going to write a binary search algorithm , which returns a Writer , so we can record the intermediate steps .
-
- The signature of our binary search is as follows :
- binarySearch : : ( Show a , a , Eq a , Monoid b ) = > ( a - > a - > b ) - > a - > [ a ] - > Writer b - A breakdown of the funct... | null | https://raw.githubusercontent.com/noelmarkham/learn-you-a-haskell-exercises/a663197be2c946b5d05beea8a881829e413d411c/13-for-a-few-monads-more.hs | haskell |
- Investigate what other functions instead of describe can be passed to the binary search.
- Is it possible to provide a function, so that when we do the binary search we can return a count of how many comparisons the algorithm took?
|
- We are going to write a binary search algorithm , which returns a Writer , so we can record the intermediate steps .
-
- The signature of our binary search is as follows :
- binarySearch : : ( Show a , a , Eq a , Monoid b ) = > ( a - > a - > b ) - > a - > [ a ] - > Writer b - A breakdown of the funct... |
e11dee4f1d1ecb38855f69bf40c51960cd1adcdb1fbd57e25c83371a9694f8df | shirok/Gauche-compat-sdff | checker2.scm | -*- coding : utf-8 -*-
(define-module compat.sdff.checker2
(extend compat.sdff.checker)
(export piece-type)
)
(select-module compat.sdff.checker2)
;; Redefinition
(define-class <piece> ()
((owner :init-keyword :owner) ;dark or light
(coords :init-keyword :coords) ;(row . column)
(type ... | null | https://raw.githubusercontent.com/shirok/Gauche-compat-sdff/9d59eff455e4bc20a25e3c100fe34a2edde8a0cc/compat/sdff/checker2.scm | scheme | Redefinition
dark or light
(row . column)
<step> is superseded by <change>
path becomes <pmove> | -*- coding : utf-8 -*-
(define-module compat.sdff.checker2
(extend compat.sdff.checker)
(export piece-type)
)
(select-module compat.sdff.checker2)
(define-class <piece> ()
(type :init-keyword :type)))
(define (piece-type piece) (~ piece'type))
(define (piece-new-type piece type)
(make <piece>
:ow... |
6b01423f5fcfcdbc391a5e261ad12cc9681385b86725105b9f4022adababfbba | jasonstolaruk/CurryMUD | RmFuns.hs | {-# LANGUAGE OverloadedStrings #-}
module Mud.Threads.RmFuns ( startRmFuns
, stopRmFuns ) where
import Mud.Data.State.MudData
import Mud.Data.State.Util.Misc
import qualified Mud.Misc.Logging as L (logNotice)
import Mud.Threads.Misc
import Mud.Util.Mis... | null | https://raw.githubusercontent.com/jasonstolaruk/CurryMUD/f9775fb3ede08610f33f27bb1fb5fc0565e98266/lib/Mud/Threads/RmFuns.hs | haskell | # LANGUAGE OverloadedStrings #
==================================================
Room functions should have their own exception handlers. |
module Mud.Threads.RmFuns ( startRmFuns
, stopRmFuns ) where
import Mud.Data.State.MudData
import Mud.Data.State.Util.Misc
import qualified Mud.Misc.Logging as L (logNotice)
import Mud.Threads.Misc
import Mud.Util.Misc
import Mud.Util.Operato... |
c818579ebdc56fb6bb98d31b57dc556327a1561950524d836cee24df2cf74e4c | binsec/binsec | directive.mli | (**************************************************************************)
This file is part of BINSEC .
(* *)
Copyright ( C ) 2016 - 2022
CEA ( Co... | null | https://raw.githubusercontent.com/binsec/binsec/8ed9991d36451a3ae7487b966c4b38acca21a5b3/src/utils/directive.mli | ocaml | ************************************************************************
alternatives)
you can redistribute it an... | This file is part of BINSEC .
Copyright ( C ) 2016 - 2022
CEA ( Commissariat à l'énergie atomique et aux énergies
Lesser General Public License as published by the Free Software
Foundation , ve... |
cdae9b2306f137d5b502a3763c70b7e715462208c538af080fa8dd752676eb95 | saltysystems/overworld | ow_collision.erl | -module(ow_collision).
-export([
new/5, new/3, new/2,
add_entity/3,
add_entities/3,
check_area/3,
check_ray/5,
check_ray_test/0
]).
% these aren't eunit tests as such, just some scaffolding toward building those
-export([
add_entity_test/0,
add_entities_test/0,
check_area_test/0
]).... | null | https://raw.githubusercontent.com/saltysystems/overworld/98082ec1d51a1899ef29440869107853a7920065/src/ow_collision.erl | erlang | these aren't eunit tests as such, just some scaffolding toward building those
:: [{ow_vector:vector(), ...}, ...]
Random internet posters suggest the optimal depth of the quadtree should be
log4(N) where N is number of entities. Empirically it seems about right!
be log4(N) where N is number of entities.
coordinate... | -module(ow_collision).
-export([
new/5, new/3, new/2,
add_entity/3,
add_entities/3,
check_area/3,
check_ray/5,
check_ray_test/0
]).
-export([
add_entity_test/0,
add_entities_test/0,
check_area_test/0
]).
Generic collision detection module .
: : { ( ) , ( ) }
-record(test_entit... |
71b5903b49a824e9aeaf264e1be70410718a7a7df4ff6521b6666da4beaad107 | ucsd-progsys/dsolve | coin.ml | val dominations = [1,5,10,25]
fun f n v =
case ds of
[] => if n = 0 then v = 0 else false
| d :: ds =>
if v < d then false
else if n = 0 then if v = d then true else f ds n v
else if f dominations (n-1) (v-d) then true else f ds n v
fun changes n v =
if n = 0 then v = 0
else f domination... | null | https://raw.githubusercontent.com/ucsd-progsys/dsolve/bfbbb8ed9bbf352d74561e9f9127ab07b7882c0c/tests/POPL2008/xiog/DMLex/coin.ml | ocaml | val dominations = [1,5,10,25]
fun f n v =
case ds of
[] => if n = 0 then v = 0 else false
| d :: ds =>
if v < d then false
else if n = 0 then if v = d then true else f ds n v
else if f dominations (n-1) (v-d) then true else f ds n v
fun changes n v =
if n = 0 then v = 0
else f domination... | |
c23493af5cc826522e365c3ace33927db961d9c35a94df1e50003be621fcb300 | hilverd/lein-ns-dep-graph | project.clj | (defproject lein-ns-dep-graph "0.4.0-SNAPSHOT"
:description "Show namespace dependencies of project sources as a graph."
:url "-ns-dep-graph"
:license {:name "Eclipse Public License"
:url "-v10.html"}
:eval-in-leiningen true
:dependencies [[org.clojure/tools.namespace "1.1.0"]
[rh... | null | https://raw.githubusercontent.com/hilverd/lein-ns-dep-graph/71ce661e145910701b6235453059c02335843dd5/project.clj | clojure | (defproject lein-ns-dep-graph "0.4.0-SNAPSHOT"
:description "Show namespace dependencies of project sources as a graph."
:url "-ns-dep-graph"
:license {:name "Eclipse Public License"
:url "-v10.html"}
:eval-in-leiningen true
:dependencies [[org.clojure/tools.namespace "1.1.0"]
[rh... | |
fd1ff4d3c23541c1fdf077329ad04398a041dba4df35ec6a1c16cd3b72d5f6e9 | RefactoringTools/wrangler | api_wrangler.erl | Copyright ( c ) 2010 , ,
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted provided that the following conditions are met:
%% %% Redistributions of source code must retain the above copyright
%% notice, this list of conditions... | null | https://raw.githubusercontent.com/RefactoringTools/wrangler/f3f9fb286c214aacdf8370f376a01a293e9f8e6c/src/api_wrangler.erl | erlang | All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
%% Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
%% Redi... | Copyright ( c ) 2010 , ,
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR
The refactoring command level API that can be run in an Erlang shell .
Author contact : ,
2006 - 2011 ,
@author ,
... |
20d074fd7a2d12d8f5443707b944426e37bdcd48e18314fc84a22f56cae30216 | dizengrong/erlang_game | role.erl | @author dzR < >
%% @doc 与玩家相关的逻辑处理
-module (role).
-include ("map.hrl").
-include ("db_table_role.hrl").
-export([get_pos/1, save_pos/1, persistent_pos/4, make_tab_pos_rec/4]).
-export([get_level/1, get_move_speed/1]).
%% @doc 获取玩家的等级
get_level(RoleId) ->
Rec = hd(role_dict:lookup(RoleId, tab_role_data)),
Rec#t... | null | https://raw.githubusercontent.com/dizengrong/erlang_game/4598f97daa9ca5eecff292ac401dd8f903eea867/gerl/src/map_srv/logic/role.erl | erlang | @doc 与玩家相关的逻辑处理
@doc 获取玩家的等级
@doc 获取玩家的移动速度
@doc 从role_dict缓存中获取玩家的当前位置
注意这个方法只在玩家还未建立cell_role数据record时会调用的
@doc 将玩家位置数据保存到role_dict中
@doc 直接持久化新的坐标到缓存数据库 | @author dzR < >
-module (role).
-include ("map.hrl").
-include ("db_table_role.hrl").
-export([get_pos/1, save_pos/1, persistent_pos/4, make_tab_pos_rec/4]).
-export([get_level/1, get_move_speed/1]).
get_level(RoleId) ->
Rec = hd(role_dict:lookup(RoleId, tab_role_data)),
Rec#tab_role_data.role_level.
get_move_... |
15280f8a5b1a84f161bb6736c8ced0e71c1e701939e5f831d27585458b9469cf | jeannekamikaze/Spear | Main.hs | module Main where
import Data.Maybe (mapMaybe)
import Graphics.Rendering.OpenGL.GL (($=))
import qualified Graphics.Rendering.OpenGL.GL as GL
import Pong
import Spear.App
import Spear.Game
import Spear.Math.AABB
import Spear.Math.Spatial2
import Spear.Math.Vector
import Spear.Window
data GameState = GameState
{ win... | null | https://raw.githubusercontent.com/jeannekamikaze/Spear/d81c62adbc955855438f1626c685e92794017d2d/demos/pong/Main.hs | haskell | module Main where
import Data.Maybe (mapMaybe)
import Graphics.Rendering.OpenGL.GL (($=))
import qualified Graphics.Rendering.OpenGL.GL as GL
import Pong
import Spear.App
import Spear.Game
import Spear.Math.AABB
import Spear.Math.Spatial2
import Spear.Math.Vector
import Spear.Window
data GameState = GameState
{ win... | |
b047c97fc7603339f6d9124ffd0746c2cc29be4e42f515576383f68816c3bc96 | rescript-lang/rescript-compiler | lam_util.mli | Copyright ( C ) 2015 - 2016 Bloomberg Finance L.P.
* Copyright ( C ) 2017 - , Authors of ReScript
* This program is free software : you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation , either version 3 of the... | null | https://raw.githubusercontent.com/rescript-lang/rescript-compiler/e60482c6f6a69994907b9bd56e58ce87052e3659/jscomp/core/lam_util.mli | ocaml | only access field [0]
* [dump] when {!Js_config.is_same_file} | Copyright ( C ) 2015 - 2016 Bloomberg Finance L.P.
* Copyright ( C ) 2017 - , Authors of ReScript
* This program is free software : you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation , either version 3 of the... |
26bf1a12619ba9f37b8f2e361af014a1990982c5fef3ccb1f41d9cd079228d70 | hopv/MoCHi | literal.ml | open Util
open Combinator
open Term
include Formula
* { 6 Auxiliary destructors }
let formula_of = id
let atom_of = term_of >> Atom.of_term
* { 6 Auxiliary constructors }
let mk_atom c ts = Term.mk_app (Term.mk_const c) ts |> of_term
let of_formula = id
let of_atom = Atom.term_of >> of_term
let eq ty t1 t2 = Atom... | null | https://raw.githubusercontent.com/hopv/MoCHi/b0ac0d626d64b1e3c779d8e98cb232121cc3196a/fpat/literal.ml | ocaml | open Util
open Combinator
open Term
include Formula
* { 6 Auxiliary destructors }
let formula_of = id
let atom_of = term_of >> Atom.of_term
* { 6 Auxiliary constructors }
let mk_atom c ts = Term.mk_app (Term.mk_const c) ts |> of_term
let of_formula = id
let of_atom = Atom.term_of >> of_term
let eq ty t1 t2 = Atom... | |
cb6447de3b0473a0a706fbb7fee85366bec7f174031b7b59212b1371a4979f42 | laanwj/Purecoin | BlockChain.hs | module Purecoin.Core.BlockChain
( BlockChain, newChain, getCoinMap
, AddBlockResult, AddBlockMonad(..), addBlock)
where
import Control.Applicative ((<$>))
import Control.Arrow ((***), (&&&))
import Data.List (unfoldr, sort)
import Data.Maybe (listToMaybe)
import Data.Monoid (mempty, mconcat)
impor... | null | https://raw.githubusercontent.com/laanwj/Purecoin/0861dbc0ed61545d26787b3a001992e67b14ad45/Purecoin/Core/BlockChain.hs | haskell | Must be non-empty.
make this a typeclass method
TODO: I had a bug where I used hash instead of bHash. I need to do something with the type system to prevent this in the future --
notice the time it takes to generate a new block after a change in difficutly isn't taken into account!
Try to round the same way the o... | module Purecoin.Core.BlockChain
( BlockChain, newChain, getCoinMap
, AddBlockResult, AddBlockMonad(..), addBlock)
where
import Control.Applicative ((<$>))
import Control.Arrow ((***), (&&&))
import Data.List (unfoldr, sort)
import Data.Maybe (listToMaybe)
import Data.Monoid (mempty, mconcat)
impor... |
966ba85329f9566168875495e6623b20546ef59a8b8ca09c5c933674200142d3 | clj-kondo/clj-kondo | deftype.cljs | (ns deftype)
(deftype LazySeq2 [meta ^:mutable fx ^:mutable s ^:mutable __hash]
Object
(toString [coll]
(pr-str* coll))
(equiv [this other]
(-equiv this other))
(sval [coll]
(if (nil? fn)
s
(do
(set! s (fn))
(set! fn nil)
s)))
IPending
(-realized? [coll]
... | null | https://raw.githubusercontent.com/clj-kondo/clj-kondo/626978461cbf113c376634cdf034d7262deb429f/corpus/deftype.cljs | clojure | (ns deftype)
(deftype LazySeq2 [meta ^:mutable fx ^:mutable s ^:mutable __hash]
Object
(toString [coll]
(pr-str* coll))
(equiv [this other]
(-equiv this other))
(sval [coll]
(if (nil? fn)
s
(do
(set! s (fn))
(set! fn nil)
s)))
IPending
(-realized? [coll]
... | |
8ce98e5995c9e95c90b1e2118fcdeb5a176109031a82537edb114c72faa46127 | HealthSamurai/re-form | shared.cljc | (ns re-form.shared
(:require [clojure.string :as str]
[clojure.set :as set]))
(defn operand [ex]
(fn [e]
(if (coll? ex)
(get-in e ex)
(if (keyword? ex)
(get e ex)
ex))))
(def cmp {:= = :< < :> > :<= <= :>= >=})
(defn pred [[op l r]]
#((get cmp op)
((operand l) ... | null | https://raw.githubusercontent.com/HealthSamurai/re-form/810321d67e3946876c834998e3472d0693846953/src/cljc/re_form/shared.cljc | clojure | (ns re-form.shared
(:require [clojure.string :as str]
[clojure.set :as set]))
(defn operand [ex]
(fn [e]
(if (coll? ex)
(get-in e ex)
(if (keyword? ex)
(get e ex)
ex))))
(def cmp {:= = :< < :> > :<= <= :>= >=})
(defn pred [[op l r]]
#((get cmp op)
((operand l) ... | |
5ddb9c0056e0ceae34fc1f9370ae206b55910321933655cfc84ab8868b785fc6 | plumatic/schema-generators | generators.cljc | (ns schema-generators.generators
"Experimental support for compiling schemas to test.check generators."
(:require
[clojure.test.check.generators :as generators]
[schema.spec.core :as spec :include-macros true]
schema.spec.collection
schema.spec.leaf
schema.spec.variant
[schema.core :as s :include-... | null | https://raw.githubusercontent.com/plumatic/schema-generators/499db79a0d7e209626be63a82a0d758b9efa1c4b/src/schema_generators/generators.cljc | clojure |
Private helpers for composite schemas
Helpers for collections
TODO: this does not currently capture proper semantics of maps with
both specific keys and key schemas that can override them.
Public
using unchecked-float here will unfortunately generate a lot of
infinities, since lots of doubles are out of the fl... | (ns schema-generators.generators
"Experimental support for compiling schemas to test.check generators."
(:require
[clojure.test.check.generators :as generators]
[schema.spec.core :as spec :include-macros true]
schema.spec.collection
schema.spec.leaf
schema.spec.variant
[schema.core :as s :include-... |
e821a06e80f45cd0508cb3fb7f7bfd6d011f30ada4f5d08c137bf40dd0e5db8a | blueberry/doing-bayesian-data-analysis-gpu-opencl | smart_drug_normal.clj | Copyright ( c ) . All rights reserved .
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (-1.0.php) or later
;; which can be found in the file LICENSE at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be boun... | null | https://raw.githubusercontent.com/blueberry/doing-bayesian-data-analysis-gpu-opencl/1b914aa6839a3517c5850ad53c7c972c304de0a9/src/dbda/ch16/smart_drug_normal.clj | clojure | The use and distribution terms for this software are covered by the
Eclipse Public License 1.0 (-1.0.php) or later
which can be found in the file LICENSE at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not rem... | Copyright ( c ) . All rights reserved .
(ns ^{:author "Dragan Djuric"}
dbda.ch16.smart-drug-normal
(:require [quil.core :as q]
[quil.applet :as qa]
[quil.middlewares.pause-on-error :refer [pause-on-error]]
[uncomplicate.commons.core :refer [with-release let-release wrap-... |
9ce3296806db041abd6dc7235e38834a7c57ea39b909f4822a6e87c32cfece85 | satori-com/mzbench | dummy_worker.erl | -module(dummy_worker).
-export([initial_state/0, metrics/0,
print/3, test_method/3, test_pre_hook/1, test_proplist/3,
doubled_print_counter/0, terminate_state/2]).
-type state() :: string().
-spec initial_state() -> state().
initial_state() -> "".
metrics() ->
[{"print", counter, #{visibility ... | null | https://raw.githubusercontent.com/satori-com/mzbench/02be2684655cde94d537c322bb0611e258ae9718/node/apps/dummy_worker/src/dummy_worker.erl | erlang | need this log for tests | -module(dummy_worker).
-export([initial_state/0, metrics/0,
print/3, test_method/3, test_pre_hook/1, test_proplist/3,
doubled_print_counter/0, terminate_state/2]).
-type state() :: string().
-spec initial_state() -> state().
initial_state() -> "".
metrics() ->
[{"print", counter, #{visibility ... |
0b28bd7523820923464e3e9cf0a454b4f61c67cf6411b4f9eee330f424429015 | hiredman/clojurebot | derby-to-postgres.clj | (let [pom-uber-jar
(str "/"
"pomegranate-0.0.13-SNAPSHOT-jar-with-dependencies.jar")
cl (java.net.URLClassLoader. (into-array [(java.net.URL. pom-uber-jar)]))
cx (.getContextClassLoader (Thread/currentThread))]
(push-thread-bindings {clojure.lang.Compiler/LOADER cl})
(.setContextClassLo... | null | https://raw.githubusercontent.com/hiredman/clojurebot/1e8bde92f2dd45bb7928d4db17de8ec48557ead1/derby-to-postgres.clj | clojure | (let [pom-uber-jar
(str "/"
"pomegranate-0.0.13-SNAPSHOT-jar-with-dependencies.jar")
cl (java.net.URLClassLoader. (into-array [(java.net.URL. pom-uber-jar)]))
cx (.getContextClassLoader (Thread/currentThread))]
(push-thread-bindings {clojure.lang.Compiler/LOADER cl})
(.setContextClassLo... | |
fb66d43948be33b9cad9b3cf6de4f621cc6a57016035664bf9de59de98e6a7e4 | crategus/cl-cffi-gtk | gtk.calendar.lisp | ;;; ----------------------------------------------------------------------------
;;; gtk.calendar.lisp
;;;
;;; The documentation of this file is taken from the GTK 3 Reference Manual
Version 3.24 and modified to document the Lisp binding to the GTK library .
;;; See <>. The API documentation of the Lisp binding is
... | null | https://raw.githubusercontent.com/crategus/cl-cffi-gtk/ba198f7d29cb06de1e8965e1b8a78522d5430516/gtk/gtk.calendar.lisp | lisp | ----------------------------------------------------------------------------
gtk.calendar.lisp
The documentation of this file is taken from the GTK 3 Reference Manual
See <>. The API documentation of the Lisp binding is
This program is free software: you can redistribute it and/or modify
it under the terms of ... | Version 3.24 and modified to document the Lisp binding to the GTK library .
available from < -cffi-gtk/ > .
Copyright ( C ) 2009 - 2011
Copyright ( C ) 2011 - 2021
as published by the Free Software Foundation , either version 3 of the
the GNU Lesser General Public License that clarifies the terms for us... |
15926dc05dab8756e100de9ecfddde3baf5b8c251368e71d43bdddca6558c68e | REPROSEC/dolev-yao-star | Vale_Transformers_InstructionReorder.ml | open Prims
let rec (locations_of_locations_with_values :
Vale_Transformers_BoundedInstructionEffects.locations_with_values ->
Vale_Transformers_Locations.location Prims.list)
=
fun lv ->
match lv with
| [] -> []
| (Prims.Mkdtuple2 (l, v))::lv1 -> l ::
(locations_of_locations_with_values lv... | null | https://raw.githubusercontent.com/REPROSEC/dolev-yao-star/d97a8dd4d07f2322437f186e4db6a1f4d5ee9230/concrete/hacl-star-snapshot/ml/Vale_Transformers_InstructionReorder.ml | ocaml | open Prims
let rec (locations_of_locations_with_values :
Vale_Transformers_BoundedInstructionEffects.locations_with_values ->
Vale_Transformers_Locations.location Prims.list)
=
fun lv ->
match lv with
| [] -> []
| (Prims.Mkdtuple2 (l, v))::lv1 -> l ::
(locations_of_locations_with_values lv... | |
555914e03a49fb2bb24480487b193c05860d011736803f570e658b6883ffa04e | MLstate/opalang | pass_ServerJavascriptOptimization.mli |
Copyright © 2011 , 2012 MLstate
This file is part of .
is free software : you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License , version 3 , as published by
the Free Software Foundation .
is distributed in the hope that it will be us... | null | https://raw.githubusercontent.com/MLstate/opalang/424b369160ce693406cece6ac033d75d85f5df4f/compiler/js_passes/pass_ServerJavascriptOptimization.mli | ocaml |
Copyright © 2011 , 2012 MLstate
This file is part of .
is free software : you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License , version 3 , as published by
the Free Software Foundation .
is distributed in the hope that it will be us... | |
722cbe8b0e4a106466300f52b2999f4cf1ef39dd5d3f5455fce64e047cb53dc5 | elisehuard/game-in-haskell | Graphics.hs | # OPTIONS_GHC -fno - warn - type - defaults #
{-# LANGUAGE PackageImports #-}
module Hunted.Graphics (
loadTextures
, initState
, renderFrame
, Textures
) where
import Hunted.GameTypes
import Hunted.Backend (swapBuffers)
import "GLFW-b" Graphics.UI.GLFW as GLFW
import Graphics.Gloss hiding (play)
import Graphics.Glo... | null | https://raw.githubusercontent.com/elisehuard/game-in-haskell/b755c42d63ff5dc9246b46590fb23ebcc1d455b1/src/Hunted/Graphics.hs | haskell | # LANGUAGE PackageImports #
again, need to export gloss internal state for this signature, pull request required
tiling: pictures translated to the appropriate locations to fill up the given width and heights
I scaled the tile to the greatest common factor of the width and height, but it should work to fit the actua... | # OPTIONS_GHC -fno - warn - type - defaults #
module Hunted.Graphics (
loadTextures
, initState
, renderFrame
, Textures
) where
import Hunted.GameTypes
import Hunted.Backend (swapBuffers)
import "GLFW-b" Graphics.UI.GLFW as GLFW
import Graphics.Gloss hiding (play)
import Graphics.Gloss.Rendering
import Graphics.Glo... |
7960b350be688fea58962848bfaa74ca40a5883c4109e51a92e5748ee10296cf | marigold-dev/deku | validators.ml | open Deku_crypto
type validators = { set : Key_hash.Set.t; list : Key_hash.t list }
and t = validators
let of_key_hash_list validators =
match validators with
| [] -> raise (Invalid_argument "validators cannot be empty")
| validators ->
let set = Key_hash.Set.of_list validators in
assert (Key_hash.S... | null | https://raw.githubusercontent.com/marigold-dev/deku/cdf82852196b55f755f40850515580be4fd9a3fa/deku-p/src/core/consensus/validators.ml | ocaml | TODO: O(1) cardinality | open Deku_crypto
type validators = { set : Key_hash.Set.t; list : Key_hash.t list }
and t = validators
let of_key_hash_list validators =
match validators with
| [] -> raise (Invalid_argument "validators cannot be empty")
| validators ->
let set = Key_hash.Set.of_list validators in
assert (Key_hash.S... |
9baac9cb60796be71f0316a7bf1ca0e276f14e09c9ac55b327ed654d01174fb3 | S8A/htdp-exercises | shapes-as-functions.rkt | The first three lines of this file were inserted by . They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname shapes-as-functions) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t construc... | null | https://raw.githubusercontent.com/S8A/htdp-exercises/578e49834a9513f29ef81b7589b28081c5e0b69f/shapes-as-functions.rkt | racket | about the language level of this file in a form that our tools can easily process.
A Shape is a function:
[Posn -> Boolean]
Shape Posn -> Boolean
Checks whether posn p is inside shape s
Number Number -> Shape
Creates a single point (x,y)
Number Number Number -> Shape
Creates a circle of center (center-x, ce... | The first three lines of this file were inserted by . They record metadata
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname shapes-as-functions) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
interpretation if s is a shape and p a ... |
105211e4d4ea8cd2f1b2a37ae9ccc52c23038461d5139ac5ce8cc0002eaba3bc | jepsen-io/jepsen | raftis.clj | (ns jepsen.raftis
(:gen-class)
(:require [clojure.tools.logging :refer :all]
[clojure.string :as str]
[taoensso.carmine :as car :refer (wcar)]
[knossos.model :as model]
[jepsen [checker :as checker]
[cli :as cli]
[client :as cli... | null | https://raw.githubusercontent.com/jepsen-io/jepsen/a75d5a50dd5fa8d639a622c124bf61253460b754/raftis/src/jepsen/raftis.clj | clojure | (ns jepsen.raftis
(:gen-class)
(:require [clojure.tools.logging :refer :all]
[clojure.string :as str]
[taoensso.carmine :as car :refer (wcar)]
[knossos.model :as model]
[jepsen [checker :as checker]
[cli :as cli]
[client :as cli... | |
abc3af779b70605f30b8a9d608c1835c92f67e49b4145cf3d746d6ea85e2c443 | facebook/pyre-check | modelParseResult.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/facebook/pyre-check/e746f93050c052ef04a6146dd9d0204afe2fb96e/source/interprocedural_analyses/taint/modelParseResult.ml | ocaml | Represents a source or sink kind (e.g, UserControlled)
An arbitrary constraint for functions, methods, attributes or globals. |
* 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... |
13a91d47bf078d66fb3b3ed84b59191c7d431e3d086ac077543bc47e8d1b4e0d | shayne-fletcher/zen | print_utils.mli | include Print_utils_sig.S
| null | https://raw.githubusercontent.com/shayne-fletcher/zen/10a1d0b9bf261bb133918dd62fb1593c3d4d21cb/ocaml/regexp/print_utils.mli | ocaml | include Print_utils_sig.S
| |
f2531919755c66f7b696e9560a3238035e17cf8940dd83b11125c3a0154e4fe4 | nodename/clevolution | appstate.clj | (ns clevolution.app.state.appstate
(:require [clevolution.imagedata :refer [DEFAULT-VIEWPORT ORIGIN-VIEWPORT
merge-view-elements
set-image-in-image-data]]))
(defonce app-state (atom {:content-panel nil
... | null | https://raw.githubusercontent.com/nodename/clevolution/e0302d788826d6408076471a724fbe6352dddd82/src/clj/clevolution/app/state/appstate.clj | clojure | (ns clevolution.app.state.appstate
(:require [clevolution.imagedata :refer [DEFAULT-VIEWPORT ORIGIN-VIEWPORT
merge-view-elements
set-image-in-image-data]]))
(defonce app-state (atom {:content-panel nil
... | |
45abf27b2409fc5b01d53772ad0507519dae9d12cbce80f2da34984e1305bd49 | avsm/platform | comment.ml |
* Copyright ( c ) 2016 , 2017 < >
*
* Permission to use , copy , modify , and distribute this software for any
* purpose with or without fee is hereby granted , provided that the above
* copyright notice and this permission notice appear in all copies .
*
* THE SOFTWARE IS PROVIDED " AS IS " AND... | null | https://raw.githubusercontent.com/avsm/platform/b254e3c6b60f3c0c09dfdcde92eb1abdc267fa1c/duniverse/odoc.1.4.2/src/html/comment.ml | ocaml | This is the entry point. stop_before is false on entry, true on recursive
call.
IDENTIFIER MUST BE RENAMED TO DEFINITION.
FIXME: better error message
TODO Rework that ugly function.
TODO References should be set in code style, if they are to code
elements.
TODO: This will probably be rep... |
* Copyright ( c ) 2016 , 2017 < >
*
* Permission to use , copy , modify , and distribute this software for any
* purpose with or without fee is hereby granted , provided that the above
* copyright notice and this permission notice appear in all copies .
*
* THE SOFTWARE IS PROVIDED " AS IS " AND... |
08885164fa4b814ad04a7045c046d506def4689b496ffb7e13c7685c4684b4ff | TrustInSoft/tis-interpreter | apron_domain.ml | Modified by TrustInSoft
(**************************************************************************)
(* *)
This file is part of Frama - C.
(* ... | null | https://raw.githubusercontent.com/TrustInSoft/tis-interpreter/33132ce4a825494ea48bf2dd6fd03a56b62cc5c3/src/plugins/value/domains/apron/apron_domain.ml | ocaml | ************************************************************************
alternatives)
... | Modified by TrustInSoft
This file is part of Frama - C.
Copyright ( C ) 2007 - 2015
CEA ( Commissariat à l'énergie atomique et aux énergies
Lesser General Public License as published by the Free Softwa... |
d58c83909f71d6b02e489c652f3c40024f4d0b807fecee3264cdca1091f17b1c | AndrasKovacs/setoidtt | TextOps.hs | # language OverloadedStrings , BangPatterns #
module TextOps where
import Data.Text
import Control.Monad
-- Text is crap for fast parsing, just look at the core..
foo :: Text -> Bool
foo t = Data.Text.take 3 t == "foo"
-- foo :: Text -> Maybe ()
-- foo t = do
-- (c, t) <- uncons t
-- guard (c == 'f')
-- (c, t... | null | https://raw.githubusercontent.com/AndrasKovacs/setoidtt/621aef2c4ae5a6acb418fa1153575b21e2dc48d2/experiments/TextOps.hs | haskell | Text is crap for fast parsing, just look at the core..
foo :: Text -> Maybe ()
foo t = do
(c, t) <- uncons t
guard (c == 'f')
(c, t) <- uncons t
guard (c == 'o')
(c, t) <- uncons t
guard (c == 'o')
pure () | # language OverloadedStrings , BangPatterns #
module TextOps where
import Data.Text
import Control.Monad
foo :: Text -> Bool
foo t = Data.Text.take 3 t == "foo"
|
2d8ec48b4acaf2a1b30439d22605db2d005dcf873e3023a8ac740d52207af555 | RyanGlScott/text-show-instances | XHtmlSpec.hs | |
Module : Spec . Text . : ( C ) 2014 - 2017
License : BSD - style ( see the file LICENSE )
Maintainer :
Stability : Provisional
Portability : GHC
@hspec@ tests for data types in the @xhtml@ library .
Module: Spec.Text.XHtmlSpec
Copyright: (C) 2014-2017 Ryan Scott
License... | null | https://raw.githubusercontent.com/RyanGlScott/text-show-instances/b4f2f2631c7bfb64349ae75a8fe176f6840adc22/tests/Spec/Text/XHtmlSpec.hs | haskell | |
Module : Spec . Text . : ( C ) 2014 - 2017
License : BSD - style ( see the file LICENSE )
Maintainer :
Stability : Provisional
Portability : GHC
@hspec@ tests for data types in the @xhtml@ library .
Module: Spec.Text.XHtmlSpec
Copyright: (C) 2014-2017 Ryan Scott
License... | |
47ca1b2eba694c38e7145a6b9e914294c717cef12572113edd33a54d1e2c8eaa | int28h/HaskellTasks | 0038.hs |
Реализуйте функцию isSquare , ли фигура квадратом .
Реализуйте функцию isSquare, проверяющую является ли фигура квадратом.
-}
data Shape = Circle Double | Rectangle Double Double
square :: Double -> Shape
square a = Rectangle a a
isSquare :: Shape -> Bool
isSquare (Rectangle a b) = a == b
isSquare (Circle r) = ... | null | https://raw.githubusercontent.com/int28h/HaskellTasks/38aa6c1d461ca5774350c68fa7dd631932f10f84/src/0038.hs | haskell |
Реализуйте функцию isSquare , ли фигура квадратом .
Реализуйте функцию isSquare, проверяющую является ли фигура квадратом.
-}
data Shape = Circle Double | Rectangle Double Double
square :: Double -> Shape
square a = Rectangle a a
isSquare :: Shape -> Bool
isSquare (Rectangle a b) = a == b
isSquare (Circle r) = ... | |
ef176c0de497d3ce5615f589556db4522076c101120cde46a916df59e68c7735 | huangz1990/real-world-haskell-cn | F.hs | file : ch25 / F.hs
{-# LANGUAGE BangPatterns #-}
import System.Environment
import Text.Printf
main = do
[d] <- map read `fmap` getArgs
printf "%f\n" (mean [1..d])
mean :: [Double] -> Double
mean xs = s / fromIntegral n
where
(n, s) = foldl' k (0, 0) xs
k (!n, !s) x = (n+1, s+x)
| null | https://raw.githubusercontent.com/huangz1990/real-world-haskell-cn/f67b07dd846b1950d17ff941d650089fcbbe9586/code/ch25/F.hs | haskell | # LANGUAGE BangPatterns # | file : ch25 / F.hs
import System.Environment
import Text.Printf
main = do
[d] <- map read `fmap` getArgs
printf "%f\n" (mean [1..d])
mean :: [Double] -> Double
mean xs = s / fromIntegral n
where
(n, s) = foldl' k (0, 0) xs
k (!n, !s) x = (n+1, s+x)
|
982364b0f2c49013dacefbdd9eb2d323956d9ed9a765a35a03b8aa891fe7bbcf | tsoding/aoc-2019 | Main.hs | module Main where
import Data.List
import Data.Function
import Text.Printf
import Data.Fixed
data V2 =
V2 Int
Int
deriving (Eq, Show)
type Region = [V2]
(^-^) :: V2 -> V2 -> V2
(^-^) (V2 x1 y1) (V2 x2 y2) = V2 (x1 - x2) (y1 - y2)
type Rad = Double
parseRegion :: String -> Region
parseRegion =
concatMap... | null | https://raw.githubusercontent.com/tsoding/aoc-2019/bd186aa96558676a4380a465351b877dbaae261d/10/Main.hs | haskell | module Main where
import Data.List
import Data.Function
import Text.Printf
import Data.Fixed
data V2 =
V2 Int
Int
deriving (Eq, Show)
type Region = [V2]
(^-^) :: V2 -> V2 -> V2
(^-^) (V2 x1 y1) (V2 x2 y2) = V2 (x1 - x2) (y1 - y2)
type Rad = Double
parseRegion :: String -> Region
parseRegion =
concatMap... | |
2292a791e4f09bbcc0046418129cab1dabd8cee0d76e2f6b904d1d6d80347737 | Alotor/ghoul-reader | worker.cljs | (ns ghoul.app.worker
(:require-macros [cljs.core.async.macros :refer [go-loop]])
(:require [cljs.core.async :refer [<! timeout]]
[ghoul.app.state :as state]))
(def ^:private refresh-time-milis (atom (* 5 60 1000)))
(def ^:private update-feed-worker (atom nil))
(defn- feed-update [event]
(let [result... | null | https://raw.githubusercontent.com/Alotor/ghoul-reader/ea0f2095e143bfd8a526905761f2cfd87324ad71/src/app/ghoul/app/worker.cljs | clojure | (ns ghoul.app.worker
(:require-macros [cljs.core.async.macros :refer [go-loop]])
(:require [cljs.core.async :refer [<! timeout]]
[ghoul.app.state :as state]))
(def ^:private refresh-time-milis (atom (* 5 60 1000)))
(def ^:private update-feed-worker (atom nil))
(defn- feed-update [event]
(let [result... | |
de6425a00b5c7f08ea858c5227d21f432accb6c1edfe78aa482f5b0f2533fee1 | sionescu/bordeaux-threads | not-implemented.lisp | -*- Mode : LISP ; Syntax : ANSI - Common - lisp ; Base : 10 ; Package : BORDEAUX - THREADS-2 / TEST -*-
The above modeline is required for . Do not change .
(in-package :bordeaux-threads-2/test)
(in-suite :bordeaux-threads-2)
(test not-implemented.whole-function
(let ((*not-implemented* (make-hash-table :test... | null | https://raw.githubusercontent.com/sionescu/bordeaux-threads/f3ab632a6eacc620a6d7bb598a92ca9234ea5939/test/not-implemented.lisp | lisp | Syntax : ANSI - Common - lisp ; Base : 10 ; Package : BORDEAUX - THREADS-2 / TEST -*-
Threads
Locks
Condition variables
Semaphores
| The above modeline is required for . Do not change .
(in-package :bordeaux-threads-2/test)
(in-suite :bordeaux-threads-2)
(test not-implemented.whole-function
(let ((*not-implemented* (make-hash-table :test #'equal))
(op 'acquire-lock)
(feature :some-feature))
(is-true (implemented-p op))
... |
7d5736e3fb1a41bdf417859b4c6d8b57b0dbeb8768c8f7e5b0719a92a11ee2df | graninas/The-Amoeba-World | Render.hs | module Amoeba.View.Output.Render where
import Amoeba.View.Output.Runtime
import Amoeba.GameLogic.Facade
import Amoeba.Middleware.OpenGL.Facade as OGL
import Amoeba.Middleware.GLFW.Facade as GLFW
import qualified Data.Map as M
getColorByPlayer pl | pl = = humanPlayer = white
getColorByPlayer pl | pl = = ai1Playe... | null | https://raw.githubusercontent.com/graninas/The-Amoeba-World/a147cd4dabf860bec8a6ae1c45c02b030916ddf4/src/Amoeba/View/Output/Render.hs | haskell | renderWorldMap (getWorldMap game) | module Amoeba.View.Output.Render where
import Amoeba.View.Output.Runtime
import Amoeba.GameLogic.Facade
import Amoeba.Middleware.OpenGL.Facade as OGL
import Amoeba.Middleware.GLFW.Facade as GLFW
import qualified Data.Map as M
getColorByPlayer pl | pl = = humanPlayer = white
getColorByPlayer pl | pl = = ai1Playe... |
2bf9d8a488b4d4619c0ba2971c6ce6ecada177659210d6f5e25ee7d5203eeba3 | onedata/op-worker | archive_recall_details.erl | %%%-------------------------------------------------------------------
@author
( C ) 2021 ACK CYFRONET AGH
This software is released under the MIT license
cited in ' LICENSE.txt ' .
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% Model for storing details of archi... | null | https://raw.githubusercontent.com/onedata/op-worker/843e4f19d4217dadf63aad0f9eb0030802e3840c/src/modules/datastore/models/archive/archive_recall_details.erl | erlang | -------------------------------------------------------------------
@end
-------------------------------------------------------------------
@doc
Model for storing details of archive recalls.
This model is synchronized between providers.
@end
-------------------------------------------------------------------
AP... | @author
( C ) 2021 ACK CYFRONET AGH
This software is released under the MIT license
cited in ' LICENSE.txt ' .
-module(archive_recall_details).
-author("Michal Stanisz").
-include("modules/datastore/datastore_models.hrl").
-include("modules/datastore/datastore_runner.hrl").
-export([create/2, delete/1]).
... |
ecd32d1ce768dfb040fdd6d400ce87a19321d65605477839ad327e6d9808e7ea | lexi-lambda/mtl-style-example | MainSpec.hs | module MTLStyleExample.MainSpec where
import Data.Function ((&))
import Data.Functor.Identity (runIdentity)
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Test.Hspec
import MTLStyleExample.Main
import MTLStyleExample.Test.Stubs
spec :: Spec
spec = describe "main" $ do
let epoch = posixSecondsToUTCTime... | null | https://raw.githubusercontent.com/lexi-lambda/mtl-style-example/06d06065a8186f2af2ab92e716de906ffa42f22a/test-suite/MTLStyleExample/MainSpec.hs | haskell | module MTLStyleExample.MainSpec where
import Data.Function ((&))
import Data.Functor.Identity (runIdentity)
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Test.Hspec
import MTLStyleExample.Main
import MTLStyleExample.Test.Stubs
spec :: Spec
spec = describe "main" $ do
let epoch = posixSecondsToUTCTime... | |
b81767230fc7020054f1122210e9f42c5729d9c2752b31e18682d86f65ade1f9 | mmottl/gsl-ocaml | wavelet.mli | (** Wavelet Transforms *)
type t
type ws
type kind =
| DAUBECHIES
| DAUBECHIES_CENTERED
| HAAR
| HAAR_CENTERED
| BSPLINE
| BSPLINE_CENTERED
type direction = FORWARD | BACKWARD
val make : kind -> int -> t
external name : t -> string = "ml_gsl_wavelet_name"
val workspace_make : int -> ws
external workspac... | null | https://raw.githubusercontent.com/mmottl/gsl-ocaml/76f8d93cccc1f23084f4a33d3e0a8f1289450580/src/wavelet.mli | ocaml | * Wavelet Transforms |
type t
type ws
type kind =
| DAUBECHIES
| DAUBECHIES_CENTERED
| HAAR
| HAAR_CENTERED
| BSPLINE
| BSPLINE_CENTERED
type direction = FORWARD | BACKWARD
val make : kind -> int -> t
external name : t -> string = "ml_gsl_wavelet_name"
val workspace_make : int -> ws
external workspace_size : ws -> int = "ml_g... |
18ac12636fddc9f546dbe325a20a449b7529d399d2181e219644697fe1a35074 | spawngrid/htoad | special_process.erl | -module(special_process).
-export([start/0, init/1]).
start() ->
proc_lib:start_link(?MODULE, init, [self()]).
init(Parent) ->
proc_lib:init_ack(Parent, {ok, self()}),
loop().
loop() ->
receive
function_clause ->
foo(bar),
loop();
exit ->
exit(byeby... | null | https://raw.githubusercontent.com/spawngrid/htoad/f0c7dfbd911b29fb0c406b7c26606f553af11194/deps/lager/test/special_process.erl | erlang | -module(special_process).
-export([start/0, init/1]).
start() ->
proc_lib:start_link(?MODULE, init, [self()]).
init(Parent) ->
proc_lib:init_ack(Parent, {ok, self()}),
loop().
loop() ->
receive
function_clause ->
foo(bar),
loop();
exit ->
exit(byeby... | |
27951e4a93b79e396a544585ac86f0442ad6232ac435468c73c3b9941e3a1787 | dgtized/shimmers | typography.cljs | (ns shimmers.sketches.typography
(:require
[clojure.string :as str]
[quil.core :as q :include-macros true]
[quil.middleware :as m]
[shimmers.common.framerate :as framerate]
[shimmers.sketch :as sketch :include-macros true]))
(defn setup []
(q/frame-rate 5)
{:text ["This is how the world ends, not ... | null | https://raw.githubusercontent.com/dgtized/shimmers/f096c20d7ebcb9796c7830efcd7e3f24767a46db/src/shimmers/sketches/typography.cljs | clojure | typewriter effect with delays over multiple draw cycles
(q/text-font (rand-nth fonts)) | (ns shimmers.sketches.typography
(:require
[clojure.string :as str]
[quil.core :as q :include-macros true]
[quil.middleware :as m]
[shimmers.common.framerate :as framerate]
[shimmers.sketch :as sketch :include-macros true]))
(defn setup []
(q/frame-rate 5)
{:text ["This is how the world ends, not ... |
64850e341c363ec12b20a827746db4b3a4aa8336e515dd6c406fd4adec993a31 | kowainik/stan | Inspection.hs | |
Copyright : ( c ) 2020 Kowainik
SPDX - License - Identifier : MPL-2.0
Maintainer : < >
_ _ Inspection _ _ — check or test provided by .
Copyright: (c) 2020 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <>
__Inspection__ — check or test provided by Stan.
-}
module Stan.Inspection
*... | null | https://raw.githubusercontent.com/kowainik/stan/da36eac741466fe6f46dc3e56fca7806f8b41816/src/Stan/Inspection.hs | haskell | * Inspection info
* Sorting
* Pretty print
| Sort 'Inspection' by 'Id'
| Find all operators without matching @infix[r|l]@
| Check if the data type has lazy fields
| Pattern matching on @_@ for sum types.
| Replace multiple comparison operations with 'compare'
| Show 'Inspection' in a human-friendly format.
| ... | |
Copyright : ( c ) 2020 Kowainik
SPDX - License - Identifier : MPL-2.0
Maintainer : < >
_ _ Inspection _ _ — check or test provided by .
Copyright: (c) 2020 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <>
__Inspection__ — check or test provided by Stan.
-}
module Stan.Inspection
*... |
70606b0d5b14ae9bc49d07bd584314e203f03bf5216e74734e7182ad8eb0168a | g000001/arc-compat | io.lisp | (in-package :arc-compat.internal)
(in-readtable :common-lisp)
(in-suite arc-compat)
This software is copyright ( c ) and . Permission
to use it is granted under the Perl Foundations 's Artistic License 2.0 .
;;;
Ported to Common Lisp by CHIBA Masaomi .
(def pr args
(map1 #'disp args)
(car args))
(... | null | https://raw.githubusercontent.com/g000001/arc-compat/2506c0717ba5564695af5bd216d6d88236b3b6cd/io.lisp | lisp | (in-package :arc-compat.internal)
(in-readtable :common-lisp)
(in-suite arc-compat)
This software is copyright ( c ) and . Permission
to use it is granted under the Perl Foundations 's Artistic License 2.0 .
Ported to Common Lisp by CHIBA Masaomi .
(def pr args
(map1 #'disp args)
(car args))
(def p... | |
91143ee0b9905d2736982946e6a825fcd1204ff2927127214131ed0c904c73a5 | digital-dj-tools/dj-data-converter | traktor_rekordbox_test.cljc | (ns converter.traktor-rekordbox-test
(:require
#?(:clj [clojure.spec.alpha :as s] :cljs [cljs.spec.alpha :as s])
#?(:clj [clojure.spec.gen.alpha :as gen] :cljs [cljs.spec.gen.alpha :as gen])
[clojure.test :refer [is] #?@(:cljs [:include-macros true])]
[clojure.test.check]
[clojure.test.check.clojure-te... | null | https://raw.githubusercontent.com/digital-dj-tools/dj-data-converter/de1ae5cda60bc64ee3cca1a09b11e1808dd4738a/test/converter/traktor_rekordbox_test.cljc | clojure | (ns converter.traktor-rekordbox-test
(:require
#?(:clj [clojure.spec.alpha :as s] :cljs [cljs.spec.alpha :as s])
#?(:clj [clojure.spec.gen.alpha :as gen] :cljs [cljs.spec.gen.alpha :as gen])
[clojure.test :refer [is] #?@(:cljs [:include-macros true])]
[clojure.test.check]
[clojure.test.check.clojure-te... | |
14664c73944c629d583e54b9e6c67de93247e0094ec31860412d9d56d6331c23 | bravit/hid-examples | evalrpn2.hs | import System.Environment
import EvalRPNTrans
evalPrintExpr :: String -> IO ()
evalPrintExpr str = do
let r = evalRPN str
putStrLn $ str ++ " = " ++ show r
main :: IO ()
main = getArgs >>= mapM_ evalPrintExpr
| null | https://raw.githubusercontent.com/bravit/hid-examples/913e116b7ee9c7971bba10fe70ae0b61bfb9391b/expr/rpn/evalrpn2.hs | haskell | import System.Environment
import EvalRPNTrans
evalPrintExpr :: String -> IO ()
evalPrintExpr str = do
let r = evalRPN str
putStrLn $ str ++ " = " ++ show r
main :: IO ()
main = getArgs >>= mapM_ evalPrintExpr
| |
f873745c55e55a876ac5fdc93fc35c7fab3bb73f32409990dffa77e6054f8679 | smallhadroncollider/taskell-2.0 | ToSerialized.hs | # LANGUAGE TemplateHaskell #
module Taskell.IO.MarkDown.Convert.ToSerialized
( convert
, relatedDictionary
) where
import RIO
import qualified RIO.HashMap as HM
import qualified RIO.List as L
import qualified RIO.Seq as Seq
import qualified Taskell.Error as Error
import qualified Taskell.Data.Taskell as... | null | https://raw.githubusercontent.com/smallhadroncollider/taskell-2.0/6d7cc528143274cd208432353572cc8e3178736b/src/Taskell/IO/MarkDown/Convert/ToSerialized.hs | haskell | contributors
tasks
lists
related
convert | # LANGUAGE TemplateHaskell #
module Taskell.IO.MarkDown.Convert.ToSerialized
( convert
, relatedDictionary
) where
import RIO
import qualified RIO.HashMap as HM
import qualified RIO.List as L
import qualified RIO.Seq as Seq
import qualified Taskell.Error as Error
import qualified Taskell.Data.Taskell as... |
ca422af7f0bddaecc0472342ced37b198308b13a4f03139eeb06ed57c2d47fd3 | buntine/Haskell--Craft-of-FP | ServerState.hs |
Haskell : The Craft of Functional Programming
( c ) Addison - Wesley , 1999 .
The server ADT : its signature is given in comments in the module
-- header.
module ServerState
( ServerState ,
addToQueue, -- Int -> Inmess -> ServerState -> ServerState
ServerState - > ( ServerState , [ ] )
... | null | https://raw.githubusercontent.com/buntine/Haskell--Craft-of-FP/a1a8cd70eb9d1609fd384e608b7fe26b2a878803/Simulation/ServerState.hs | haskell | header.
Int -> Inmess -> ServerState -> ServerState
ServerState -> Int
ServerState -> Int
for the base types of the system
for the queue type
The server consists of a collection of queues, accessed by integers from 0.
A step of the server is given by making a step in each of the constituent
queues, and con... |
Haskell : The Craft of Functional Programming
( c ) Addison - Wesley , 1999 .
The server ADT : its signature is given in comments in the module
module ServerState
( ServerState ,
ServerState - > ( ServerState , [ ] )
ServerState - > Inmess - > ( ServerState , [ ] )
ServerState
) where
... |
62acf8ffdd864b88a2ac5c981297fd2e2314e9ccb699f0d43ee48ae048f291ff | racket/rhombus-prototype | binding.rkt | #lang racket/base
(require (for-syntax racket/base
syntax/parse/pre
enforest/operator
enforest/transformer
enforest/property
enforest/proc-name
enforest/syntax-local
enfores... | null | https://raw.githubusercontent.com/racket/rhombus-prototype/4e66c1361bdde51c2df9332644800baead49e86f/rhombus/private/binding.rkt | racket | To unpack a binding transformer result:
To call an infoer:
To unpack a binding infoer result:
puts pieces together into a `:binding-form`
puts pieces together into a `:binding-info` | #lang racket/base
(require (for-syntax racket/base
syntax/parse/pre
enforest/operator
enforest/transformer
enforest/property
enforest/proc-name
enforest/syntax-local
enfores... |
0b8e840f8ddf2bc1cb5131ddcbada1f7d3ac2dc9c0b1f7f1a138835f74be10d0 | nineties/Choco | Setup.hs | module Main (main) where
import Distribution.Simple
import System.Exit
import System.Cmd
import System.Directory
import Control.Exception
import Control.Monad
main = defaultMain
main = defaultMainWithHooks $
defaultUserHooks {
runTests = runTestScript
}
withCurrentDi... | null | https://raw.githubusercontent.com/nineties/Choco/0081351d0b556ff74f096accb65c9ab45d29ddfe/Setup.hs | haskell | module Main (main) where
import Distribution.Simple
import System.Exit
import System.Cmd
import System.Directory
import Control.Exception
import Control.Monad
main = defaultMain
main = defaultMainWithHooks $
defaultUserHooks {
runTests = runTestScript
}
withCurrentDi... | |
6f6f28bd993538f3881e7bc653d830feea857f5d1fb367dae40812aaef613d3e | haskell-lisp/yale-haskell | instance-manager.scm |
;;; This file has some random utilities dealing with instances.
;;; Right now, this is a linear search off the class.
(define (lookup-instance alg-def class-def)
(let ((res (lookup-instance-1 alg-def (class-instances class-def))))
(if (and (eq? res '#f) (algdata-real-tuple? alg-def))
(lookup-possible-tuple-in... | null | https://raw.githubusercontent.com/haskell-lisp/yale-haskell/4e987026148fe65c323afbc93cd560c07bf06b3f/util/instance-manager.scm | scheme | This file has some random utilities dealing with instances.
Right now, this is a linear search off the class.
I know these are somewhere else too ...
This handles the dynamic linking of instances into classes
clear out any instances sitting around from old compiles
links an instance into the associated class
Thi... |
(define (lookup-instance alg-def class-def)
(let ((res (lookup-instance-1 alg-def (class-instances class-def))))
(if (and (eq? res '#f) (algdata-real-tuple? alg-def))
(lookup-possible-tuple-instances alg-def class-def)
res)))
(define (lookup-instance-1 alg-def instances)
(cond ((null? instances)
'#f)
(... |
88ab9d3cb8c48da5b581c1f952c6650d9a54b66e2fdcf52bca4e1a2ac66bfb5b | THISISDINOSAUR/Anatomy | parser.rkt | #lang brag
a-program : [a-line] (/NEWLINE [a-line])*
@a-line : [a-definition | a-operation | a-utility] [a-comment]
@a-utility : a-print | a-render
a-print : /"print" (a-bone-id | a-expr | a-point-expr | a-section-id)
a-render : /"render" a-bone-id
@a-operation : a-bone-operation | a-section-operation
@a-bone-ope... | null | https://raw.githubusercontent.com/THISISDINOSAUR/Anatomy/883aa140c41cd375575a2944bda79608c660935b/reader/parser.rkt | racket | points can be specified in 2D or 3D | #lang brag
a-program : [a-line] (/NEWLINE [a-line])*
@a-line : [a-definition | a-operation | a-utility] [a-comment]
@a-utility : a-print | a-render
a-print : /"print" (a-bone-id | a-expr | a-point-expr | a-section-id)
a-render : /"render" a-bone-id
@a-operation : a-bone-operation | a-section-operation
@a-bone-ope... |
2044cb708f3d6b88267b9dabaa5aa6bc74bbb34036ba12dba7e85c93672e4f14 | CSCfi/rems | testing.clj | (ns rems.api.testing
"Shared code for API testing"
(:require [clj-time.format :as time-format]
[clojure.string :as str]
[clojure.test :refer :all]
[mount.core :as mount]
[muuntaja.core :as muuntaja]
[rems.db.testing :refer [reset-db-fixture rollback-db-fix... | null | https://raw.githubusercontent.com/CSCfi/rems/af65570a5e5a6102aec4dc85d07d0f6fbb60c18d/test/clj/rems/api/testing.clj | clojure | mount/stop is in test-db-fixture
TODO: silence logging somehow?
Fake login without API key | (ns rems.api.testing
"Shared code for API testing"
(:require [clj-time.format :as time-format]
[clojure.string :as str]
[clojure.test :refer :all]
[mount.core :as mount]
[muuntaja.core :as muuntaja]
[rems.db.testing :refer [reset-db-fixture rollback-db-fix... |
bbc5d29517f13065150c683107fee7c4fb7125fe65fbfbc394af0af3701fc2bf | archaelus/webmachine | webmachine_perf_logger.erl | @author < >
@author < >
2007 - 2008 Basho Technologies
%%
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 ... | null | https://raw.githubusercontent.com/archaelus/webmachine/1d30b6a1763d6a66664f3aff4c811753e7e1a5ed/src/webmachine_perf_logger.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.
limitations under the License.
Seek b... | @author < >
@author < >
2007 - 2008 Basho Technologies
Licensed under the Apache License , Version 2.0 ( the " License " ) ;
distributed under the License is distributed on an " AS IS " BASIS ,
See the License for the specific language governing permissions and
-module(webmachine_perf_logge... |
39483fb3c1d177636938f03962ba225e75f489d7bc5cb4cd45c332bd017cc489 | sneeuwballen/zipperposition | testTerm.ml |
This file is free software , part of Zipperposition . See file " license " for more details .
(** Test terms *)
open Logtk
open Logtk_arbitrary
module T = Term
module H = Helpers
let (==>) = QCheck.(==>)
let t_test = (module T : Alcotest.TESTABLE with type t = T.t)
let ty_test = (module Type : Alcotest.TESTABLE ... | null | https://raw.githubusercontent.com/sneeuwballen/zipperposition/333c4a5b0f8a726f414db901a77ca30921178da5/tests/testTerm.ml | ocaml | * Test terms
unit tests
eta expansion of [g]
WHNF: does not reduce in subterms
Π α. α
ty → ty
apply term of type `Π α. α` to terms of type `ty → ty` and `ty`:
(λx. (λy. f x y)) -> f
(λx. (λy. g y) x) -> g
(λx y. f y x) -> does not reduce
(λx y. h (g x) x y) -> (λx. h (g x) x)
f -> (λx. (λy. f x y)... |
This file is free software , part of Zipperposition . See file " license " for more details .
open Logtk
open Logtk_arbitrary
module T = Term
module H = Helpers
let (==>) = QCheck.(==>)
let t_test = (module T : Alcotest.TESTABLE with type t = T.t)
let ty_test = (module Type : Alcotest.TESTABLE with type t = Type... |
b914d0acf065089dd12d6b65f659d468c4a4dbd3937cf3a6b468e4b1f6977345 | JacquesCarette/Drasil | SourceCodeReaderCI.hs | | Source code reader for all types , classes , and instances in .
-- Only records the names of types and classes, not contents.
-- Meant to show instances of types within classes.
module SourceCodeReaderCI (extractEntryData, EntryData(..)) where
import Data.List
import System.IO
import System.Directory
import quali... | null | https://raw.githubusercontent.com/JacquesCarette/Drasil/cb52c5f5978b92c27c05c06458231774232a174a/code/scripts/SourceCodeReaderCI.hs | haskell | Only records the names of types and classes, not contents.
Meant to show instances of types within classes.
new EntryData data type with strict fields to enforce strict file reading
extracts data, newtype and class names + instances (new data-oriented format)
removes comment lines
strips leading and trailing whit... | | Source code reader for all types , classes , and instances in .
module SourceCodeReaderCI (extractEntryData, EntryData(..)) where
import Data.List
import System.IO
import System.Directory
import qualified Data.Text as T
import DirectoryController as DC (FileName)
type DataName = String
type NewtypeName = String... |
fcfe7b94e73595cef26ebcbdcb0766c26b4e7ac94c3719a32467836a7aef62dc | masaeedu/monoidal | Switch.hs | module Data.Profunctor.Monoidal.Switch where
import Control.Category.Tensor
import Data.Profunctor.Monoidal.Class
import Data.Profunctor
import Data.Void
switch :: Switch p => p a b -> p c d -> p (a × c) (b + d)
switch = curry combineP
universal :: Universal p => p a b
universal = dimap (const ()) absurd $ unitP @(×... | null | https://raw.githubusercontent.com/masaeedu/monoidal/c48fa8745a08bad58e6d37041e59a0e88d10805d/src/Data/Profunctor/Monoidal/Switch.hs | haskell | module Data.Profunctor.Monoidal.Switch where
import Control.Category.Tensor
import Data.Profunctor.Monoidal.Class
import Data.Profunctor
import Data.Void
switch :: Switch p => p a b -> p c d -> p (a × c) (b + d)
switch = curry combineP
universal :: Universal p => p a b
universal = dimap (const ()) absurd $ unitP @(×... | |
2051ad00b1e4d6d1a8665d2069e59bdc688bd7c0ff4d2609ded57e1a188e620b | effectfully-ou/sketches | BackwardsTF.hs | # LANGUAGE AllowAmbiguousTypes #
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
# LANGUAGE FlexibleInstances #
{-# LANGUAGE MagicHash #-}
# LANGUAGE MultiParamTypeClasses #
{-# LANGUAGE ScopedTypeVariables #-}
# LANGUAGE TypeApplications #
# LANGUAGE TypeFamili... | null | https://raw.githubusercontent.com/effectfully-ou/sketches/7b512a529292e8c4bce80526b3f2b938f8cc8e60/avoid-overlapping-recursive/src/BackwardsTF.hs | haskell | # LANGUAGE DataKinds #
# LANGUAGE FlexibleContexts #
# LANGUAGE MagicHash #
# LANGUAGE ScopedTypeVariables # | # LANGUAGE AllowAmbiguousTypes #
# LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE TypeApplications #
# LANGUAGE TypeFamilies #
# LANGUAGE UndecidableInstances #
module BackwardsTF where
import GHC.Exts (Proxy#, proxy#)
data N = Z | S N
type family UnAp... |
1fa3d0bd86cc9e22d58a81a43d50af1d1cf4ed527eb97d274c506e861d8c3f4e | Decentralized-Pictures/T4L3NT | michelson_v1_primitives.ml | (*****************************************************************************)
(* *)
(* Open Source License *)
Copyright ( c ) 2018 Dynamic Ledger Solutions , Inc. < >
Copyright ( c... | null | https://raw.githubusercontent.com/Decentralized-Pictures/T4L3NT/6d4d3edb2d73575384282ad5a633518cba3d29e3/src/proto_012_Psithaca/lib_protocol/michelson_v1_primitives.ml | ocaml | ***************************************************************************
Open Source License
Permission is h... | Copyright ( c ) 2018 Dynamic Ledger Solutions , Inc. < >
Copyright ( c ) 2020 Metastate AG < >
to deal in the Software without restriction , including without limitation
and/or sell copies of the Software , and to permit persons to whom the
THE SOFTWARE IS PROVIDED " AS IS " ,... |
5f808c087cd957cedf8120709217d4745cb870356697a73959edf5299ff05850 | psyeugenic/eplot | eplot_main.erl | %%
Copyright ( C ) 2016
%%
%% File: eplot_main.erl
Author : Björn - Egil Dahlberg
Created : 2016 - 05 - 02
%%
-module(eplot_main).
-export([png/3, view/2]).
png(Inputs, Output, Options0) ->
Options = merge_options(Options0, get_config()),
Data = process_data(parse_data_files(Inputs), Options... | null | https://raw.githubusercontent.com/psyeugenic/eplot/5d0d45b0afd38f10d430e4547cea4fd82f444d7e/src/eplot_main.erl | erlang |
File: eplot_main.erl
expected string is 'number()<whitespace(s)>number()' | Copyright ( C ) 2016
Author : Björn - Egil Dahlberg
Created : 2016 - 05 - 02
-module(eplot_main).
-export([png/3, view/2]).
png(Inputs, Output, Options0) ->
Options = merge_options(Options0, get_config()),
Data = process_data(parse_data_files(Inputs), Options),
B = graph_binary(propli... |
1769a2553c0fdea548c0014e9704cb2f8b034b51aeef04e537b3c58a54029cf2 | YoshikuniJujo/test_haskell | try-loading-models.hs | # LANGUAGE TemplateHaskell , QuasiQuotes #
# , LambdaCase , OverloadedStrings #
# LANGUAGE ScopedTypeVariables , RankNTypes , TypeApplications #
# LANGUAGE GADTs , TypeFamilies #
# LANGUAGE DataKinds , PolyKinds #
# LANGUAGE TypeOperators #
# LANGUAGE MultiParamTypeClasses , AllowAmbiguousTypes #
# LANGUAGE FlexibleC... | null | https://raw.githubusercontent.com/YoshikuniJujo/test_haskell/37eb9675bf1c0b008c7af4843713c91623c1e7f4/themes/gui/vulkan/try-my-vulkan-snd/app/try-loading-models.hs | haskell | # LANGUAGE PatternSynonyms, ViewPatterns # | # LANGUAGE TemplateHaskell , QuasiQuotes #
# , LambdaCase , OverloadedStrings #
# LANGUAGE ScopedTypeVariables , RankNTypes , TypeApplications #
# LANGUAGE GADTs , TypeFamilies #
# LANGUAGE DataKinds , PolyKinds #
# LANGUAGE TypeOperators #
# LANGUAGE MultiParamTypeClasses , AllowAmbiguousTypes #
# LANGUAGE FlexibleC... |
d8ff6281eed15debcc2a51ece58d89d27267e34c1b40ec6060e59beca9589bfb | zwizwa/staapl | rpn.rkt | #lang racket/base
(require "rpn/main.rkt"
"rpn/forms.rkt")
(provide (all-from-out
"rpn/main.rkt"
"rpn/forms.rkt"
))
| null | https://raw.githubusercontent.com/zwizwa/staapl/e30e6ae6ac45de7141b97ad3cebf9b5a51bcda52/rpn.rkt | racket | #lang racket/base
(require "rpn/main.rkt"
"rpn/forms.rkt")
(provide (all-from-out
"rpn/main.rkt"
"rpn/forms.rkt"
))
| |
466732bed57f8bd4c8377ecba8b6bdbbb3b68ff7e96ba2576e7160d877b9fcdd | camfort/fortran-src | Complex.hs | -- | Supporting definitions for COMPLEX literals.
module Language.Fortran.AST.Literal.Complex where
import Language.Fortran.AST.Common ( Name )
import Language.Fortran.AST.Literal ( KindParam )
import Language.Fortran.AST.Literal.Real
import Language.Fortran.Util.Position ( SrcSpan, Spanned )
import GHC.Generics ... | null | https://raw.githubusercontent.com/camfort/fortran-src/57a1b7b3514ccfea82081da658bf5b73dccf59a4/src/Language/Fortran/AST/Literal/Complex.hs | haskell | | Supporting definitions for COMPLEX literals.
| A COMPLEX literal, composed of a real part and an imaginary part.
various contexts. To support all that, we define the syntactic structure
'ComplexLit' to wrap all the parsing rules. Then during a analysis pass, you
@(Double, Double)@ tuple.
| A part (either real ... |
module Language.Fortran.AST.Literal.Complex where
import Language.Fortran.AST.Common ( Name )
import Language.Fortran.AST.Literal ( KindParam )
import Language.Fortran.AST.Literal.Real
import Language.Fortran.Util.Position ( SrcSpan, Spanned )
import GHC.Generics ( Generic )
import Data.Data ... |
355647de349b465bca7fdad80efca999a4b729cfc4ddfc7767aa3258ad2053a4 | magnars/optimus | optimizations.clj | (ns optimus.optimizations
(:require [optimus.optimizations.add-cache-busted-expires-headers]
[optimus.optimizations.concatenate-bundles]
[optimus.optimizations.minify]
[optimus.optimizations.add-last-modified-headers]
[optimus.optimizations.inline-css-imports]
... | null | https://raw.githubusercontent.com/magnars/optimus/ac5df602726d255312dfd48cf7ae2e00d99069bd/src/optimus/optimizations.clj | clojure | (ns optimus.optimizations
(:require [optimus.optimizations.add-cache-busted-expires-headers]
[optimus.optimizations.concatenate-bundles]
[optimus.optimizations.minify]
[optimus.optimizations.add-last-modified-headers]
[optimus.optimizations.inline-css-imports]
... | |
bf4e7639dba2da2c9f051d3f3bd5525282b8e24c75be509afb0cb998e61132e4 | ekoontz/menard | path.clj | (ns menard.path)
(defn use-path [path]
(if (System/getenv "MODEL_URL")
(str (System/getenv "MODEL_URL") path)
(str "" path)))
| null | https://raw.githubusercontent.com/ekoontz/menard/b536dc3fe16663a8fe41c53e4884e4578630b863/src/menard/path.clj | clojure | (ns menard.path)
(defn use-path [path]
(if (System/getenv "MODEL_URL")
(str (System/getenv "MODEL_URL") path)
(str "" path)))
| |
a2a2bc7348d5a139c302c47a454132f535397b55cbb604331ccaf29f5ad84a2d | BinaryAnalysisPlatform/bap | primus_region_main.ml | open Core_kernel[@@warning "-D"]
open Bap_core_theory
open Bap.Std
open Bap_primus.Std
include Self()
module Region = struct
type point = Primus.Value.t [@@deriving compare, sexp_of]
type t = {
lower : point;
upper : point;
} [@@deriving compare, fields, sexp_of]
end
module Regions = Interval_tree.Make... | null | https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/cbdf732d46c8e38df79d9942fc49bcb97915c657/plugins/primus_region/primus_region_main.ml | ocaml | open Core_kernel[@@warning "-D"]
open Bap_core_theory
open Bap.Std
open Bap_primus.Std
include Self()
module Region = struct
type point = Primus.Value.t [@@deriving compare, sexp_of]
type t = {
lower : point;
upper : point;
} [@@deriving compare, fields, sexp_of]
end
module Regions = Interval_tree.Make... | |
69592a2baab420cae4302505d7ae6960583067908bd3d1bcab93e2da9a1e51c9 | intermine/bluegenes | list_dropdown.cljs | (ns bluegenes.components.ui.list_dropdown
(:require [re-frame.core :refer [subscribe]]
[reagent.core :as reagent]
[oops.core :refer [oget]]
[goog.string :as gstring]))
(defn has-text?
"Returns true if the details vector contains a string"
[string details]
(if string
(re-... | null | https://raw.githubusercontent.com/intermine/bluegenes/f2c291dd4b32122329d5561c01e26a70eaa3186e/src/cljs/bluegenes/components/ui/list_dropdown.cljs | clojure | (ns bluegenes.components.ui.list_dropdown
(:require [re-frame.core :refer [subscribe]]
[reagent.core :as reagent]
[oops.core :refer [oget]]
[goog.string :as gstring]))
(defn has-text?
"Returns true if the details vector contains a string"
[string details]
(if string
(re-... | |
e433cb5f0e24fe76e6562e64f2dc5277d0ad3b62521629448197b3b805b5a4a4 | alex-hhh/data-frame | df-test.rkt | #lang racket/base
;; df-test.rkt -- tests for data-frame.rkt
;;
;; This file is part of data-frame -- -hhh/data-frame
Copyright ( c ) 2018 , 2020 , 2021 < >
;;
;; This program is free software: you can redistribute it and/or modify it
;; under the terms of the GNU Lesser General Public License as publish... | null | https://raw.githubusercontent.com/alex-hhh/data-frame/5230adcbf26d3a54a0ca45f52a559906640f6f8e/private/test/df-test.rkt | racket | df-test.rkt -- tests for data-frame.rkt
This file is part of data-frame -- -hhh/data-frame
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
option) any later version.
This program is distributed in the hope ... | #lang racket/base
Copyright ( c ) 2018 , 2020 , 2021 < >
the Free Software Foundation , either version 3 of the License , or ( at your
You should have received a copy of the GNU Lesser General Public License
(require rackunit
racket/math
racket/list
racket/base
... |
bf167aa5fc59097ed73165d8d730b8bdfa7a71712474b2419a9520da34d160ad | onedata/op-worker | harvesting_destination.erl | %%%-------------------------------------------------------------------
@author
( C ) 2019 ACK CYFRONET AGH
This software is released under the MIT license
cited in ' LICENSE.txt ' .
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% Helper module used by modules asso... | null | https://raw.githubusercontent.com/onedata/op-worker/b09f05b6928121cec4d6b41ce8037fe056e6b4b3/src/modules/harvesting/utils/harvesting_destination.erl | erlang | -------------------------------------------------------------------
@end
-------------------------------------------------------------------
@doc
Helper module used by modules associated with harvesting.
Destination is a map:
#{Harvester :: od_harvester:id() => Indices :: [od_harvester:index()]}
where:
* Ind... | @author
( C ) 2019 ACK CYFRONET AGH
This software is released under the MIT license
cited in ' LICENSE.txt ' .
* - an external service that is responsible for
performing data discovery on submitted data , i.e. ElasticSearch .
-module(harvesting_destination).
-author("Jakub Kudzia").
-include(... |
7266048bb3c62142b3911d810504c482248217778258c5f41057d534e08d4e5f | ghc/packages-Cabal | Parsec.hs | module Distribution.Client.Utils.Parsec (
renderParseError,
) where
import Distribution.Client.Compat.Prelude
import Prelude ()
import System.FilePath (normalise)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
import Distribution.Parsec (PE... | null | https://raw.githubusercontent.com/ghc/packages-Cabal/6f22f2a789fa23edb210a2591d74ea6a5f767872/cabal-install/Distribution/Client/Utils/Parsec.hs | haskell | | Render parse error highlighting the part of the input file.
lines of the input file. 'lines' is taken, so they are called rows
contents, line number, whether it's empty line
empty
comment
sometimes there are (especially trailing) newlines.
format line: prepend the given line number
error line
pointer: ^
do ... | module Distribution.Client.Utils.Parsec (
renderParseError,
) where
import Distribution.Client.Compat.Prelude
import Prelude ()
import System.FilePath (normalise)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
import Distribution.Parsec (PE... |
68580f6eb9641020ebed5e7d4c2f982a32a8392c3a76447101916086c419fcd0 | jagajaga/my_configs | zenbook_xmonad.hs | import qualified Data.Map as M
import Graphics.X11.ExtraTypes.XF86
import Graphics.X11.Types
import Prelude
import System.Exit
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Actions.GridSelect
import XMonad.Ac... | null | https://raw.githubusercontent.com/jagajaga/my_configs/d64c7a11f9581c715241744040b5976809909b04/.xmonad/zenbook_xmonad.hs | haskell | -----------------------------------------------------------------------------
Configs --
-----------------------------------------------------------------------------
Window Management --
> doFullFloat
> doFloat
> doShift "Steam"
> doCenterFloat
> [ > doIgnore < + > < ] ( doRectFloat $ W.RationalRect 0 ( 17/900 ) 1 ... | import qualified Data.Map as M
import Graphics.X11.ExtraTypes.XF86
import Graphics.X11.Types
import Prelude
import System.Exit
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Actions.GridSelect
import XMonad.Ac... |
659091d6d808223d81c55c5b20a0335964058cf6e0a9aceb7dedaa9ab4cf5c33 | Erdwolf/prolog | Syntax.hs | # LANGUAGE DeriveDataTypeable , ViewPatterns , ScopedTypeVariables #
module Syntax
( Term(..), var, cut
, Clause(..), rhs
, VariableName(..), Atom, Goal, Program
, cons, nil, foldr_pl
, arguments -- FIXME Should not be exposed
, hierarchy
, Operator(..), Assoc(..)
)
where
import Data.Generics (... | null | https://raw.githubusercontent.com/Erdwolf/prolog/d6ee4b35be2a0b29f0a2db404a90f0d241d97a6c/src/Syntax.hs | haskell | FIXME Should not be exposed
Non-associative
case guard (isNil rest) >> sequence (map toChar ts) of
Just str -> prettyPrint str
Nothing ->
used for quasi quotation
x \\ y = Struct "\\" [x,y]
arguments ts xs ds = [ xs \\ ds ] ++ ts | # LANGUAGE DeriveDataTypeable , ViewPatterns , ScopedTypeVariables #
module Syntax
( Term(..), var, cut
, Clause(..), rhs
, VariableName(..), Atom, Goal, Program
, cons, nil, foldr_pl
, hierarchy
, Operator(..), Assoc(..)
)
where
import Data.Generics (Data(..), Typeable(..))
import Data.List (inte... |
1f3217f013d7297f4a8926bd6bb935a1152b5fc98a74723e4658c2aeafa448bc | janestreet/ocaml_plugin | dynloader.ml | open! Core
open! Async
module E = Deferred.Or_error
let default_disabled_warnings = [ 4; 29; 40; 41; 42; 44; 45; 48; 58; 66; 69; 70 ]
(* The default policy about warnings *)
let warnings_spec ~disabled_warnings =
let ignores =
List.map disabled_warnings ~f:(fun i -> "-" ^ Int.to_string i) |> String.concat
in
... | null | https://raw.githubusercontent.com/janestreet/ocaml_plugin/8f167657ce5dd3e9dbb0f0e28c7243a1946d86c0/src/dynloader.ml | ocaml | The default policy about warnings
Default values to use for those binaries if their path is not specified.
every t has a different compilation directory
if t.compilation_config failed, then either we couldn't create the temporary
directory, in which case there is nothing to clean, or we failed after in
... | open! Core
open! Async
module E = Deferred.Or_error
let default_disabled_warnings = [ 4; 29; 40; 41; 42; 44; 45; 48; 58; 66; 69; 70 ]
let warnings_spec ~disabled_warnings =
let ignores =
List.map disabled_warnings ~f:(fun i -> "-" ^ Int.to_string i) |> String.concat
in
"+a" ^ ignores
;;
let default_warning... |
d5779eadb328e8283b5364c657531efaf8bfa9ee3ccacfb6127cf9ab50c3b24f | kowainik/stan | Config.hs | module Test.Stan.Config
( configSpec
) where
import Hedgehog (forAll, (===))
import Test.Hspec (Spec, describe, it, parallel, shouldBe)
import Test.Hspec.Hedgehog (hedgehog)
import Stan.Config (Check (..), CheckFilter (..), CheckType (..), Config, ConfigP (..), Scope (..),
applyChecks, app... | null | https://raw.githubusercontent.com/kowainik/stan/da36eac741466fe6f46dc3e56fca7806f8b41816/test/Test/Stan/Config.hs | haskell | module Test.Stan.Config
( configSpec
) where
import Hedgehog (forAll, (===))
import Test.Hspec (Spec, describe, it, parallel, shouldBe)
import Test.Hspec.Hedgehog (hedgehog)
import Stan.Config (Check (..), CheckFilter (..), CheckType (..), Config, ConfigP (..), Scope (..),
applyChecks, app... | |
ab19e3dbce727bf6500716822c5bfea8b99b7e29adcbe50d7194ea0cb9f1c484 | kelsey-sorrels/robinson | core.clj | ;; ## A roguelike focused on immutability.##
;;
;(set! *warn-on-reflection* true)
(ns robinson.core
(:require [robinson.main :as main]
[zaffre.terminal :as zt]
[zaffre.glterminal :as zgl]
[zaffre.components :as zc]
[zaffre.components.events :as zce]
[zaffre.... | null | https://raw.githubusercontent.com/kelsey-sorrels/robinson/337fd2646882708331257d1f3db78a3074ccc67a/src/robinson/core.clj | clojure | ## A roguelike focused on immutability.##
(set! *warn-on-reflection* true)
Conveinience ref for accessing the last state when in repl.
(robinson.core/-main)
start with initial state from setup-fn
(zt/refresh! terminal)
update component instance states
tick the old state through the tick-fn to get the new state | (ns robinson.core
(:require [robinson.main :as main]
[zaffre.terminal :as zt]
[zaffre.glterminal :as zgl]
[zaffre.components :as zc]
[zaffre.components.events :as zce]
[zaffre.components.render :as zcr]
[zaffre.tilesets :as ztiles]
[r... |
cb7f5af268090dcc75897ec431615ef5abb82542e4a0c4a2d985bdffd22265c1 | Liutos/Project-Euler | pro34.lisp | (proclaim '(optimize speed))
(defun factorial (n)
(labels ((rec (acc cur)
(if (> cur n)
acc
(rec (* acc cur) (1+ cur)))))
(rec 1 2)))
(defvar *lsbs* '(1 1 2 6 4 0 0 0 0 0))
初步判断一个数是否可能满足curiousp谓词
(defun curiousp/simple-judge (n)
(let ((lsb (rem n 10)))
(labels ((rec (acc rest)
(con... | null | https://raw.githubusercontent.com/Liutos/Project-Euler/dd59940099ae37f971df1d74c4b7c78131fd5470/lisp/pro34.lisp | lisp | (proclaim '(optimize speed))
(defun factorial (n)
(labels ((rec (acc cur)
(if (> cur n)
acc
(rec (* acc cur) (1+ cur)))))
(rec 1 2)))
(defvar *lsbs* '(1 1 2 6 4 0 0 0 0 0))
初步判断一个数是否可能满足curiousp谓词
(defun curiousp/simple-judge (n)
(let ((lsb (rem n 10)))
(labels ((rec (acc rest)
(con... | |
ec64064b8ad732d740e2efcfdff829b11c76dbd5d7bdb3befaaeb3f018ef6008 | buildsome/buildsome | Chart.hs | # LANGUAGE CPP #
module Buildsome.Chart
( make
) where
import Prelude.Compat hiding (FilePath)
import Buildsome.Stats (Stats(..))
import Data.ByteString (ByteString)
import Data.Map (Map)
import Data.Monoid ((<>))
import Lib.FilePath (FilePath)
import qualified Buildsome.BuildMaps as BuildMaps
import qualified Bu... | null | https://raw.githubusercontent.com/buildsome/buildsome/479b92bb74a474a5f0c3292b79202cc850bd8653/src/Buildsome/Chart.hs | haskell | # LANGUAGE CPP #
module Buildsome.Chart
( make
) where
import Prelude.Compat hiding (FilePath)
import Buildsome.Stats (Stats(..))
import Data.ByteString (ByteString)
import Data.Map (Map)
import Data.Monoid ((<>))
import Lib.FilePath (FilePath)
import qualified Buildsome.BuildMaps as BuildMaps
import qualified Bu... | |
8cf40195801a4ddbfadb3a24964a30067b3ed8dd3f85c0453124bd4d73318bf8 | valderman/selda | Migrations.hs | # LANGUAGE OverloadedStrings , GADTs , FlexibleContexts #
| Functionality for upgrading a table from one schema to another .
module Database.Selda.Migrations
( Migration (..)
, migrate, migrateM, migrateAll, autoMigrate
) where
import Control.Monad (void, when)
import Control.Monad.Catch ( MonadMask, MonadThrow... | null | https://raw.githubusercontent.com/valderman/selda/c270f354caaa733d10b79d5c0ba05f98f56fa4b6/selda/src/Database/Selda/Migrations.hs | haskell | | Wrapper for user with 'migrateAll', enabling multiple migrations to be
packed into the same list:
> migrateAll
> [ Migration m1_from m1_to m1_upgrade
> , ...
> ]
a single transaction in order to keep the database consistent.
migrate all records to the new schema.
Both table schemas are validat... | # LANGUAGE OverloadedStrings , GADTs , FlexibleContexts #
| Functionality for upgrading a table from one schema to another .
module Database.Selda.Migrations
( Migration (..)
, migrate, migrateM, migrateAll, autoMigrate
) where
import Control.Monad (void, when)
import Control.Monad.Catch ( MonadMask, MonadThrow... |
e1de0059b1d9326628e824ff80bd8d6158385910c78201d76e16d8d5b76c0e59 | vascokk/rivus_cep | rivus_cep_sup.erl | %%------------------------------------------------------------------------------
Copyright ( c ) 2013
%%
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 ... | null | https://raw.githubusercontent.com/vascokk/rivus_cep/e9fe6ed79201d852065f7fb2a24a880414031d27/src/rivus_cep_sup.erl | erlang | ------------------------------------------------------------------------------
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-2.0
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe... | Copyright ( c ) 2013
Licensed under the Apache License , Version 2.0 ( the " License " ) ;
distributed under the License is distributed on an " AS IS " BASIS ,
-module(rivus_cep_sup).
-behaviour(supervisor).
-compile([{parse_transform, lager_transform}]).
-export([start_link/0]).
-export([init/1]).
start_l... |
f9954ba71a7c0b7e65a22d3b9dc5b1ee9848982e658c7a3783527377a4656908 | jepsen-io/mongodb | client.clj | (ns jepsen.mongodb.client
"Wraps the MongoDB Java client."
(:require [clojure.walk :as walk]
[clojure.tools.logging :refer [info warn]]
[dom-top.core :refer [assert+]]
[jepsen [util :as util :refer [timeout]]]
[slingshot.slingshot :refer [try+ throw+]]
[wa... | null | https://raw.githubusercontent.com/jepsen-io/mongodb/85a13e338ac4a833a0c7c502cc0dab9aa3d99e91/src/jepsen/mongodb/client.clj | clojure | Basic node manipulation
(info "Connecting to" (str host ":" port))
(.first (.listDatabaseNames conn))
Don't leak clients when they fail
Basic plumbing
Write Concerns
we weaken it to
Error handling
takes an operation and returns a :fail or :info op
What was this message?
(assoc ~op :type :info, :error :mongo-tim... | (ns jepsen.mongodb.client
"Wraps the MongoDB Java client."
(:require [clojure.walk :as walk]
[clojure.tools.logging :refer [info warn]]
[dom-top.core :refer [assert+]]
[jepsen [util :as util :refer [timeout]]]
[slingshot.slingshot :refer [try+ throw+]]
[wa... |
8f875c770fbc0784bdec1b9358b0d5c0f6e4ccbed89c6c1eb84cb1cc94055d96 | wdebeaum/step | various.lisp | ;;;;
;;;; W::VARIOUS
;;;;
(define-words :pos W::quan :boost-word t
:words (
(W::VARIOUS
(wordfeats (W::status ont::indefinite-plural))
(SENSES
(
(meta-data :origin monroe :entry-date 20031223 :change-date nil :comments s7)
(LF ONT::SEVERAL)
(non-hierarchy-lf t)(TEMPL quan-cardinality-pl-con... | null | https://raw.githubusercontent.com/wdebeaum/step/f38c07d9cd3a58d0e0183159d4445de9a0eafe26/src/LexiconManager/Data/new/various.lisp | lisp |
W::VARIOUS
|
(define-words :pos W::quan :boost-word t
:words (
(W::VARIOUS
(wordfeats (W::status ont::indefinite-plural))
(SENSES
(
(meta-data :origin monroe :entry-date 20031223 :change-date nil :comments s7)
(LF ONT::SEVERAL)
(non-hierarchy-lf t)(TEMPL quan-cardinality-pl-convertable-templ)
)
... |
3f62fa28cbe242952692a263b3cafbe545a103ee79071ace16fc62bb676c1af0 | pwrobinson/concurrent-hashtable | Spec.hs | # LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE ScopedTypeVariables #
import Control.Monad
import Data.IORef
import Data.Maybe
import qualified Data.Map.Strict as M
import Test.QuickCheck as QC
import Test.QuickCheck.Monadic as QC
import Prelude hiding (lookup)
import qualified Dat... | null | https://raw.githubusercontent.com/pwrobinson/concurrent-hashtable/19b764fe9ac754b693b7403493ad5c3c1e7a5a3d/test/Spec.hs | haskell | | Restrict the keys to be ints from small positive range
test if all entries in the Map are also in the Hash Table:
test if there aren't any duplicates in the Hash Table:
test if all entries in the Hash Table are also in the Map: | # LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE ScopedTypeVariables #
import Control.Monad
import Data.IORef
import Data.Maybe
import qualified Data.Map.Strict as M
import Test.QuickCheck as QC
import Test.QuickCheck.Monadic as QC
import Prelude hiding (lookup)
import qualified Dat... |
c4922178f343a78809ff061c87bd556721d68d4c2b70cb61e18ee53aa36063eb | AdaCore/why3 | encoding_guards_full.ml | (********************************************************************)
(* *)
The Why3 Verification Platform / The Why3 Development Team
Copyright 2010 - 2022 -- Inria - CNRS - Paris - Saclay University
(* ... | null | https://raw.githubusercontent.com/AdaCore/why3/03f27e383b7191f9df0c7df84016a6450603f864/src/transform/encoding_guards_full.ml | ocaml | ******************************************************************
This software is distributed under the terms of the GNU Lesser
on linking described in file LICENSE. ... | The Why3 Verification Platform / The Why3 Development Team
Copyright 2010 - 2022 -- Inria - CNRS - Paris - Saclay University
General Public License version 2.1 , with the special exception
open Wstdlib
open Ident
open Ty
open Term
open Decl
open Task
open Libencoding
module Debug = struct
le... |
d34c6b9de3472fd16fe8b8290221aca35be9a5b8260c48f082aff0092e93f6af | realworldocaml/book | code_matcher.mli | (** Match source code against generated code *)
open! Import
val match_structure_res :
pos:Lexing.position ->
expected:structure ->
mismatch_handler:(Location.t -> structure -> unit) ->
structure ->
(unit, Location.Error.t NonEmptyList.t) result
(** Checks that the given code starts with [expected] followed... | null | https://raw.githubusercontent.com/realworldocaml/book/d822fd065f19dbb6324bf83e0143bc73fd77dbf9/duniverse/ppxlib/src/code_matcher.mli | ocaml | * Match source code against generated code
* Checks that the given code starts with [expected] followed by
[@@@deriving.end] or [@@@end].
Returns an error if there is no [@@@deriving.end].
If some items don't match, it calls [mismatch_handler] with the location of
the source items and the expected co... |
open! Import
val match_structure_res :
pos:Lexing.position ->
expected:structure ->
mismatch_handler:(Location.t -> structure -> unit) ->
structure ->
(unit, Location.Error.t NonEmptyList.t) result
val match_structure :
pos:Lexing.position ->
expected:structure ->
mismatch_handler:(Location.t -> stru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.