_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 |
|---|---|---|---|---|---|---|---|---|
1e4b6e09f55452e46cf2d6d5e98191f270846dc67b95bb281642a8a299d74059 | turquoise-hexagon/euler | solution.scm | (import
(chicken fixnum)
(euler))
(define-constant limit #e5e6)
(define factorials (list->vector (map factorial (range 0 9))))
(define (f n)
(let loop ((n n) (acc 0))
(if (fx= n 0)
acc
(loop (fx/ n 10) (fx+ acc (vector-ref factorials (fxmod n 10)))))))
(define chain
(let ((cache (make-vector... | null | https://raw.githubusercontent.com/turquoise-hexagon/euler/46f1ec42385096a704bfe66e201c70b3fae8d306/src/074/solution.scm | scheme | (import
(chicken fixnum)
(euler))
(define-constant limit #e5e6)
(define factorials (list->vector (map factorial (range 0 9))))
(define (f n)
(let loop ((n n) (acc 0))
(if (fx= n 0)
acc
(loop (fx/ n 10) (fx+ acc (vector-ref factorials (fxmod n 10)))))))
(define chain
(let ((cache (make-vector... | |
98782f55715e98de646b3bc0f96153c984c8f04c17572c4c798d2d707e9698d0 | slyrus/clem | test-gaussian-convolve-1.lisp |
(in-package :matrix)
(let ((x (normalize (random-matrix 3 3)))
(h (matrix::gaussian-kernel 2 1)))
(print-matrix x)
; (print-matrix h)
; (print (sum h))
(let* ((rowstart (floor (/ (1- (matrix::rows h)) 2)))
(rowend (floor (/ (matrix::rows h) 2)))
(colstart (floor (/ (1- (matrix::cols h)) 2)))
(... | null | https://raw.githubusercontent.com/slyrus/clem/5eb055bb3f45840b24fd44825b975aa36bd6d97c/test/test-gaussian-convolve-1.lisp | lisp | (print-matrix h)
(print (sum h))
(in-package :cl-user)
(defvar h)
(matrix::print-matrix (matrix::gradmag h)) |
(in-package :matrix)
(let ((x (normalize (random-matrix 3 3)))
(h (matrix::gaussian-kernel 2 1)))
(print-matrix x)
(let* ((rowstart (floor (/ (1- (matrix::rows h)) 2)))
(rowend (floor (/ (matrix::rows h) 2)))
(colstart (floor (/ (1- (matrix::cols h)) 2)))
(colend (floor (/ (matrix::cols h) 2)))
... |
282ca87c410100486fdd3ac3d82619e46145bd7e3a1c988a56f172f1f1b215c2 | ygrek/mldonkey | hashtbl2.mli | Copyright 2001 , 2002 b8_bavard , b8_fee_carabine ,
This file is part of mldonkey .
mldonkey is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
... | null | https://raw.githubusercontent.com/ygrek/mldonkey/333868a12bb6cd25fed49391dd2c3a767741cb51/src/utils/cdk/hashtbl2.mli | ocaml | can be used with a function that can modify the hashtbl
(* Module [Hashtbl2]: hash tables and hash functions
Hash tables are hashed association tables, with in-place modification.
** Generic interface
The type of hash tables from type ['a] to type ['b].
[Hashtbl.create n] creates a new, empty hash table, wit... | Copyright 2001 , 2002 b8_bavard , b8_fee_carabine ,
This file is part of mldonkey .
mldonkey is free software ; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
... |
e5f1a05b030004dab40264c52413568842aa9c99bf06f8386f192efee4186f50 | dsheets/ocaml-unix-errno | errno.mli |
* Copyright ( c ) 2014 - 2015 < >
*
* 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/dsheets/ocaml-unix-errno/0878418c45e25b5a1fb0a461ce8e55d67c5c42ab/lib/errno.mli | ocaml | * NB: This module registers a printer for the [Error] exception. |
* Copyright ( c ) 2014 - 2015 < >
*
* 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... |
1a8b1a72797629e6f9dd9a01d6abf9a5286ce3ba9d6fe8fc66d3918c112c29c1 | earl-ducaine/cl-garnet | formulas.lisp | (setf garnetdraw::*DRAW-AGG*
(create-instance 'FORMULAS OPAL:AGGREGADGET
(:LEFT 0)
(:TOP 0)
(:WIDTH (o-formula (GVL :WINDOW :WIDTH) 680))
(:HEIGHT (o-formula (GVL :WINDOW :HEIGHT) 410))
(:CONSTANT `(:COMPONENTS ))
(:FUNCTION-FOR-OK NIL)
(:EXPORT-P T)
(:WINDOW-TITLE "FORMULAS FIGURE")
(:PACKAGE-NAME "U... | null | https://raw.githubusercontent.com/earl-ducaine/cl-garnet/f0095848513ba69c370ed1dc51ee01f0bb4dd108/doc/previous-version/src/kr/garnet-code/formulas.lisp | lisp | (setf garnetdraw::*DRAW-AGG*
(create-instance 'FORMULAS OPAL:AGGREGADGET
(:LEFT 0)
(:TOP 0)
(:WIDTH (o-formula (GVL :WINDOW :WIDTH) 680))
(:HEIGHT (o-formula (GVL :WINDOW :HEIGHT) 410))
(:CONSTANT `(:COMPONENTS ))
(:FUNCTION-FOR-OK NIL)
(:EXPORT-P T)
(:WINDOW-TITLE "FORMULAS FIGURE")
(:PACKAGE-NAME "U... | |
7e167abd6deb10cce58fc14adb9604bf7265233b7340574c823af716275e27be | erlyaws/yaws | basic_echo_callback.erl | %%%===========================================================
%%% compiled using erlc -I include src/basic_echo_callback.erl
%%%===========================================================
-module(basic_echo_callback).
%% Export for websocket callbacks
-export([handle_message/1]).
%% Export for apply
-export([say_hi... | null | https://raw.githubusercontent.com/erlyaws/yaws/da198c828e9d95ca2137da7884cddadd73941d13/examples/src/basic_echo_callback.erl | erlang | ===========================================================
compiled using erlc -I include src/basic_echo_callback.erl
===========================================================
Export for websocket callbacks
Export for apply |
-module(basic_echo_callback).
-export([handle_message/1]).
-export([say_hi/1]).
handle_message({text, <<"bye">>}) ->
io:format("User said bye.~n", []),
{close, normal};
handle_message({text, <<"something">>}) ->
io:format("Some action without a reply~n", []),
noreply;
handle_message({text, <<"say ... |
c8399ea8869250c150a2b639aa43df60a76021ac92e37e5edb27aff75d4d320e | facebookarchive/pfff | class_type.ml | class type t_item = object
method sel : bool
end
| null | https://raw.githubusercontent.com/facebookarchive/pfff/ec21095ab7d445559576513a63314e794378c367/tests/ml/parsing/class_type.ml | ocaml | class type t_item = object
method sel : bool
end
| |
9bc59de37d6eca038eba421cffb133e32bfe4fde70c4cf0fac63fc02b304a24c | ucsd-progsys/nate | unixLabels.mli | (***********************************************************************)
(* *)
(* Objective Caml *)
(* *)
, projet ... | null | https://raw.githubusercontent.com/ucsd-progsys/nate/8b1267cd8b10283d8bc239d16a28c654a4cb8942/eval/sherrloc/easyocaml%2B%2B/otherlibs/unix/unixLabels.mli | ocaml | *********************************************************************
Objective Caml
... | , projet Cristal , INRIA Rocquencourt
Copyright 1996 Institut National de Recherche en Informatique et
en Automatique . All rights reserved . This file is distributed
under the terms of the GNU Library General Public License , with
$ I d : unixLabels.mli , v 1.15.4.1 2... |
8038c261e2957abbd66966c5b616f6536f2c69f613639fa51d2c11f57013aefb | mbutterick/beautiful-racket | stackerizer.rkt | #lang br/quicklang
(provide + *)
(define-macro (stackerizer-mb EXPR)
#'(#%module-begin
(for-each displayln (reverse (flatten EXPR)))))
(provide (rename-out [stackerizer-mb #%module-begin]))
(define-macro (define-ops OP ...)
#'(begin
(define-macro-cases OP
[(OP FIRST) #'FIRST]
[(OP FIRST... | null | https://raw.githubusercontent.com/mbutterick/beautiful-racket/f0e2cb5b325733b3f9cbd554cc7d2bb236af9ee9/beautiful-racket-demo/stackerizer-demo/stackerizer.rkt | racket | #lang br/quicklang
(provide + *)
(define-macro (stackerizer-mb EXPR)
#'(#%module-begin
(for-each displayln (reverse (flatten EXPR)))))
(provide (rename-out [stackerizer-mb #%module-begin]))
(define-macro (define-ops OP ...)
#'(begin
(define-macro-cases OP
[(OP FIRST) #'FIRST]
[(OP FIRST... | |
ddf788f0c6abdb8f83e8e01fd926817549454d01e03125c4907c924d6142ea90 | B-Lang-org/bsc | IntegerUtil.hs | module IntegerUtil(mask, ext, integerFormat, integerFormatPref,
integerInvert, integerXor, integerSelect, aaaa,
integerAnd, integerOr, integerToString) where
import ErrorUtil(internalError)
-- generate N bits of repeating 'aaaa' pattern
aaaa :: Integer -> Integer
aaaa 0 = 0
aaaa... | null | https://raw.githubusercontent.com/B-Lang-org/bsc/bd141b505394edc5a4bdd3db442a9b0a8c101f0f/src/comp/IntegerUtil.hs | haskell | generate N bits of repeating 'aaaa' pattern
mask to s bits
sign extend to s bits
select k bits at position m
otherwise, use decimal | module IntegerUtil(mask, ext, integerFormat, integerFormatPref,
integerInvert, integerXor, integerSelect, aaaa,
integerAnd, integerOr, integerToString) where
import ErrorUtil(internalError)
aaaa :: Integer -> Integer
aaaa 0 = 0
aaaa 1 = 0
aaaa 2 = 2
aaaa 3 = 2
aaaa sz | sz >= 4 ... |
fa3a1fe88b3205c407a50792d4bffc2874c9ed4d9969ec943a272f9d505014bc | dcy/epush | epush_apns.erl | -module(epush_apns).
-export([handle_http/2,
loop/4, handle_info/2
]).
-include_lib("eutil/include/eutil.hrl").
handle_push(ApnsName, Timeout, Headers, #{<<"push_method">> := <<"general_notification">>,
<<"device_token">> := DeviceToken,
... | null | https://raw.githubusercontent.com/dcy/epush/cbd59fd769e86d4f600e06ff31926f1e9c2602cf/src/epush_apns.erl | erlang | try
ok;
{Code, Info, Reason} ->
{error, Reason}
end
catch
exit:{timeout, _} ->
reject;
Error:ErrReason ->
{error, ErrReason}
end. | -module(epush_apns).
-export([handle_http/2,
loop/4, handle_info/2
]).
-include_lib("eutil/include/eutil.hrl").
handle_push(ApnsName, Timeout, Headers, #{<<"push_method">> := <<"general_notification">>,
<<"device_token">> := DeviceToken,
... |
a2f72a9f48cb153107cd6cc08276a2254f0ff653f34a6f52bebeb697ee677a3b | unclebob/clojureOrbit | world_test.clj | (ns world-test
(:use clojure.test orbit.world))
(deftest world-test
(testing "collision aging"
(is (= (age-collisions [[5 :x]]) [[4 :x]]))
(is (= (age-collisions [[1 :x] [2 :y]]) [[1 :y]]))))
| null | https://raw.githubusercontent.com/unclebob/clojureOrbit/82d59297dc8c54fccb37b92725f0547def0d6157/src/orbit/world_test.clj | clojure | (ns world-test
(:use clojure.test orbit.world))
(deftest world-test
(testing "collision aging"
(is (= (age-collisions [[5 :x]]) [[4 :x]]))
(is (= (age-collisions [[1 :x] [2 :y]]) [[1 :y]]))))
| |
00d8cfa9ce58adcc10d90f99c75f896cdef6aaecb59356bb53103708608e2cd5 | jgoerzen/magic-haskell | genconsts.hs | -*- Mode : haskell ; Haskell Magic Interface
Copyright ( C ) 2005 < >
This code is under a 3 - clause BSD license ; see COPYING for details .
Haskell Magic Interface
Copyright (C) 2005 John Goerzen <>
This code is under a 3-clause BSD license; see COPYING for details.
-}
import Data.Char
import Data.Lis... | null | https://raw.githubusercontent.com/jgoerzen/magic-haskell/fd6178dc4db05c2a6033c3845b7ef149d997e62a/utils/genconsts.hs | haskell | -*- Mode : haskell ; Haskell Magic Interface
Copyright ( C ) 2005 < >
This code is under a 3 - clause BSD license ; see COPYING for details .
Haskell Magic Interface
Copyright (C) 2005 John Goerzen <>
This code is under a 3-clause BSD license; see COPYING for details.
-}
import Data.Char
import Data.Lis... | |
914446c186ce5cd9c6974792db6de3fbacd4275fa8e3a61fc1ee06e1e7967657 | camlp5/camlp5 | plexer.ml | (* camlp5r *)
(* plexer.ml,v *)
Copyright ( c ) INRIA 2007 - 2017
(* #load "pa_lexer.cmo" *)
open Versdep;;
let simplest_raw_strings = ref false;;
let no_quotations = ref false;;
let error_on_unknown_keywords = ref false;;
let dollar_for_antiquotation = ref true;;
let specific_space_dot = ref false;;
let force_a... | null | https://raw.githubusercontent.com/camlp5/camlp5/9e8155f8ae5a584bbb4ad96d10d6fec63ed8204c/ocaml_src/lib/plexer.ml | ocaml | camlp5r
plexer.ml,v
#load "pa_lexer.cmo"
let hex_float_literal =
'0' ['x' 'X']
['0'-'9' 'A'-'F' 'a'-'f'] ['0'-'9' 'A'-'F' 'a'-'f' '_']*
('.' ['0'-'9' 'A'-'F' 'a'-'f' '_']* )?
(['p' 'P'] ['+' '-']? ['0'-'9'] ['0'-'9' '_']* )?
let literal_modifier = ['G'-'Z' 'g'-'z']
let hex_float_literal =
'0' ['x' 'X'... | Copyright ( c ) INRIA 2007 - 2017
open Versdep;;
let simplest_raw_strings = ref false;;
let no_quotations = ref false;;
let error_on_unknown_keywords = ref false;;
let dollar_for_antiquotation = ref true;;
let specific_space_dot = ref false;;
let force_antiquot_loc = ref false;;
type context =
{ mutable after... |
1728d8ccb7a31470a27bcc2a701bcccc4782d2101d6e10ae06418b08be984dbb | replikativ/replikativ | impl.cljc | (ns replikativ.crdt.ormap.impl
(:require [replikativ.protocols :refer [POpBasedCRDT -downstream
PExternalValues -missing-commits
PPullOp -pull]]
[replikativ.crdt.ormap.core :refer [downstream]]
[konserve.core :... | null | https://raw.githubusercontent.com/replikativ/replikativ/1533a7e43e46bfb70e8c8eb34dc5708e611a478d/src/replikativ/crdt/ormap/impl.cljc | clojure | (ns replikativ.crdt.ormap.impl
(:require [replikativ.protocols :refer [POpBasedCRDT -downstream
PExternalValues -missing-commits
PPullOp -pull]]
[replikativ.crdt.ormap.core :refer [downstream]]
[konserve.core :... | |
3f2a887abc4c1549dfd7663d2926b7f1f3c528dc1d30c0ef92d21de928eaa902 | SKA-ScienceDataProcessor/RC | Multicast.hs | -- | Multicast utilities
# OPTIONS_GHC -fno - warn - orphans #
# LANGUAGE RankNTypes , CPP #
module DNA.SimpleLocalnet.Internal.Multicast (initMulticast) where
import Data.Function (on)
import Data.Map (Map)
import qualified Data.Map as Map (empty)
import Data.Binary (Binary, decode, encode)
import Data.IORef (IORef,... | null | https://raw.githubusercontent.com/SKA-ScienceDataProcessor/RC/1b5e25baf9204a9f7ef40ed8ee94a86cc6c674af/MS1/ddp-erlang-style/DNA/SimpleLocalnet/Internal/Multicast.hs | haskell | | Multicast utilities
------------------------------------------------------------------------------
Top-level API --
------------------------------------------------------------------------------
| Given a hostname and a port number, initialize the multic... | # OPTIONS_GHC -fno - warn - orphans #
# LANGUAGE RankNTypes , CPP #
module DNA.SimpleLocalnet.Internal.Multicast (initMulticast) where
import Data.Function (on)
import Data.Map (Map)
import qualified Data.Map as Map (empty)
import Data.Binary (Binary, decode, encode)
import Data.IORef (IORef, newIORef, readIORef, mod... |
d560f1d4f1f24c6728cde1cd902d661abcf2ea85692d28d6b360470d7d399979 | racket/plai | morse.rkt | #lang plai/gc2/mutator
(allocator-setup "../good-collectors/good-collector.rkt" 24)
(define a '(1 2 3 4 5))
| null | https://raw.githubusercontent.com/racket/plai/164f3b763116fcfa7bd827be511650e71fa04319/plai-lib/tests/gc2/other-mutators/morse.rkt | racket | #lang plai/gc2/mutator
(allocator-setup "../good-collectors/good-collector.rkt" 24)
(define a '(1 2 3 4 5))
| |
1a8f78f94dd63d96100911a2e2119d839cbc596d0da3d8d048be7eb23e085718 | anmonteiro/ocaml-mongodb | config.ml | type t =
{ db : string
; collection : string
; host : string
; port : int
; max_connections : int
}
let create
?(host = "127.0.0.1")
?(port = 27017)
?(max_connections = 16)
~db
~collection
()
=
{ db; collection; host; port; max_connections }
| null | https://raw.githubusercontent.com/anmonteiro/ocaml-mongodb/535ae1b003b9c8a3844b92a78d2123881f2d404b/src/config.ml | ocaml | type t =
{ db : string
; collection : string
; host : string
; port : int
; max_connections : int
}
let create
?(host = "127.0.0.1")
?(port = 27017)
?(max_connections = 16)
~db
~collection
()
=
{ db; collection; host; port; max_connections }
| |
d952b7b23860f22d77e8535e8334fe88982a2328aa2cc1f75081c64f2e8b0e0a | alan-turing-institute/advent-of-code-2021 | day5.rkt | #lang racket
(struct line (x0 y0 x1 y1))
;; Step through [start, end], with a step size depending on the sign
of end - start . Step size of zero means repeat forever ( presumably
;; the *other* coordinate doesn't!)
(define (in-coord start end)
(define step (sgn (- end start)))
(in-inclusive-range start end step... | null | https://raw.githubusercontent.com/alan-turing-institute/advent-of-code-2021/1053541fbd2598591c5042f18c034fbc17995284/day-05/racket_ots22/day5.rkt | racket | Step through [start, end], with a step size depending on the sign
the *other* coordinate doesn't!) | #lang racket
(struct line (x0 y0 x1 y1))
of end - start . Step size of zero means repeat forever ( presumably
(define (in-coord start end)
(define step (sgn (- end start)))
(in-inclusive-range start end step))
(define (line->points l)
(sequence->list
(sequence-map list (in-parallel (in-coord (line-x0 l) (... |
f90997f67975c44259c223d75b255851fbb5827b217baee7d260d5f958e1323c | erikd/vector-algorithms | Insertion.hs | # LANGUAGE TypeFamilies #
-- ---------------------------------------------------------------------------
-- |
-- Module : Data.Vector.Algorithms.Insertion
Copyright : ( c ) 2008 - 2010
Maintainer :
-- Stability : Experimental
-- Portability : Portable
--
-- A simple insertion sort. Though it's O(n^... | null | https://raw.githubusercontent.com/erikd/vector-algorithms/a8b985c16ae9d6560376f57eb7a9a175b4e3ea78/src/Data/Vector/Algorithms/Insertion.hs | haskell | ---------------------------------------------------------------------------
|
Module : Data.Vector.Algorithms.Insertion
Stability : Experimental
Portability : Portable
A simple insertion sort. Though it's O(n^2), its iterative nature can be
beneficial for small arrays. It is used to sort small segments o... | # LANGUAGE TypeFamilies #
Copyright : ( c ) 2008 - 2010
Maintainer :
module Data.Vector.Algorithms.Insertion
( sort
, sortUniq
, sortBy
, sortUniqBy
, sortByBounds
, sortByBounds'
, Comparison
) where
import Prelude hiding (read, length)
import C... |
a5605f3d823f01b59b27f608086036de494cefbdea1321722d5539d49da6ce3a | david-christiansen/pudding | rewindable-streams.rkt | #lang racket/base
(require racket/contract)
(provide make-rstream list->rstream rstream-forever
rstream-next
rstream-snapshot rstream-rewind!)
(module+ test
(require rackunit))
(struct rstream (contents))
(define the-streams (box (make-weak-hasheq)))
(define/contract (make-rstream contents)
... | null | https://raw.githubusercontent.com/david-christiansen/pudding/ead4e1a2e8e0d77a884211adcc4466edcf65e406/rewindable-streams.rkt | racket | #lang racket/base
(require racket/contract)
(provide make-rstream list->rstream rstream-forever
rstream-next
rstream-snapshot rstream-rewind!)
(module+ test
(require rackunit))
(struct rstream (contents))
(define the-streams (box (make-weak-hasheq)))
(define/contract (make-rstream contents)
... | |
9752c082fb23da6d92d8b20670a55ebd2d4783a54e08e7518b2e364e0e441633 | tfausak/advent-of-code | 1.hs | -- stack --resolver lts-12.0 script
import qualified Data.List as List
import qualified Data.Ord as Ord
import qualified Text.ParserCombinators.ReadP as Parse
main = do
nanobots <- map read . lines <$> readFile "input.txt"
let strongest = List.maximumBy (Ord.comparing r) nanobots
print . length $ filter (inRange... | null | https://raw.githubusercontent.com/tfausak/advent-of-code/26f0d9726b019ff7b97fa7e0f2f995269b399578/2018/23/1.hs | haskell | stack --resolver lts-12.0 script | import qualified Data.List as List
import qualified Data.Ord as Ord
import qualified Text.ParserCombinators.ReadP as Parse
main = do
nanobots <- map read . lines <$> readFile "input.txt"
let strongest = List.maximumBy (Ord.comparing r) nanobots
print . length $ filter (inRange strongest) nanobots
inRange a b = ... |
44bf32bd79fe68769b67f785773a39f8da31833eb919370d7347a863275ec5f4 | aarkerio/ZentaurLMS | test_runner.cljs | (ns zentaur.test-runner
(:require [cljs.test]
[cljs-test-display.core]
[zentaur.core-test])
(:require-macros
[cljs.test]))
(defn test-run []
;; where "app" is the HTML node where you want to mount the tests
(cljs.test/run-tests
(cljs-test-display.core/init! "app") ;;<-- initializ... | null | https://raw.githubusercontent.com/aarkerio/ZentaurLMS/adb43fb879b88d6a35f7f556cb225f7930d524f9/test/cljs/zentaur/test_runner.cljs | clojure | where "app" is the HTML node where you want to mount the tests
<-- initialize cljs-test-display here
'zentaur.post-test | (ns zentaur.test-runner
(:require [cljs.test]
[cljs-test-display.core]
[zentaur.core-test])
(:require-macros
[cljs.test]))
(defn test-run []
(cljs.test/run-tests
'zentaur.core-test))
|
76603952356012ed0205ad5a668e97b4cb18947f6c5705a2877786c22d0df1ec | ubf/ubf | ebf_tests.erl | %%% The MIT License
%%%
Copyright ( C ) 2011 - 2016 by < >
Copyright ( C ) 2002 by
%%%
%%% Permission is hereby granted, free of charge, to any person obtaining a copy
%%% of this software and associated documentation files (the "Software"), to deal
in the Software without restriction , including without li... | null | https://raw.githubusercontent.com/ubf/ubf/c876f684fbd4959548ace1eb1cfc91941f93d377/test/unit/ebf_tests.erl | erlang | The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
furnished to do so, subject to the following conditions:
The above... | Copyright ( C ) 2011 - 2016 by < >
Copyright ( C ) 2002 by
in the Software without restriction , including without limitation the rights
copies of the Software , and to permit persons to whom the Software is
all copies or substantial portions of the Software .
THE SOFTWARE IS PROVIDED " AS IS " , WITH... |
7015bab4bf2df6b64ce8e43d86e4f989cbc72afd5472150f274781921d3506f3 | may-liu/qtalk | http_sendmessage.erl | %% Feel free to use, reuse and abuse the code in this file.
-module(http_sendmessage).
-export([init/3]).
-export([handle/2]).
-export([terminate/3]).
-include("logger.hrl").
-include("http_req.hrl").
-include("ejb_http_server.hrl").
init(_Transport, Req, []) ->
{ok, Req, undefined}.
handle(Req, State) ->
cat... | null | https://raw.githubusercontent.com/may-liu/qtalk/f5431e5a7123975e9656e7ab239e674ce33713cd/qtalk_opensource/scripts/ejb_http_server/src/http_sendmessage.erl | erlang | Feel free to use, reuse and abuse the code in this file. |
-module(http_sendmessage).
-export([init/3]).
-export([handle/2]).
-export([terminate/3]).
-include("logger.hrl").
-include("http_req.hrl").
-include("ejb_http_server.hrl").
init(_Transport, Req, []) ->
{ok, Req, undefined}.
handle(Req, State) ->
catch ejb_monitor:monitor_count(<<"http_sendmessage">>,1),
... |
ab0428eaa27990836c7eb6e513bae9c7b47c7065f0e4ca646b48d9804f80f399 | dbenoit17/dynamic-ffi | export.rkt | ;; This module provides functions for exporting
FFI bindings as shippable racket files .
#lang racket/base
(require
racket/string
racket/port
racket/runtime-path
racket/contract
(only-in ffi/unsafe ffi-lib _byte get-ffi-obj)
(for-syntax racket/base)
(prefix-in dffi: "meta.rkt"))
(provide
create-ma... | null | https://raw.githubusercontent.com/dbenoit17/dynamic-ffi/c82f5cb25932e9cab31844569b1364e23a02f205/export.rkt | racket | This module provides functions for exporting
all pointers opaque for now to
prevent type conflicts
would be cool to do it this way
[else (_cpointer (format-dffi-obj pointee))]))
This is equivalent to build-ffi-obj-map in ffi.rkt,
except it produces racket source code instead
of runtime ffi objects.
ffi-lib-obj ... | FFI bindings as shippable racket files .
#lang racket/base
(require
racket/string
racket/port
racket/runtime-path
racket/contract
(only-in ffi/unsafe ffi-lib _byte get-ffi-obj)
(for-syntax racket/base)
(prefix-in dffi: "meta.rkt"))
(provide
create-mapped-static-ffi
create-static-ffi
(contract-... |
bc275c6623b77508142f5a0594390a36044d4e84b8204d1227054f50ec412c37 | yetibot/yetibot | http_status.clj | (ns yetibot.commands.http-status
(:require
[yetibot.core.hooks :refer [cmd-hook]]))
(defn status-code
"http <code> # look up http status code"
{:yb/cat #{:fun :img}}
[{code :match}]
(format "" code))
(cmd-hook #"http"
#"^\w+$" status-code)
| null | https://raw.githubusercontent.com/yetibot/yetibot/2fb5c1182b1a53ab0e433d6bab2775ebd43367de/src/yetibot/commands/http_status.clj | clojure | (ns yetibot.commands.http-status
(:require
[yetibot.core.hooks :refer [cmd-hook]]))
(defn status-code
"http <code> # look up http status code"
{:yb/cat #{:fun :img}}
[{code :match}]
(format "" code))
(cmd-hook #"http"
#"^\w+$" status-code)
| |
3a08466cb60f263415f71d1e87fb1759e8dbb9ee0518c13614ea71fe7b894054 | rmculpepper/racket-http123 | test2.rkt | Copyright 2021
SPDX - License - Identifier : Apache-2.0
#lang racket/base
(require (for-syntax racket/base)
racket/match
racket/class
syntax/srcloc
rackunit
http123
http123/private/http2
http123/private/h2-frame
http123/private/hpack)
;; Te... | null | https://raw.githubusercontent.com/rmculpepper/racket-http123/313fecf225bf74d8a9a006601048ab76446b800b/http123/tests/test2.rkt | racket | Test various error conditions for HTTP/2 actual connections using a
fake server that sends scripted sequences of frames.
An Action is Frame | 'sleep | Real | ???.
============================================================
Error tests
----------------------------------------
from http2.rkt:
handle-frame-or-oth... | Copyright 2021
SPDX - License - Identifier : Apache-2.0
#lang racket/base
(require (for-syntax racket/base)
racket/match
racket/class
syntax/srcloc
rackunit
http123
http123/private/http2
http123/private/h2-frame
http123/private/hpack)
(def... |
ab96d108ea678e05fb617e245d564d1fb89527bb2b86f7ab66a4ff93eb196584 | metaocaml/ber-metaocaml | genprintval.mli | (**************************************************************************)
(* *)
(* OCaml *)
(* *)
... | null | https://raw.githubusercontent.com/metaocaml/ber-metaocaml/4992d1f87fc08ccb958817926cf9d1d739caf3a2/toplevel/genprintval.mli | ocaml | ************************************************************************
OCaml
... | , projet Cristal , INRIA Rocquencourt
Copyright 1996 Institut National de Recherche en Informatique et
the GNU Lesser General Public License version 2.1 , with the
open Types
open Format
module type OBJ =
sig
type t
val repr : 'a -> t
val obj : t -> 'a
... |
06d4cc65c0fc6bf51bb7b703bd261545f95e1f4e55f7835aa78dbe47203f8320 | mjrusso/joy-of-clojure-examples | core.clj | (ns joc.core)
(defn hello-world [name]
(println "Hello, " name))
| null | https://raw.githubusercontent.com/mjrusso/joy-of-clojure-examples/d59fddbb416ff613af63d540d3f1076de0c79bc0/src/joc/core.clj | clojure | (ns joc.core)
(defn hello-world [name]
(println "Hello, " name))
| |
b719a9c41fb5ffbeef500d021abde76d939cbf3706166b9629d99bf728de4e7b | onedata/op-worker | session_offline_test_SUITE.erl | %%%-------------------------------------------------------------------
@author
( C ) 2021 ACK CYFRONET AGH
This software is released under the MIT license
cited in ' LICENSE.txt ' .
%%% @end
%%%-------------------------------------------------------------------
%%% @doc
%%% This file contains tests concernin... | null | https://raw.githubusercontent.com/onedata/op-worker/239b30c6510ccf0f2f429dc5c48ecf04d192549a/test_distributed/suites/session/session_offline_test_SUITE.erl | erlang | -------------------------------------------------------------------
@end
-------------------------------------------------------------------
@doc
This file contains tests concerning offline access management.
@end
-------------------------------------------------------------------
==================================... | @author
( C ) 2021 ACK CYFRONET AGH
This software is released under the MIT license
cited in ' LICENSE.txt ' .
-module(session_offline_test_SUITE).
-author("Bartosz Walkowicz").
-include("api_file_test_utils.hrl").
-include("modules/auth/offline_access_manager.hrl").
-include("modules/fslogic/fslogic_common... |
022d62c411ccb68fbba410286dc00d3549cbf10e95bff7334d18bf84e0ccd663 | morpheusgraphql/morpheus-graphql | Ext.hs | # LANGUAGE NoImplicitPrelude #
module Data.Morpheus.Internal.Ext
( PushEvents (..),
Result (..),
ResultT (..),
cleanEvents,
resultOr,
mapEvent,
sortErrors,
unsafeFromList,
(<:>),
resolveWith,
runResolutionT,
toEither,
Merge (..),
GQLResult,
)
where
import Data.M... | null | https://raw.githubusercontent.com/morpheusgraphql/morpheus-graphql/1d422eb1c2c40fee1148d236fc848144a0b08e11/morpheus-graphql-core/src/Data/Morpheus/Internal/Ext.hs | haskell | # LANGUAGE NoImplicitPrelude #
module Data.Morpheus.Internal.Ext
( PushEvents (..),
Result (..),
ResultT (..),
cleanEvents,
resultOr,
mapEvent,
sortErrors,
unsafeFromList,
(<:>),
resolveWith,
runResolutionT,
toEither,
Merge (..),
GQLResult,
)
where
import Data.M... | |
998714b1c16e90008af245845abd782a8a8e068666a177ccc9a08c14146639e3 | tov/dssl2 | printer.rkt | #lang racket/base
(provide dssl-print
dssl-fprintf
dssl-printf
dssl-format
dssl-contract-name)
(require "struct.rkt")
(require "object.rkt")
(require "generic.rkt")
(require "errors.rkt")
(require (only-in racket/contract
contract-name
contract?)
... | null | https://raw.githubusercontent.com/tov/dssl2/e85691b5ea4959feb117f21d96dfe8a1b05afe5c/private/printer.rkt | racket | #lang racket/base
(provide dssl-print
dssl-fprintf
dssl-printf
dssl-format
dssl-contract-name)
(require "struct.rkt")
(require "object.rkt")
(require "generic.rkt")
(require "errors.rkt")
(require (only-in racket/contract
contract-name
contract?)
... | |
e88a1a81ec6abde057b91b5885313d7573fd5a51d3280f0d73b1bf18de21db33 | irr/erl-tutorials | etrader_stats.erl | -module(etrader_stats).
-vsn(1.0).
-author('').
-export([sma/2, ema/2]).
-export_type([ma_t/0]).
-type ma_t() :: {queue(), array()}.
-include("etrader.hrl").
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
%% R:
%% library(quantmod)
%% uol <- read.csv(file="/data/bovespa/etrader.csv", header=FALSE)
... | null | https://raw.githubusercontent.com/irr/erl-tutorials/da68b1c08baf6bdf46e7e8d3381d796e93c0357c/et/src/etrader_stats.erl | erlang | R:
library(quantmod)
uol <- read.csv(file="/data/bovespa/etrader.csv", header=FALSE)
EMA(uol[[5]][1:100], n=21)
dialyzer -Wno_opaque -c ../ebin/*.beam
Test passed.
ok
Test passed.
ok | -module(etrader_stats).
-vsn(1.0).
-author('').
-export([sma/2, ema/2]).
-export_type([ma_t/0]).
-type ma_t() :: {queue(), array()}.
-include("etrader.hrl").
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
-endif.
-spec mm (integer(), integer(), integer(), ma_t()) -> ma_t().
mm(I, N, N, {Q, MA}) when is_i... |
aeeb777278a488fea44ec4e524d729d1f03824485d9a38c30a0b7178b5e8d23a | foretspaisibles/lemonade-sqlite | main.ml | Main -- Unit testing
Lemonade Sqlite ( -sqlite )
This file is part of Lemonade Sqlite
Copyright © 2016
This file must be used under the terms of the CeCILL - B.
This source file is licensed as described in the file COPYING , which
you should have received as part of this distribution . The terms
ar... | null | https://raw.githubusercontent.com/foretspaisibles/lemonade-sqlite/a1fcdf49afc3d902ddd7f0d58ef1fdc894f92965/testsuite/main.ml | ocaml | Main -- Unit testing
Lemonade Sqlite ( -sqlite )
This file is part of Lemonade Sqlite
Copyright © 2016
This file must be used under the terms of the CeCILL - B.
This source file is licensed as described in the file COPYING , which
you should have received as part of this distribution . The terms
ar... | |
c7ed6784e6ee603f1c2251e368ce8f359b6e3cb3cbf37f67cc5fc899d4964857 | mirleft/ocaml-asn1-combinators | test.ml | Copyright ( c ) 2014 - 2019 . All rights reserved .
See LICENSE.md .
See LICENSE.md. *)
let pp_hex_cs ppf =
let pp ppf cs =
for i = 0 to Cstruct.length cs - 1 do
Format.fprintf ppf "%02x@ " (Cstruct.get_uint8 cs i)
done in
Format.fprintf ppf "@[%a@]" pp
let pp_hex_s ppf =
let pp ppf =... | null | https://raw.githubusercontent.com/mirleft/ocaml-asn1-combinators/f10fc1d869be293a16a31b272fc71794849007a2/tests/test.ml | ocaml | invert certs
accepts_eq "value samples" Asn.der cases;
invert certs
injectivity | Copyright ( c ) 2014 - 2019 . All rights reserved .
See LICENSE.md .
See LICENSE.md. *)
let pp_hex_cs ppf =
let pp ppf cs =
for i = 0 to Cstruct.length cs - 1 do
Format.fprintf ppf "%02x@ " (Cstruct.get_uint8 cs i)
done in
Format.fprintf ppf "@[%a@]" pp
let pp_hex_s ppf =
let pp ppf =... |
2162fa0b1f3e01f7877f2c1ce0ce3b037816d582e79223e8ddd4f1de568ca087 | alanz/ghc-exactprint | T9858c.hs | # LANGUAGE KindSignatures #
module Main(main) where
import Data.Typeable
import GHC.Exts
test1 :: Bool
test1 = typeRep (Proxy :: Proxy (() :: *)) ==
typeRep (Proxy :: Proxy (() :: Constraint))
test2 :: Bool
test2 = typeRepTyCon (typeRep (Proxy :: Proxy (Int,Int))) ==
typeRepTyCon (typeRep (Proxy :: P... | null | https://raw.githubusercontent.com/alanz/ghc-exactprint/b6b75027811fa4c336b34122a7a7b1a8df462563/tests/examples/ghc80/T9858c.hs | haskell | # LANGUAGE KindSignatures #
module Main(main) where
import Data.Typeable
import GHC.Exts
test1 :: Bool
test1 = typeRep (Proxy :: Proxy (() :: *)) ==
typeRep (Proxy :: Proxy (() :: Constraint))
test2 :: Bool
test2 = typeRepTyCon (typeRep (Proxy :: Proxy (Int,Int))) ==
typeRepTyCon (typeRep (Proxy :: P... | |
6cfad2f46cd5ebf2bcff62d996cbb420cecc0d4d349ae2c7bc8d38b5ecd1a081 | mojombo/egitd | log.erl | -module(log).
-export([init_log/1, write/2]).
init_log(Log) ->
ets:insert(db, {log, Log}).
write(Type, Messages) ->
write_log(ets:lookup(db, log), Type, Messages).
write_log([{log, Log}], Type, Messages) ->
{ok, F} = file:open(Log, [append]),
Message = string:join(Messages, "\t"),
Line = io_lib:fwrite(... | null | https://raw.githubusercontent.com/mojombo/egitd/5309fe5f9a5908cd741f8dedf13790eea5d7528d/elibs/log.erl | erlang | -module(log).
-export([init_log/1, write/2]).
init_log(Log) ->
ets:insert(db, {log, Log}).
write(Type, Messages) ->
write_log(ets:lookup(db, log), Type, Messages).
write_log([{log, Log}], Type, Messages) ->
{ok, F} = file:open(Log, [append]),
Message = string:join(Messages, "\t"),
Line = io_lib:fwrite(... | |
ab9c48b5d2edb6f7ad6bc53b0e688bbdb792150014c4c9828fa253de8d76ee52 | hipsleek/hipsleek | cil.mli |
*
* Copyright ( c ) 2001 - 2002 ,
* < >
* < >
* < >
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions are
* met :
*
* 1 . Redistributions... | null | https://raw.githubusercontent.com/hipsleek/hipsleek/596f7fa7f67444c8309da2ca86ba4c47d376618c/cil/src/cil.mli | ocaml | * {b CIL API Documentation.} An html version of this document
* can be found at
* Call this function to perform some initialization. Call if after you have
* set {!Cil.msvcMode}.
* These are the CIL version numbers. A CIL version is a number of the form
* M.m.r (major, minor and release)
* {b The Abstract ... |
*
* Copyright ( c ) 2001 - 2002 ,
* < >
* < >
* < >
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions are
* met :
*
* 1 . Redistributions... |
f431d3526fbb1feaffaec729e665a8b09b387cc0d4d51612dd1c13e4d36c15db | byteally/webapi | MockSpec.hs | # OPTIONS_GHC -fno - warn - unused - binds #
# LANGUAGE MultiParamTypeClasses , TypeFamilies , OverloadedStrings , DataKinds , TypeOperators , TypeSynonymInstances , FlexibleInstances , DeriveGeneric #
module WebApi.MockSpec (spec) where
import Data.Aeson
import GHC.Generics
import WebApi hiding (get, post, put)
impor... | null | https://raw.githubusercontent.com/byteally/webapi/8d712d0ae786475b177beacee32dc40db320af4c/webapi/tests/WebApi/MockSpec.hs | haskell | withApp :: Wai.Application -> Spec | # OPTIONS_GHC -fno - warn - unused - binds #
# LANGUAGE MultiParamTypeClasses , TypeFamilies , OverloadedStrings , DataKinds , TypeOperators , TypeSynonymInstances , FlexibleInstances , DeriveGeneric #
module WebApi.MockSpec (spec) where
import Data.Aeson
import GHC.Generics
import WebApi hiding (get, post, put)
impor... |
e7656b1c28323d5d72dad7bbad1aa78c28bef02e761cb1737e78fca0dc543ecc | wesen/ruinwesen | twitter.lisp | (in-package :ruinwesen)
(defparameter *last-twitters* nil)
(defparameter *last-twitters-ruin* nil)
(defun gather-twitters ()
(let ((twitter (get-twitter "wesen" :count 3)))
(when twitter
(setf *last-twitters* twitter)))
(let ((twitter (get-twitter "RuinMusic" :count 3)))
(when twitter
(setf *l... | null | https://raw.githubusercontent.com/wesen/ruinwesen/9f3ccea85425cf46b57e76144b3114ca342bad0f/ruinwesen/src/twitter.lisp | lisp | (in-package :ruinwesen)
(defparameter *last-twitters* nil)
(defparameter *last-twitters-ruin* nil)
(defun gather-twitters ()
(let ((twitter (get-twitter "wesen" :count 3)))
(when twitter
(setf *last-twitters* twitter)))
(let ((twitter (get-twitter "RuinMusic" :count 3)))
(when twitter
(setf *l... | |
34e05f605f3442e70d04f808328472597ceab17bb6a0628b699b529e8b5fbb7c | sjoerdvisscher/free-functors | HFree.hs | # OPTIONS_GHC -fno - warn - unused - matches #
# LANGUAGE
RankNTypes
, TypeOperators
, , TemplateHaskell
, UndecidableInstances
, QuantifiedConstraints
#
RankNTypes
, TypeOperators
, ConstraintKinds
, TemplateHaskell
, UndecidableInstances
, QuantifiedConstraints
#-}
--------... | null | https://raw.githubusercontent.com/sjoerdvisscher/free-functors/78bff2949e2f54afb4a0b59cd105a30645742b3a/src/Data/Functor/HFree.hs | haskell | ---------------------------------------------------------------------------
|
License : BSD-style (see the file LICENSE)
Maintainer :
Stability : experimental
Portability : non-portable
A free functor is left adjoint to a forgetful functor.
In this package the forgetful functor forgets class constr... | # OPTIONS_GHC -fno - warn - unused - matches #
# LANGUAGE
RankNTypes
, TypeOperators
, , TemplateHaskell
, UndecidableInstances
, QuantifiedConstraints
#
RankNTypes
, TypeOperators
, ConstraintKinds
, TemplateHaskell
, UndecidableInstances
, QuantifiedConstraints
#-}
Module... |
513ba6b2de3c23dc9c0eb75248109de37e35f23a7c6809d71936c9c512a2792b | kupl/FixML | sol.ml | let rec sigma (f,a,b) =
if(a>b) then 0 else (f a)+sigma (f,a+1,b) | null | https://raw.githubusercontent.com/kupl/FixML/0a032a733d68cd8ccc8b1034d2908cd43b241fce/benchmarks/sigma/sigma/sol.ml | ocaml | let rec sigma (f,a,b) =
if(a>b) then 0 else (f a)+sigma (f,a+1,b) | |
1e30d8e2de353602f5702ba1459a6eafcd55f5d08c39a7b1aa4c6d33624355c4 | bobzhang/ocaml-book | myocamlbuild.ml | open Ocamlbuild_plugin
open Command
let run_and_read = Ocamlbuild_pack.My_unix.run_and_read
let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings
let find_packages () =
blank_sep_strings &
Lexing.from_string &
run_and_read "ocamlfind list | cut -d' ' -f1"
* ocamlfind can only handle these tw... | null | https://raw.githubusercontent.com/bobzhang/ocaml-book/09a575b0d1fedfce565ecb9a0ae9cf0df37fdc75/library/code/bitstring/myocamlbuild.ml | ocaml | * list extensions, but not used here
* for pa_ulex, you must create the symbol link by yourself
* for bolt logger
* for bitstring
* demo how to use dep
dep ["ocamldep"; "file:test/test_string.ml"]
["test/test_data/string.txt";
"test/test_data/char.txt"];
flag ["ocaml"; "pp"; "use_lambda"] (A"pa... | open Ocamlbuild_plugin
open Command
let run_and_read = Ocamlbuild_pack.My_unix.run_and_read
let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings
let find_packages () =
blank_sep_strings &
Lexing.from_string &
run_and_read "ocamlfind list | cut -d' ' -f1"
* ocamlfind can only handle these tw... |
4532019aa317e417c63c93efe4a7ab8757aada07aaeb58485e307fa40943dcd4 | picnic/RelationExtraction | host_stuff.mli | (****************************************************************************)
RelationExtraction - Extraction of inductive relations for Coq
(* *)
(* This program is free software: you can redistribute it and/or modify *)
it u... | null | https://raw.githubusercontent.com/picnic/RelationExtraction/a4cee37d0a8e5f0eff2e010e6305e037aa0d2564/host_stuff.mli | ocaml | **************************************************************************
This program is free software: you can redistribute it and/or modify
(at your option) any later version.
... | RelationExtraction - Extraction of inductive relations for Coq
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
You should have received a copy of the GNU General Public License
Copyright 2... |
2c5c74067551de3c3e01b06488e9aab3560c86ab9ad8d2561cd1acd3bc754b94 | borkdude/jet | main.clj | (ns jet.main
{:no-doc true}
(:require
[babashka.cli :as cli]
[camel-snake-kebab.core :as csk]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.string :as str]
[jet.base64 :refer [base64-namespace]]
[jet.data-readers]
[jet.formats :as formats]
[jet.jeti :refer [start-jeti!]]
[jet... | null | https://raw.githubusercontent.com/borkdude/jet/fea03680f50846a808afbb22b00dc732f98ebaeb/src/jet/main.clj | clojure | enable println, prn etc.
When running in musl-compiled static executable we lift execution of bb
inside a thread, so we have a larger than default stack size, set by an
argument to the linker. See | (ns jet.main
{:no-doc true}
(:require
[babashka.cli :as cli]
[camel-snake-kebab.core :as csk]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.string :as str]
[jet.base64 :refer [base64-namespace]]
[jet.data-readers]
[jet.formats :as formats]
[jet.jeti :refer [start-jeti!]]
[jet... |
56f164e5007a340de06577a71b5a8f35352ae40bf91871709c798906d4547c07 | seanomlor/programming-in-haskell | take.hs | import Prelude hiding (take)
take :: Int -> [a] -> [a]
take 0 _ = []
take _ [] = []
take n (x:xs) = x : take (n - 1) xs
| null | https://raw.githubusercontent.com/seanomlor/programming-in-haskell/e05142e6709eeba2e95cf86f376a32c9e629df88/06-recursive-functions/take.hs | haskell | import Prelude hiding (take)
take :: Int -> [a] -> [a]
take 0 _ = []
take _ [] = []
take n (x:xs) = x : take (n - 1) xs
| |
947596348f2b330dd2a27c8b46cfc40cbc2b400efad694f8a4db2e8dec79fe42 | clojure-emacs/sayid | test_utils.clj | (ns com.billpiel.sayid.test-utils)
;; #L356
(defn swap-pair!
"Like swap! but returns a pair [old-val new-val]"
([a f]
(loop []
(let [old-val @a
new-val (f old-val)]
(if (compare-and-set! a old-val new-val)
[old-val new-val]
(recur)))))
([a f & args]
(swa... | null | https://raw.githubusercontent.com/clojure-emacs/sayid/27f35778de9509067716a7bed14306787334a589/test/com/billpiel/sayid/test_utils.clj | clojure | #L356 | (ns com.billpiel.sayid.test-utils)
(defn swap-pair!
"Like swap! but returns a pair [old-val new-val]"
([a f]
(loop []
(let [old-val @a
new-val (f old-val)]
(if (compare-and-set! a old-val new-val)
[old-val new-val]
(recur)))))
([a f & args]
(swap-pair! a... |
6882818534addb433daf7380c8bf9c19c6c981de4a4b403f03f7b21ccfdffbec | squaresLab/footpatch | patch.ml | module L = Logging
type t =
(* change is a range of lines to delete, or a starting line and string list *)
{ change : Change.t
(* diff is only the textual difference, with indentation *)
; diff: string
(* the original absolute filename *)
; filename: string
(* the command used to indent files *)
; inde... | null | https://raw.githubusercontent.com/squaresLab/footpatch/8b79c1964d89b833179aed7ed4fde0638a435782/infer/src/footpatch/patch.ml | ocaml | change is a range of lines to delete, or a starting line and string list
diff is only the textual difference, with indentation
the original absolute filename
the command used to indent files
e.g., /tmp/diff123.diff
Fix up patch format wrt source and destination files
*
replace is for when we want to replace... | module L = Logging
type t =
{ change : Change.t
; diff: string
; filename: string
; indent: Indent.t option
}
let exec_cmd ?(fail_if_fail = true) cmd =
match Sys.command cmd with
| 0 -> ()
| _ when fail_if_fail ->
let err = Format.sprintf "Error executing %s" cmd in
failwith err
| _ -> L... |
7d37eced024312b0a4a844438b10b4a36d01bfb2fcdc9ae970dee130d51684af | patperry/hs-linear-algebra | LinearAlgebra.hs | -----------------------------------------------------------------------------
-- |
Module : Numeric . LinearAlgebra
Copyright : Copyright ( c ) 2010 , < >
-- License : BSD3
Maintainer : < >
-- Stability : experimental
--
Linear algebra types and operations
--
module Numeric.LinearAlgebra (
... | null | https://raw.githubusercontent.com/patperry/hs-linear-algebra/887939175e03687b12eabe2fce5904b494242a1a/lib/Numeric/LinearAlgebra.hs | haskell | ---------------------------------------------------------------------------
|
License : BSD3
Stability : experimental
* Vector types
* Matrix types
* Packed matrix types | Module : Numeric . LinearAlgebra
Copyright : Copyright ( c ) 2010 , < >
Maintainer : < >
Linear algebra types and operations
module Numeric.LinearAlgebra (
Vector,
RVector,
STVector,
IOVector,
Matrix,
RMatrix,
STMatrix,
IOMatrix,
Packed,
RPacked,
... |
e8bb1636373a57a81e31a2571d33da6945af253c2e44f7aba4ad13b6a30ab719 | cnuernber/charred | json_test_suite_test.clj | (ns charred.json-test-suite-test
(:require [charred.api :refer [read-json]]
[clojure.test :refer :all]
[clojure.string :as str]))
(deftest i-number-double-huge-neg-exp-test
(is (= [0.0] (read-json "[123.456e-789]"))))
(deftest i-number-huge-exp-test
(is (= [##Inf]
(read-json "[0... | null | https://raw.githubusercontent.com/cnuernber/charred/836e6d009b94821f90717ae64350c7f28a547a03/test/charred/json_test_suite_test.clj | clojure | (ns charred.json-test-suite-test
(:require [charred.api :refer [read-json]]
[clojure.test :refer :all]
[clojure.string :as str]))
(deftest i-number-double-huge-neg-exp-test
(is (= [0.0] (read-json "[123.456e-789]"))))
(deftest i-number-huge-exp-test
(is (= [##Inf]
(read-json "[0... | |
b1af017441cbbdb2f68d424eb64b5f50ff7e492720c63cd79af1e9c8f25f17a6 | okuoku/nausicaa | test-net-ipv4-address.sps | -*- coding : utf-8 -*-
;;;
Part of : / Scheme
Contents : tests for IPv4 address object
Date : Fri Jun 11 , 2010
;;;
;;;Abstract
;;;
;;;
;;;
Copyright ( c ) 2010 , 2011 < >
;;;
;;;This program is free software: you can redistribute it and/or modify
;;;it under the terms of the GNU General Public License as publi... | null | https://raw.githubusercontent.com/okuoku/nausicaa/50e7b4d4141ad4d81051588608677223fe9fb715/scheme/tests/test-net-ipv4-address.sps | scheme |
Abstract
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warra... | -*- coding : utf-8 -*-
Part of : / Scheme
Contents : tests for IPv4 address object
Date : Fri Jun 11 , 2010
Copyright ( c ) 2010 , 2011 < >
the Free Software Foundation , either version 3 of the License , or ( at
General Public License for more details .
You should have received a copy of the GNU General ... |
ac2583b4606a0dec36504fdf021d840f092a8153584902476dc3f2132beac505 | dongcarl/guix | libunwind.scm | ;;; GNU Guix --- Functional package management for GNU
Copyright © 2013 , 2014 < >
Copyright © 2015 < >
Copyright © 2019 < >
;;;
;;; This file is part of GNU Guix.
;;;
GNU is free software ; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by... | null | https://raw.githubusercontent.com/dongcarl/guix/82543e9649da2da9a5285ede4ec4f718fd740fcb/gnu/packages/libunwind.scm | scheme | GNU Guix --- Functional package management for GNU
This file is part of GNU Guix.
you can redistribute it and/or modify it
either version 3 of the License , or ( at
your option) any later version.
GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied wa... | Copyright © 2013 , 2014 < >
Copyright © 2015 < >
Copyright © 2019 < >
under the terms of the GNU General Public License as published by
You should have received a copy of the GNU General Public License
along with GNU . If not , see < / > .
(define-module (gnu packages libunwind)
#:use-modu... |
586647c503a0ca30c292cdc862645032fc82c32674cf8f84bbedc1e8b3ccd6d9 | psg-mit/probzelus-haskell | SymbolicLL.hs | module SymbolicLL where
import Prelude
import Data.Foldable (asum)
import Data.List (partition)
import Data.Maybe (fromMaybe)
import Data.IORef
import Control.Arrow (second)
import Control.Monad ((>=>), void)
import Control.Monad.State
import Debug.Trace (traceShow, trace)
import Distributions hiding (factor)
impor... | null | https://raw.githubusercontent.com/psg-mit/probzelus-haskell/a4b66631451b6156938a9c5420cfff2999ecbbc6/haskell/src/SymbolicLL.hs | haskell | getVarFromProduct i es| traceShow ("getVarFromProduct", i, es) False = undefined
getDist1 i xs | traceShow ("getDist1", i, xs) False = undefined
at :: Int -> [a] -> Maybe a
at _ [] = Nothing
at 0 (x : _) = Just x
at i (_ : xs) = lookup (i - 1) xs
getDist e i | traceShow ("getDist", e, i) False = undefined | module SymbolicLL where
import Prelude
import Data.Foldable (asum)
import Data.List (partition)
import Data.Maybe (fromMaybe)
import Data.IORef
import Control.Arrow (second)
import Control.Monad ((>=>), void)
import Control.Monad.State
import Debug.Trace (traceShow, trace)
import Distributions hiding (factor)
impor... |
ead69b26bf4c6ab2cb8aa2fd28a48ffb18fcd4893136181df360122c554d453c | ocsigen/ocaml-eliom | test_big_ints.ml | (**************************************************************************)
(* *)
(* OCaml *)
(* *)
, ... | null | https://raw.githubusercontent.com/ocsigen/ocaml-eliom/497c6707f477cb3086dc6d8124384e74a8c379ae/testsuite/tests/lib-num/test_big_ints.ml | ocaml | ************************************************************************
OCaml
... | , projet Cristal , INRIA Rocquencourt
Copyright 1996 Institut National de Recherche en Informatique et
the GNU Lesser General Public License version 2.1 , with the
open Test;;
open Nat;;
open Big_int;;
open List;;
testing_function "compare_big_int";;
test 1
eq_int (compare_big... |
efd6187ef818fd636a2b904ee970881cfc8966f4c3e46157eed58ed854e4b88a | RichiH/git-annex | MetaData.hs | git - annex command
-
- Copyright 2014 - 2016 < >
-
- Licensed under the GNU GPL version 3 or higher .
-
- Copyright 2014-2016 Joey Hess <>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.MetaData where
import Command
import Annex.MetaData
import Annex.VectorClock
import... | null | https://raw.githubusercontent.com/RichiH/git-annex/bbcad2b0af8cd9264d0cb86e6ca126ae626171f3/Command/MetaData.hs | haskell | a larger object.
the same timestamp, since the order of adds and removals
of the same metadata value would then be indeterminate.
so the timestamp will always be different. This is
probably less expensive than cleaner methods,
such as taking from a list of increasing timestamps. | git - annex command
-
- Copyright 2014 - 2016 < >
-
- Licensed under the GNU GPL version 3 or higher .
-
- Copyright 2014-2016 Joey Hess <>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.MetaData where
import Command
import Annex.MetaData
import Annex.VectorClock
import... |
c20e30a079000086c603fc03f4738343a5641178aace7aa8518192ba80eb6cfc | nervous-systems/cljs-lambda | args.clj | (ns leiningen.cljs-lambda.args)
(def ^:dynamic *region* nil)
(def ^:dynamic *aws-profile* nil)
(let [coercions {:create #(Boolean/parseBoolean %)
:timeout #(Integer/parseInt %)
:memory-size #(Integer/parseInt %)
:parallel #(Integer/parseInt %)}
->ar... | null | https://raw.githubusercontent.com/nervous-systems/cljs-lambda/ecd74ec7046e619b3c097c222124fea4b9973241/plugin/src/leiningen/cljs_lambda/args.clj | clojure | (ns leiningen.cljs-lambda.args)
(def ^:dynamic *region* nil)
(def ^:dynamic *aws-profile* nil)
(let [coercions {:create #(Boolean/parseBoolean %)
:timeout #(Integer/parseInt %)
:memory-size #(Integer/parseInt %)
:parallel #(Integer/parseInt %)}
->ar... | |
b4632b6554fdb78c7e2fbdf11cf31b318ff4acf681b3aaadcc069f30cf037902 | haskell-distributed/network-transport-tcp | JustPingTwoSocketPairs.hs | # LANGUAGE CPP , BangPatterns #
module Main where
import Control.Monad
import Data.Int
import Network.Socket
( AddrInfo, AddrInfoFlag (AI_PASSIVE), HostName, ServiceName, Socket
, SocketType (Stream), SocketOption (ReuseAddr, NoDelay)
, accept, addrAddress, addrFlags, addrFamily, bindSocket, defaultProtocol
... | null | https://raw.githubusercontent.com/haskell-distributed/network-transport-tcp/2cb34ba7102cfa68ec86b562a96b07c1a64016f3/benchmarks/JustPingTwoSocketPairs.hs | haskell | Start the server
Set up multiplexing channel
Wait for incoming connections (pings from the client)
Start the client
Set up multiplexing channel
Wait for incoming connections (pongs from the server)
Wait for the client to finish
putStrLn $ "client received " ++ unpack bs
| Receive a package
| Send a package
|... | # LANGUAGE CPP , BangPatterns #
module Main where
import Control.Monad
import Data.Int
import Network.Socket
( AddrInfo, AddrInfoFlag (AI_PASSIVE), HostName, ServiceName, Socket
, SocketType (Stream), SocketOption (ReuseAddr, NoDelay)
, accept, addrAddress, addrFlags, addrFamily, bindSocket, defaultProtocol
... |
cb812129473c980220f83fa311c252cbbdced2ae9abe30e0b5f080642a3f2657 | borkdude/advent-of-cljc | clashthebunny.cljc | (ns aoc.y2018.d05.clashthebunny
(:refer-clojure :exclude [read-string format])
(:require
[aoc.utils :as u :refer [deftest read-string format]]
[aoc.y2018.d05.data :refer [input answer-1 answer-2]]
[clojure.test :refer [is testing]]
[clojure.string :as s]
[clojure.core.reducers :as r]))
(defn parse [... | null | https://raw.githubusercontent.com/borkdude/advent-of-cljc/17c8abb876b95ab01eee418f1da2e402e845c596/src/aoc/y2018/d05/clashthebunny.cljc | clojure | (ns aoc.y2018.d05.clashthebunny
(:refer-clojure :exclude [read-string format])
(:require
[aoc.utils :as u :refer [deftest read-string format]]
[aoc.y2018.d05.data :refer [input answer-1 answer-2]]
[clojure.test :refer [is testing]]
[clojure.string :as s]
[clojure.core.reducers :as r]))
(defn parse [... | |
5d22a9e18c80c4d32f34c2e53fc8277f45d4ab018c83dce347fef7efe173e97d | VincentToups/racket-lib | initial-state.rkt | #lang racket
(require pure-lands/utilities/nested-dicts)
(define initial-letters
(>> 'f 2 'o 4 'd 2))
(define initial-plot
(>> 'wet #f
'planted #f
'weeds 0
'harvest #f
'time-since-planting #f))
(define initial-state
(>> 'stamina 6
'turn 0
'points 0
'weather 'clear
... | null | https://raw.githubusercontent.com/VincentToups/racket-lib/d8aed0959fd148615b000ceecd7b8a6128cfcfa8/pure-lands/chapter-01/agrilex/initial-state.rkt | racket | #lang racket
(require pure-lands/utilities/nested-dicts)
(define initial-letters
(>> 'f 2 'o 4 'd 2))
(define initial-plot
(>> 'wet #f
'planted #f
'weeds 0
'harvest #f
'time-since-planting #f))
(define initial-state
(>> 'stamina 6
'turn 0
'points 0
'weather 'clear
... | |
3cc12d27bd13b683f7232beac392b372fcddad5c15f4ebe529a5cffacd1a3058 | byorgey/comprog-hs | NumberTheory.hs | -programming-in-haskell-primes-and-factoring/
-- -programming-in-haskell-modular-arithmetic-part-1/
-- -programming-in-haskell-modular-arithmetic-part-2/
module NumberTheory where
import Data.Map (Map)
import qualified Data.Map as M
import Control.Arrow
import Data.List ... | null | https://raw.githubusercontent.com/byorgey/comprog-hs/a42d35bdaef6fb555cc896f6c7e509b0cb9b7cd7/NumberTheory.hs | haskell | -programming-in-haskell-modular-arithmetic-part-1/
-programming-in-haskell-modular-arithmetic-part-2/
----------------------------------------------------------
----------------------------------------------------------
egcd a b = (g,x,y)
g is the gcd of a and b, and ax + by = g
g = bx + (a mod b)y
= bx + (a ... | -programming-in-haskell-primes-and-factoring/
module NumberTheory where
import Data.Map (Map)
import qualified Data.Map as M
import Control.Arrow
import Data.List (group, sort)
Modular exponentiation
modexp :: Integer -> Integer -> Integer -> Integer
modexp _ 0 _ = 1... |
6ff965c480c8bac3bee665580783c8efbf559399e8c09e4ed4fd85306d2e1e79 | tezos/tezos-mirror | irmin_store.ml | (*****************************************************************************)
(* *)
(* Open Source License *)
Copyright ( c ) 2022 Nomadic Labs , < >
Copyright ( c ) 2022... | null | https://raw.githubusercontent.com/tezos/tezos-mirror/aa878d424fddb85745e5445ed89432dd9d6380cc/src/lib_layer2_store/irmin_store.ml | ocaml | ***************************************************************************
Open Source License
Permission is h... | Copyright ( c ) 2022 Nomadic Labs , < >
Copyright ( c ) 2022 , < >
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 " , WITHOUT WARRA... |
bdaf5d42a93f59c5b759ac2ff5671dc8523083bd460bcf571f6efdf597d896e7 | synduce/Synduce | obfuscated_length.ml | * @synduce --no - gropt
type 'a list =
| Elt of 'a
| Cons of 'a * 'a list
(* Representation function: sort a list. *)
let rec repr = function
| Elt x -> Elt x
| Cons (hd, tl) -> insert hd (repr tl)
and insert y = function
| Elt x -> if y < x then Cons (y, Elt x) else Cons (x, Elt y)
| Cons (hd, tl) -> if... | null | https://raw.githubusercontent.com/synduce/Synduce/d453b04cfb507395908a270b1906f5ac34298d29/benchmarks/constraints/size/obfuscated_length.ml | ocaml | Representation function: sort a list. | * @synduce --no - gropt
type 'a list =
| Elt of 'a
| Cons of 'a * 'a list
let rec repr = function
| Elt x -> Elt x
| Cons (hd, tl) -> insert hd (repr tl)
and insert y = function
| Elt x -> if y < x then Cons (y, Elt x) else Cons (x, Elt y)
| Cons (hd, tl) -> if y < hd then Cons (y, Cons (hd, tl)) else Co... |
1bbe612837134256fa917a358694afb9593720c047e208192112838bf3069a5f | facebook/pyre-check | abstractRootedTreeDomain.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/98b8362ffa5c715c708676c1a37a52647ce79fe0/source/domains/abstractRootedTreeDomain.ml | ocaml | TODO(T132410158) Add a module-level doc comment. |
* 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... |
515ebd35b5d3cf3b7114c8443c401aa4cc9992e0702579134c3c46fb920bbfab | auser/beehive | bees.erl | -module (bees).
-include ("beehive.hrl").
-include ("common.hrl").
-include_lib("stdlib/include/qlc.hrl").
-include_lib("kernel/include/file.hrl").
%% DATABASE STUFF
-export ([
create/1,
read/1,
save/1,
update/2,
delete/1,
find_by_name/1,
find_by_i... | null | https://raw.githubusercontent.com/auser/beehive/dfe257701b21c56a50af73c8203ecac60ed21991/lib/erlang/apps/beehive/src/bh_models/bees.erl | erlang | DATABASE STUFF
APPLICATION STUFF
Create a new bee
Save the bee
TODO: Investigate why this EVER happens...
This should ALWAYS be not_found, but just to be safe
Find alls
There has got to be a better way?
-------------------------------------------------------------------
@spec (Bee::bee()) -> {ok, Value}
@d... | -module (bees).
-include ("beehive.hrl").
-include ("common.hrl").
-include_lib("stdlib/include/qlc.hrl").
-include_lib("kernel/include/file.hrl").
-export ([
create/1,
read/1,
save/1,
update/2,
delete/1,
find_by_name/1,
find_by_id/1,
fin... |
b3148900002ff4658d06f754a594b3708740a1f13edc6628fec89dd6986836f3 | yzh44yzh/practical_erlang | server3.erl | -module(server3).
-export([start/0, start/1, server/1, accept/2]).
start() ->
start(1234).
start(Port) ->
spawn(?MODULE, server, [Port]),
ok.
server(Port) ->
io:format("start server at port ~p~n", [Port]),
{ok, ListenSocket} = gen_tcp:listen(Port, [binary, {active, false}, {packet, 2}]),
[sp... | null | https://raw.githubusercontent.com/yzh44yzh/practical_erlang/c9eec8cf44e152bf50d9bc6d5cb87fee4764f609/16_sockets/server3.erl | erlang | -module(server3).
-export([start/0, start/1, server/1, accept/2]).
start() ->
start(1234).
start(Port) ->
spawn(?MODULE, server, [Port]),
ok.
server(Port) ->
io:format("start server at port ~p~n", [Port]),
{ok, ListenSocket} = gen_tcp:listen(Port, [binary, {active, false}, {packet, 2}]),
[sp... | |
f5f6cc77bd9107351ac11bc7e1adda3de38b08d1b8a3fa0e87f66bb3320cdb97 | c-cube/funarith | Prime_zarith.mli |
include Funarith.Prime.S with type Z.t = Z.t
| null | https://raw.githubusercontent.com/c-cube/funarith/1c86ac45e9608efaa761e3f14455402730885339/src/zarith/Prime_zarith.mli | ocaml |
include Funarith.Prime.S with type Z.t = Z.t
| |
d99850e91ba104f1babea86d3b092574284fdb926524b06ccfa3840a1e365819 | camfort/camfort | ReprintSpec.hs | {-# OPTIONS -Wno-orphans #-}
# LANGUAGE FlexibleInstances #
module Camfort.ReprintSpec (spec) where
import Camfort.Reprint
import qualified Data.ByteString.Char8 as B
import qualified Language.Fortran.Util.Position as FU
import Test.Hspec
import Test.QuickCheck
spec :: Spec
spec =
des... | null | https://raw.githubusercontent.com/camfort/camfort/3421e85f6fbbcaa6503a266b3fae029a09d2ff24/tests/Camfort/ReprintSpec.hs | haskell | # OPTIONS -Wno-orphans #
TODO: Fix this
context "Integration test with synthesising a spec" $ do
simpleIn = simpleDir </> "simple.f90"
LitMixed False
actual <- runIO $ readFile simpleOut
expected <- runIO $ readFile simpleExpected
--
Given a lower - bound and upper - bound pair of FU.Positions... | # LANGUAGE FlexibleInstances #
module Camfort.ReprintSpec (spec) where
import Camfort.Reprint
import qualified Data.ByteString.Char8 as B
import qualified Language.Fortran.Util.Position as FU
import Test.Hspec
import Test.QuickCheck
spec :: Spec
spec =
describe "subtext function tests... |
de6f9d860c030af0e8b5337ffe0e1cc633a8437760e29402ad2b7a83076f821e | nikomatsakis/a-mir-formality | substitution.rkt | #lang racket
(require redex/reduction-semantics
"grammar.rkt"
"env.rkt"
)
(provide substitution-to-fresh-vars
apply-substitution
apply-substitution-from-env
apply-substitution-to-env
create-substitution
env-fix
substitution-fix
su... | null | https://raw.githubusercontent.com/nikomatsakis/a-mir-formality/71be4d5c4bd5e91d326277eaedd19a7abe3ac76a/racket-src/logic/substitution.rkt | racket | Returns the variables that are mapped by a substitution.
Given a set of kinded-var-ids, creates a substituion map that maps them to
fresh names.
Given a set of kinded-var-ids and values for those var-ids, creates a substitution.
Substitute substitution-map any ==> applies a substitution map to anything
Substitute... | #lang racket
(require redex/reduction-semantics
"grammar.rkt"
"env.rkt"
)
(provide substitution-to-fresh-vars
apply-substitution
apply-substitution-from-env
apply-substitution-to-env
create-substitution
env-fix
substitution-fix
su... |
9200ea4823dd91574f75b5bd21f8e8f154db0551849219e00bfcc2a059baec87 | nyinyithann/favemarks | common.ml | open Core
module T = ANSITerminal
let is_whitespace s = s |> String.strip |> String.is_empty
let strip_and_lowercase s = String.(lowercase @@ strip s)
let epoch_str () = Time_unix.to_string Time_unix.epoch
let map_input_to_result input =
if String.(strip_and_lowercase input = "") then Error "" else Ok input
;;
let... | null | https://raw.githubusercontent.com/nyinyithann/favemarks/55fb52d4f3efeae8ef478f1fe098456196e80dea/src/common/common.ml | ocaml | Just a name | open Core
module T = ANSITerminal
let is_whitespace s = s |> String.strip |> String.is_empty
let strip_and_lowercase s = String.(lowercase @@ strip s)
let epoch_str () = Time_unix.to_string Time_unix.epoch
let map_input_to_result input =
if String.(strip_and_lowercase input = "") then Error "" else Ok input
;;
let... |
09f9c14f8431617a5dbbf818cef3bbec5bc45d81ae0e7222026fc25c2d233352 | TyOverby/mono | request.ml | include Cohttp.Request
| null | https://raw.githubusercontent.com/TyOverby/mono/8d6b3484d5db63f2f5472c7367986ea30290764d/vendor/mirage-ocaml-cohttp/cohttp-async/src/request.ml | ocaml | include Cohttp.Request
| |
0cea5c12e7f8dad4393f4133201c9fc13723d9ad2f3e598e9e94cbc4c5769a7d | stathissideris/positano | time.clj | (ns positano.time
(:require [clojure.string :as str]))
(def second-in-millis 1000)
(def minute (* 60 second-in-millis))
(def hour (* 60 minute))
(def day (* 24 hour))
(def month (* 30 day))
(def year (* 365 day))
(defn to-millis [x]
(.getTime x))
(defn duration [millis]
(let [years (int (/ millis year))
... | null | https://raw.githubusercontent.com/stathissideris/positano/ca5126714b4bcf108726d930ab61a875759214ae/src/positano/time.clj | clojure | (ns positano.time
(:require [clojure.string :as str]))
(def second-in-millis 1000)
(def minute (* 60 second-in-millis))
(def hour (* 60 minute))
(def day (* 24 hour))
(def month (* 30 day))
(def year (* 365 day))
(defn to-millis [x]
(.getTime x))
(defn duration [millis]
(let [years (int (/ millis year))
... | |
66c0fb680b89029284ed77edd5279414c44e17355b2d792a38dbaa6f73c41ffc | snoyberg/conduit | Conduit.hs | # OPTIONS_HADDOCK not - home #
# LANGUAGE DeriveFunctor #
# LANGUAGE FlexibleInstances #
# LANGUAGE FlexibleContexts #
# LANGUAGE CPP #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE UndecidableInstances #
{-# LANGUAGE RankNTypes #-}
# LANGUAGE TupleSections #
# LANGUAGE Trustworthy #
# LANGUAGE TypeFamilies #
module Da... | null | https://raw.githubusercontent.com/snoyberg/conduit/28fac5e999f201b8fe99b941932725e4201a3774/conduit/src/Data/Conduit/Internal/Conduit.hs | haskell | # LANGUAGE RankNTypes #
** Types
** Sealed
** Primitives
** Composition
** Generalizing
** Cleanup
** Exceptions
** Utilities
| Core datatype of the conduit package. This type represents a general
type.
Since 1.3.0
| In order to provide for efficient monadic composition, the
@ConduitT@ type is implemented... | # OPTIONS_HADDOCK not - home #
# LANGUAGE DeriveFunctor #
# LANGUAGE FlexibleInstances #
# LANGUAGE FlexibleContexts #
# LANGUAGE CPP #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE UndecidableInstances #
# LANGUAGE TupleSections #
# LANGUAGE Trustworthy #
# LANGUAGE TypeFamilies #
module Data.Conduit.Internal.Conduit
... |
8def97ad40478bb0a0573f0382fd2c376cea90cbfbb7eb935df172bb69363eb0 | bsansouci/bsb-native | frames.ml | (***********************************************************************)
(* *)
(* OCaml *)
(* *)
, projet Cr... | null | https://raw.githubusercontent.com/bsansouci/bsb-native/9a89457783d6e80deb0fba9ca7372c10a768a9ea/vendor/ocaml/debugger/frames.ml | ocaml | *********************************************************************
OCaml
... | , projet Cristal , INRIA Rocquencourt
OCaml port by and
Copyright 1996 Institut National de Recherche en Informatique et
en Automatique . All rights reserved . This file is distributed
under the terms of the Q Public License version 1.0 .
open In... |
6d458735b6b5025eed7cdf7a28b51d94cf6be6e189de618ba9f38dd657747bbb | thi-ng/geom | core.cljc | (ns thi.ng.geom.viz.core
(:require
[thi.ng.geom.core :as g]
[thi.ng.geom.vector :as v :refer [vec2 vec3]]
[thi.ng.geom.utils :as gu]
[thi.ng.geom.svg.core :as svg]
[thi.ng.ndarray.core :as nd]
[thi.ng.ndarray.contours :as contours]
[thi.ng.math.core :as m]
[thi.ng.strf.core :as f]))
;; This m... | null | https://raw.githubusercontent.com/thi-ng/geom/85783a1f87670c5821473298fa0b491bd40c3028/src/thi/ng/geom/viz/core.cljc | clojure | This module currently consists of this single namespace dedicated
to creating 2D (and soon 3D too) data visualizations in an output
format agnostic way. To achieve that, an overall declarative and
pipelined approach has been taken to create these visualizations:
axis definitions, layout arguments/handlers, sty... | (ns thi.ng.geom.viz.core
(:require
[thi.ng.geom.core :as g]
[thi.ng.geom.vector :as v :refer [vec2 vec3]]
[thi.ng.geom.utils :as gu]
[thi.ng.geom.svg.core :as svg]
[thi.ng.ndarray.core :as nd]
[thi.ng.ndarray.contours :as contours]
[thi.ng.math.core :as m]
[thi.ng.strf.core :as f]))
1 . We ... |
22060a5aed4bdb1d9aa39ffc2866088b5019ff48a99b64e37aeeae76e4d2fe4e | raptazure/experiments | MyList.hs | module MyList where
data MyList a
= Cons a (MyList a)
| MyNil
deriving (Show, Eq)
A simple linked list module
Some examples :
mylist = ( Cons 10 ( Cons 99 ( Cons 11 ( Cons 1 MyNil ) ) ) )
myHead myList # = > 10
myTail myList # = > Cons 99 ( Cons 11 (... | null | https://raw.githubusercontent.com/raptazure/experiments/c48263980d1ce22ee9407ff8dcf0cf5091b01c70/haskell/wiwinwlh/dataStructures/src/MyList.hs | haskell | module MyList where
data MyList a
= Cons a (MyList a)
| MyNil
deriving (Show, Eq)
A simple linked list module
Some examples :
mylist = ( Cons 10 ( Cons 99 ( Cons 11 ( Cons 1 MyNil ) ) ) )
myHead myList # = > 10
myTail myList # = > Cons 99 ( Cons 11 (... | |
89c70cb18c0707ba801e9342553daa22c9fb1f1ebff3409286e4e1fec9cd8b4f | Frechmatz/cl-synthesizer | agent.lisp | (in-package :cl-synthesizer-monitor-csv-file-agent)
(defun make-symbol-impl (name num package)
(if num
(intern (format nil "~a-~a" (string-upcase name) num) package)
(intern (string-upcase name) package)))
(defun make-keyword (name num)
(make-symbol-impl name num "KEYWORD"))
(defun make-keyword-list ... | null | https://raw.githubusercontent.com/Frechmatz/cl-synthesizer/679eb91d1814ad24c915b39b12685af6ffd4292f/src/monitor/csv-file/agent.lisp | lisp | Ordered list of channels (we do not want to depend on order of input keys
provided by the :inputs function of the csv file writer module.) | (in-package :cl-synthesizer-monitor-csv-file-agent)
(defun make-symbol-impl (name num package)
(if num
(intern (format nil "~a-~a" (string-upcase name) num) package)
(intern (string-upcase name) package)))
(defun make-keyword (name num)
(make-symbol-impl name num "KEYWORD"))
(defun make-keyword-list ... |
d0812562d5b7888aad37d87f762c9dee3b451f9f2d1d1bcb171368bb6b436113 | dym/movitz | bignums.lisp | ;;;;------------------------------------------------------------------
;;;;
Copyright ( C ) 2003 - 2005 ,
Department of Computer Science , University of Tromso , Norway .
;;;;
;;;; For distribution policy, see the accompanying file COPYING.
;;;;
;;;; Filename: bignums.lisp
;;;; Description:
Au... | null | https://raw.githubusercontent.com/dym/movitz/56176e1ebe3eabc15c768df92eca7df3c197cb3d/losp/muerte/bignums.lisp | lisp | ------------------------------------------------------------------
For distribution policy, see the accompanying file COPYING.
Filename: bignums.lisp
Description:
------------------------------------------------------------------
EBX=0 => nothing to do.
Set up ato... | Copyright ( C ) 2003 - 2005 ,
Department of Computer Science , University of Tromso , Norway .
Author : < >
Created at : Sat Jul 17 19:42:57 2004
$ I d : bignums.lisp , v 1.18 2008/02/04 15:11:16 Exp $
(require :muerte/basic-macros)
(require :muerte/typep)
(require :muerte/arithmetic-m... |
223758094e463d639b2a1d09e4b3ffa55f2fa4e9fca562b67190f24909cdf23d | ambuc/pipes | Types.hs | # LANGUAGE TemplateHaskell #
module Types where
import qualified Data.Array
import qualified Lens.Micro.TH
data Difficulty = Easy | Mid | Hard deriving (Eq)
data Dir = N | E | W | S
data FlowDir = In | Out deriving (Eq, Show)
type Tile = (Bool, Bool, Bool, Bool) -- N E W S
type Flow = (Flo... | null | https://raw.githubusercontent.com/ambuc/pipes/92cd66b4036c8e64d44171c546fe6f5d8858d738/src/Types.hs | haskell | N E W S
N E W S
(Y, X)
(Y, X)
(Y, X)
(Y, X)
tick time
game time | # LANGUAGE TemplateHaskell #
module Types where
import qualified Data.Array
import qualified Lens.Micro.TH
data Difficulty = Easy | Mid | Hard deriving (Eq)
data Dir = N | E | W | S
data FlowDir = In | Out deriving (Eq, Show)
data Square = Square { _tile :: Tile
, ... |
785a366bb283a7f0ea6b65515bf8a625c2d636a25d681d560e1708c01da3f742 | backtracking/bibtex2html | latexmacros.ml | (**************************************************************************)
(* bibtex2html - A BibTeX to HTML translator *)
Copyright ( C ) 1997 - 2014 and
(* *)
(* This software is free software; you can r... | null | https://raw.githubusercontent.com/backtracking/bibtex2html/7c9547da79a13c3accffc9947c846df96a6edd68/latexmacros.ml | ocaml | ************************************************************************
bibtex2html - A BibTeX to HTML translator
This software is free software; you can redistribute it and/or
... | Copyright ( C ) 1997 - 2014 and
modify it under the terms of the GNU General Public
License version 2 , as published by the Free Software Foundation .
See the GNU General Public License version 2 for more details
This code is an adaptation of a code written by ... |
2bf760f177933901b7cb4006b4449e0f2320b46dfe521adff61f5175da4f43f6 | charlieg/Sparser | object.lisp | ;;; -*- Mode:Lisp; Syntax:Common-Lisp; Package:SPARSER -*-
copyright ( c ) 1993 -- all rights reserved
;;;
;;; File: "object"
;;; module: "interface;windows:articles:"
Version : November 1993
;; initiated 11/11/93
(in-package :sparser)
;;;--------
;;; window
;;;--------
(defclass text-output-... | null | https://raw.githubusercontent.com/charlieg/Sparser/b9bb7d01d2e40f783f3214fc104062db3d15e608/Sparser/code/s/interface/workbench/object.lisp | lisp | -*- Mode:Lisp; Syntax:Common-Lisp; Package:SPARSER -*-
File: "object"
module: "interface;windows:articles:"
initiated 11/11/93
--------
window
--------
"times" prints them as close brackets
"monaco" prints both -- as glifs for shift-option or something
--------------------------
displaying to the windo... | copyright ( c ) 1993 -- all rights reserved
Version : November 1993
(in-package :sparser)
(defclass text-output-window (ccl::fred-window)
()
(:default-initargs
:window-type :document-with-grow
:window-title "test"
:scratch-p t
:view-position #@(2 40)
:view-size #@(500 100)
... |
06adfbf99841c88496bb1ebf2966d700363b1191af0217c849ff43751ad5c4a3 | gfngfn/Sesterl | constructorAttribute.ml |
open MyUtil
open Syntax
type t = {
target_atom : (string ranged) option;
}
let default =
{ target_atom = None }
let decode (attrs : attribute list) : t * attribute_warning list =
let (acc, warn_acc) =
attrs |> List.fold_left (fun (acc, warn_acc) attr ->
let Attribute((rng, attr_main)) = attr in
... | null | https://raw.githubusercontent.com/gfngfn/Sesterl/4ac4d84e844c093da82759be8f27cc2c89a7ced6/src/constructorAttribute.ml | ocaml |
open MyUtil
open Syntax
type t = {
target_atom : (string ranged) option;
}
let default =
{ target_atom = None }
let decode (attrs : attribute list) : t * attribute_warning list =
let (acc, warn_acc) =
attrs |> List.fold_left (fun (acc, warn_acc) attr ->
let Attribute((rng, attr_main)) = attr in
... | |
fe4d24493c5e9b731845835343fd8af7d62a5ba24644c248b521839fc5a3bb75 | spell-music/csound-expression | TabQueue.hs | module Csound.Typed.Plugins.TabQueue(
tabQueue2_append, tabQueue2_delete, tabQueue2_hasElements, tabQueue2_readLastElement
) where
import Data.Boolean
import Control.Monad.Trans.Class
import Csound.Dynamic
import Csound.Typed.Types
import Csound.Typed.GlobalState
import qualified Csound.Typed.GlobalState.Element... | null | https://raw.githubusercontent.com/spell-music/csound-expression/29c1611172153347b16d0b6b133e4db61a7218d5/csound-expression-typed/src/Csound/Typed/Plugins/TabQueue.hs | haskell | -----------------------------------------------------------------------------
table queue for midi notes
|
| Delete by pitch
| Queue is not empty | module Csound.Typed.Plugins.TabQueue(
tabQueue2_append, tabQueue2_delete, tabQueue2_hasElements, tabQueue2_readLastElement
) where
import Data.Boolean
import Control.Monad.Trans.Class
import Csound.Dynamic
import Csound.Typed.Types
import Csound.Typed.GlobalState
import qualified Csound.Typed.GlobalState.Element... |
cc73ee3ba0009762465e8ad3a3a6d1190b7a0eb853477c6f81899a9249deed20 | opencog/pln | conditional-partial-instantiation.scm | ;; =======================================================================
Conditional Partial Instantiation Meta Rule
;;
;; ImplicationScopeLink
V1 , V2 , V3
;; P
;; Q
;; |-
;; T2
;; T3
;; |-
;; ImplicationScopeLink
;; V1
;; P[V2->T2,V3->T3]
;; Q[V2->T2,V3->T3]
;;
The fact that there 3 ... | null | https://raw.githubusercontent.com/opencog/pln/52dc099e21393892cf5529fef687a69682436b2d/opencog/pln/meta-rules/predicate/conditional-partial-instantiation.scm | scheme | =======================================================================
ImplicationScopeLink
P
Q
|-
T2
T3
|-
ImplicationScopeLink
V1
P[V2->T2,V3->T3]
Q[V2->T2,V3->T3]
-----------------------------------------------------------------------
Conditional partial instantiation rule ;... | Conditional Partial Instantiation Meta Rule
V1 , V2 , V3
The fact that there 3 variables is hardcoded for now .
(use-modules (srfi srfi-1))
(use-modules (opencog exec))
(use-modules (opencog logger))
Hard code a 3 - ary ImplicationScope turning into a unary
ImplicationScope where V2 and V3 are substitut... |
9c20726586234802133ec7c845fe9a4e0d97776a17cdbcb5e34d2c6b55a3fe28 | shayan-najd/NativeMetaprogramming | T5236.hs | # LANGUAGE MultiParamTypeClasses , FunctionalDependencies , FlexibleContexts #
module T5236 where
data A
data B
class Id a b | a -> b, b -> a
instance Id A A
instance Id B B
loop :: Id A B => Bool
loop = True
f : :
-- f = loop
| null | https://raw.githubusercontent.com/shayan-najd/NativeMetaprogramming/24e5f85990642d3f0b0044be4327b8f52fce2ba3/testsuite/tests/typecheck/should_fail/T5236.hs | haskell | f = loop | # LANGUAGE MultiParamTypeClasses , FunctionalDependencies , FlexibleContexts #
module T5236 where
data A
data B
class Id a b | a -> b, b -> a
instance Id A A
instance Id B B
loop :: Id A B => Bool
loop = True
f : :
|
a35548795b23b05244b5247a2ed4952ac9100a2b339d321ab165018141a4f909 | electric-sql/vaxine | prop_flag_dw.erl | %% -------------------------------------------------------------------
%%
Copyright < 2013 - 2018 > <
Technische Universität Kaiserslautern , Germany
, France
Universidade NOVA de Lisboa , Portugal
Université catholique de Louvain ( UCL ) , Belgique
, Portugal
%% >
%%
This file is provided... | null | https://raw.githubusercontent.com/electric-sql/vaxine/872a83ea8d4935a52c7b850bb17ab099ee9c346b/apps/antidote_crdt/test/prop_flag_dw.erl | erlang | -------------------------------------------------------------------
>
Version 2.0 (the "License"); you may not use this file
a copy of the License at
-2.0
Unless required by applicable law or agreed to in writing,
KIND, either expressed or implied. See the License for the
specific language governing perm... | Copyright < 2013 - 2018 > <
Technische Universität Kaiserslautern , Germany
, France
Universidade NOVA de Lisboa , Portugal
Université catholique de Louvain ( UCL ) , Belgique
, Portugal
This file is provided to you under the Apache License ,
except in compliance with the License . You... |
11026efc10dabd323ac71dbd35cfba957de18abaa21ea4df4681b6450b2b5691 | jonase/eastwood | priority_map.clj | Copyright ( c ) , and contributors . All rights reserved .
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are ag... | null | https://raw.githubusercontent.com/jonase/eastwood/caf87206706d51d59b04c5ad0c61ff7683d70cb1/copied-deps/eastwood/copieddeps/dep5/clojure/data/priority_map.clj | clojure | The use and distribution terms for this software are covered by the
Eclipse Public License 1.0 (-1.0.php)
which can be found in the file epl-v10.html at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not remove ... | Copyright ( c ) , and contributors . All rights reserved .
by ( )
Last update - July 9 , 2018
(ns
^{:author "Mark Engelberg",
:doc "A priority map is very similar to a sorted map, but whereas a sorted map produces a
sequence of the entries sorted by key, a priority map produces the entries s... |
62568dcb79a062e626ac1548ca41d007dde0c09c3f0969259cf72b5c7e558a01 | l-x/deeperl | deeperl_glossary_delete.erl | @private
-module(deeperl_glossary_delete).
-behaviour(gen_deeperl_method).
%% API
-export([request/1, response/1]).
request({GlossaryId}) ->
{
delete,
{
"/v2/glossaries/" ++ GlossaryId,
[]
}
}.
response(_Body) ->
ok.
| null | https://raw.githubusercontent.com/l-x/deeperl/834fd8101e7057e090d5ab17b2a68c75f8e1656f/src/deeperl_glossary_delete.erl | erlang | API | @private
-module(deeperl_glossary_delete).
-behaviour(gen_deeperl_method).
-export([request/1, response/1]).
request({GlossaryId}) ->
{
delete,
{
"/v2/glossaries/" ++ GlossaryId,
[]
}
}.
response(_Body) ->
ok.
|
469ef5950de28d71a5545ea345a1be937d2e1ada67c7eccb18f014954e560502 | processone/ejabberd | prosody2ejabberd.erl | %%%-------------------------------------------------------------------
%%% File : prosody2ejabberd.erl
Author : < >
Created : 20 Jan 2016 by < >
%%%
%%%
ejabberd , Copyright ( C ) 2002 - 2023 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
modify it under the terms... | null | https://raw.githubusercontent.com/processone/ejabberd/c103182bc7e5b8a8ab123ce02d1959a54e939480/src/prosody2ejabberd.erl | erlang | -------------------------------------------------------------------
File : prosody2ejabberd.erl
This program is free software; you can redistribute it and/or
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even... | Author : < >
Created : 20 Jan 2016 by < >
ejabberd , Copyright ( C ) 2002 - 2023 ProcessOne
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation ; either version 2 of the
You should have received a copy of the GNU General Public License along
... |
4fd9a72ed064e02801abf364c10ff93d4916325719cb9bbdb7f745480f09bc5b | defndaines/meiro | nethack.clj | (ns meiro.nethack
"Generate a NetHack-style ASCII representation of a maze."
(:require [clojure.string :as string]))
(def ^:private horizontal-wall "-")
(def ^:private verticle-wall "|")
(def ^:private inside-cell ".")
(def ^:private cell-link ".")
; (def ^:private start-cell "@"
; (def ^:private end-cell "$")
(d... | null | https://raw.githubusercontent.com/defndaines/meiro/f91d4dee2842c056a162c861baf8b71bb4fb140c/src/meiro/nethack.clj | clojure | (def ^:private start-cell "@"
(def ^:private end-cell "$") | (ns meiro.nethack
"Generate a NetHack-style ASCII representation of a maze."
(:require [clojure.string :as string]))
(def ^:private horizontal-wall "-")
(def ^:private verticle-wall "|")
(def ^:private inside-cell ".")
(def ^:private cell-link ".")
(def ^:private corridor "#")
(def ^:private corridor-wall " ")
... |
0987ec05c7b7890d37da4e6b0ab8f8c461e604d8c996aa172c648cc1f2ac354c | jorgenschaefer/prometheus | account.scm | ;;; This is a simple account-keeping object.
;;; It's just like a normal object
(define account (*the-root-object* 'clone))
;;; But it has a balance
(account 'add-value-slot! 'balance 'set-balance! 0)
;;; Which can be modified
(account 'add-method-slot! 'payment!
(lambda (self resend amount)
(sel... | null | https://raw.githubusercontent.com/jorgenschaefer/prometheus/d5e40cd2403a118ee48f5b37d5d65966d60bc4ac/examples/account.scm | scheme | This is a simple account-keeping object.
It's just like a normal object
But it has a balance
Which can be modified
Some tests:
The typing for the slot definitions above can be rather tedious.
A method can be added with the DEFINE-METHOD syntax. This code is
equivalent to the code above which adds the PAYMENT! m... |
(define account (*the-root-object* 'clone))
(account 'add-value-slot! 'balance 'set-balance! 0)
(account 'add-method-slot! 'payment!
(lambda (self resend amount)
(self 'set-balance!
(+ (self 'balance)
amount))))
(define a1 (account 'clone))
(define a2 (accoun... |
670d19f6103f64b88cb178833d946d4edd34a2ff64f53ea6781e5d5216415cd7 | zadean/xqerl | fn_codepoints_to_string_SUITE.erl | -module('fn_codepoints_to_string_SUITE').
-include_lib("common_test/include/ct.hrl").
-export([
all/0,
groups/0,
suite/0
]).
-export([
init_per_suite/1,
init_per_group/2,
end_per_group/2,
end_per_suite/1
]).
-export(['fn-codepoints-to-string1args-1'/1]).
-export(['fn-codepoints-to-string... | null | https://raw.githubusercontent.com/zadean/xqerl/1a94833e996435495922346010ce918b4b0717f2/test/fn/fn_codepoints_to_string_SUITE.erl | erlang | &'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP" | -module('fn_codepoints_to_string_SUITE').
-include_lib("common_test/include/ct.hrl").
-export([
all/0,
groups/0,
suite/0
]).
-export([
init_per_suite/1,
init_per_group/2,
end_per_group/2,
end_per_suite/1
]).
-export(['fn-codepoints-to-string1args-1'/1]).
-export(['fn-codepoints-to-string... |
486560c17a660ad8d6dc6f944a4c89ebb20d605f74a3e03aaa4531f368fdc956 | grin-compiler/grin | Lint.hs | # LANGUAGE ViewPatterns , LambdaCase , TupleSections , RecordWildCards , OverloadedStrings , ScopedTypeVariables #
{-# LANGUAGE MultiWayIf #-}
module Grin.ExtendedSyntax.Lint
( lint
, allWarnings
, noDDEWarnings
, Error(..)
) where
import Text.Printf
import Data.Functor.Foldable as Foldable
import qualified... | null | https://raw.githubusercontent.com/grin-compiler/grin/44ac2958810ecee969c8028d2d2a082d47fba51b/grin/src/Grin/ExtendedSyntax/Lint.hs | haskell | # LANGUAGE MultiWayIf #
TODO: remove redundant syntaxE s
Linter is responsible for the semantical checks of the program.
question:
how to show errors?
- annotate expressions with the error using cofree
- annotate expressionf with id using cofree, then build error map referencing to expressions
e... | # LANGUAGE ViewPatterns , LambdaCase , TupleSections , RecordWildCards , OverloadedStrings , ScopedTypeVariables #
module Grin.ExtendedSyntax.Lint
( lint
, allWarnings
, noDDEWarnings
, Error(..)
) where
import Text.Printf
import Data.Functor.Foldable as Foldable
import qualified Data.Foldable
import Contro... |
4fa4e879dd1987a4f4e11bf872b5e6a3ad03877a559ee5ed93574138660fead4 | mpenet/flex | playground.clj | (ns playground
(:require [ring.adapter.jetty :as j]
[exoscale.ex :as ex]
[s-exp.flex.limit.aimd :as limit]
[s-exp.flex :as f]
[s-exp.flex.interceptor :as ix]
[s-exp.flex.middleware]
[exoscale.interceptor]))
;; (def tf (bound-fn* println))
;; (re... | null | https://raw.githubusercontent.com/mpenet/flex/1a26ccc4c6aacd449bae7b6404802e0553445d59/dev/playground.clj | clojure | (def tf (bound-fn* println))
(remove-tap tf)
(add-tap tf)
simulate stable
simulate slowing down
simulate faster resp times | (ns playground
(:require [ring.adapter.jetty :as j]
[exoscale.ex :as ex]
[s-exp.flex.limit.aimd :as limit]
[s-exp.flex :as f]
[s-exp.flex.interceptor :as ix]
[s-exp.flex.middleware]
[exoscale.interceptor]))
(defn ok-response [s]
{:status 200
... |
8d52e3ea7d7feea21dba2c5b4971b82a474bc41b93b34911522baa8797a57af4 | ocsigen/ocsigenserver | ocsigen_multipart.ml | This code is inspired by mimestring.ml from OcamlNet
Copyright ,
Modified for Ocsigen / Lwt by and
VVV Check wether we should support int64 for large files ?
open Lwt.Infix
module S = Ocsigen_lib.Netstring_pcre
let section = Lwt_log.Section.make "ocsigen:server:multipart"
exception Multipart_error of ... | null | https://raw.githubusercontent.com/ocsigen/ocsigenserver/d468cf464dcc9f05f820c35f346ffdbe6b9c7931/src/server/ocsigen_multipart.ml | ocaml | The header must end with an empty line
Maybe the header is empty. In this case, there is an empty
line right at the beginning
Search for an empty line
Search boundary per regexp; return the position of the
character immediately following the boundary (on the same
line), or raise Not_found. ... | This code is inspired by mimestring.ml from OcamlNet
Copyright ,
Modified for Ocsigen / Lwt by and
VVV Check wether we should support int64 for large files ?
open Lwt.Infix
module S = Ocsigen_lib.Netstring_pcre
let section = Lwt_log.Section.make "ocsigen:server:multipart"
exception Multipart_error of ... |
5d2f447d3bafab5660448b005f455c8052406378f8734e3d4095c4d437958cfd | lehins/massiv | doctests.hs | # LANGUAGE CPP #
module Main where
#if __GLASGOW_HASKELL__ >= 802 && __GLASGOW_HASKELL__ < 810
import Test.DocTest (doctest)
main :: IO ()
main = doctest ["-Iinclude","src"]
#else
-- TODO: fix doctest support
main :: IO ()
main =
putStrLn "\nDoctests are not supported for ghc version 8.2 and prior as well as 8.... | null | https://raw.githubusercontent.com/lehins/massiv/67a920d4403f210d0bfdad1acc4bec208d80a588/massiv/tests/doctests.hs | haskell | TODO: fix doctest support | # LANGUAGE CPP #
module Main where
#if __GLASGOW_HASKELL__ >= 802 && __GLASGOW_HASKELL__ < 810
import Test.DocTest (doctest)
main :: IO ()
main = doctest ["-Iinclude","src"]
#else
main :: IO ()
main =
putStrLn "\nDoctests are not supported for ghc version 8.2 and prior as well as 8.10 and newer\n"
#endif
|
2d011ae3bad41f6486ed6e9b757e324e7369d2133d28da5263a0526ce6d5ac78 | qfpl/reflex-realworld-example | Comments.hs | # LANGUAGE FlexibleContexts , OverloadedStrings #
module Backend.Conduit.Database.Comments
( create
, destroy
, find
, forArticle
) where
import Control.Lens (view, (^.), _1, _2)
import Control.Monad.Error.Class (MonadError)
import Control.Monad.IO.Class (MonadIO, liftIO)
im... | null | https://raw.githubusercontent.com/qfpl/reflex-realworld-example/aca3125e036fbb5edd3a20d0e5a13ec73eaa6fcb/backend/src/Backend/Conduit/Database/Comments.hs | haskell | # LANGUAGE FlexibleContexts , OverloadedStrings #
module Backend.Conduit.Database.Comments
( create
, destroy
, find
, forArticle
) where
import Control.Lens (view, (^.), _1, _2)
import Control.Monad.Error.Class (MonadError)
import Control.Monad.IO.Class (MonadIO, liftIO)
im... | |
cf4593d0201b1d05ff0b8ea30c3cac522408a8ffd0b1a953c9902b0983c00431 | fulcrologic/fulcro-rad-kvstore | database_queries.clj | (ns com.example.components.database-queries
"`server-queries` would be a better name but constrained by no alterations to model allowed, so we can always easily
copy over the latest RAD Demo"
(:require
[com.example.components.queries :as queries]
[com.fulcrologic.rad.database-adapters.key-value :as key-va... | null | https://raw.githubusercontent.com/fulcrologic/fulcro-rad-kvstore/d0dff827ee2200090d70768a9e581ba91f84f937/src/demo-project/com/example/components/database_queries.clj | clojure | Just created for testing
Keeping to show that above we are not outputting the name of the time-zone
(rather the keyword)
| (ns com.example.components.database-queries
"`server-queries` would be a better name but constrained by no alterations to model allowed, so we can always easily
copy over the latest RAD Demo"
(:require
[com.example.components.queries :as queries]
[com.fulcrologic.rad.database-adapters.key-value :as key-va... |
ebf9c159356295867f0fd7034dcd468be0a239cba9ca23bd63fec7cd86b4f36f | backtracking/mlpost | matrix.mli | type point = Ctypes.point
type t = Ctypes.matrix = {
mutable xx : float;
mutable yx : float;
mutable xy : float;
mutable yy : float;
mutable x0 : float;
mutable y0 : float;
}
val scale : float -> t
val rotation : float -> t
val xscaled : float -> t
val yscaled : float -> t
val slanted : float -> t
va... | null | https://raw.githubusercontent.com/backtracking/mlpost/bd4305289fd64d531b9f42d64dd641d72ab82fd5/src/matrix.mli | ocaml | type point = Ctypes.point
type t = Ctypes.matrix = {
mutable xx : float;
mutable yx : float;
mutable xy : float;
mutable yy : float;
mutable x0 : float;
mutable y0 : float;
}
val scale : float -> t
val rotation : float -> t
val xscaled : float -> t
val yscaled : float -> t
val slanted : float -> t
va... | |
79590791dd6a7d85792ab269baa1663d07078479dc6247bba6e53563fcda6ed2 | phylogeography/spread | macros.cljc | (ns shared.macros
(:require #?(:clj [cljs.core]
:default [taoensso.timbre]))
#?(:cljs (:require-macros [shared.macros])))
(defn compiletime-info
[_ and-form ns]
(let [meta-info (meta and-form)]
{:ns (str (ns-name ns))
:line (:line meta-info)
:file (:file meta-info)}))
(defmacro ... | null | https://raw.githubusercontent.com/phylogeography/spread/56f3500e6d83e0ebd50041dc336ffa0697d7baf8/src/cljc/shared/macros.cljc | clojure | (ns shared.macros
(:require #?(:clj [cljs.core]
:default [taoensso.timbre]))
#?(:cljs (:require-macros [shared.macros])))
(defn compiletime-info
[_ and-form ns]
(let [meta-info (meta and-form)]
{:ns (str (ns-name ns))
:line (:line meta-info)
:file (:file meta-info)}))
(defmacro ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.