_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 |
|---|---|---|---|---|---|---|---|---|
68147a32b42136f044557edbc69826539543255b6296da41b38d05bafb393dfb | mit-pdos/mcqc | Ind.hs | # LANGUAGE RecordWildCards #
{-# LANGUAGE OverloadedStrings #-}
module Codegen.Ind where
import Classes.Typeful
import Classes.Nameful
import Parser.Decl
import Parser.Expr
import CIR.Expr
import CIR.Decl
import Codegen.Rewrite
import Common.Utils
import Data.Text (Text)
import qualified Data.Text as T
import quali... | null | https://raw.githubusercontent.com/mit-pdos/mcqc/85b5a65f1750ffb7c2336fa4c9266cc238aeeb5e/src/Codegen/Ind.hs | haskell | # LANGUAGE OverloadedStrings #
> (last . flattenType $ t)
> indtype
Make a lambda clause to a match
Make a match statement for unfolding the Inductive type
return inside the ctor body
wrap in a shared pointer | # LANGUAGE RecordWildCards #
module Codegen.Ind where
import Classes.Typeful
import Classes.Nameful
import Parser.Decl
import Parser.Expr
import CIR.Expr
import CIR.Decl
import Codegen.Rewrite
import Common.Utils
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Maybe as MA
import qua... |
77bb6dffd378cb7babfcf8b8f2d44c6e72d59416120dde3af2daf92dd4691513 | owainlewis/ocaml-datastructures-algorithms | leftist_tree.ml | (* Leftist Trees *)
type 'a leftist =
| Leaf
| Node of 'a leftist * 'a * 'a leftist * int
let singleton k = Node (Leaf, k, Leaf, 1)
let rank tree =
match tree with
| Leaf -> 0
| Node (_, _, _, n) -> n
let rec merge t1 t2 =
match t1, t2 with
| Leaf, t -> t | t, Leaf -> t
| Node (l, k1, r, _), N... | null | https://raw.githubusercontent.com/owainlewis/ocaml-datastructures-algorithms/4696fa4f5a015fc18e903b0b9ba2a1a8013a40ce/archive/leftist_tree.ml | ocaml | Leftist Trees |
type 'a leftist =
| Leaf
| Node of 'a leftist * 'a * 'a leftist * int
let singleton k = Node (Leaf, k, Leaf, 1)
let rank tree =
match tree with
| Leaf -> 0
| Node (_, _, _, n) -> n
let rec merge t1 t2 =
match t1, t2 with
| Leaf, t -> t | t, Leaf -> t
| Node (l, k1, r, _), Node (_, k2, _, _) ->... |
41bdb81853b0171b836f1dd8d8dde8757dec7c4f353f57e32a8f2b312d545bb4 | argp/bap | euler001.ml | open Batteries
open Enum
let say e = e |> map string_of_int |> print ~last:"\n" IO.nwrite stdout
let print_sum e = e |> reduce (+) |> string_of_int |> print_endline
let top = 999
let () =
(1 -- top)
|> filter (fun x -> x mod 3 = 0 or x mod 5 = 0)
|> print_sum
let () =
let mul3 = (1 -- (top / 3)) |> map ( ( ... | null | https://raw.githubusercontent.com/argp/bap/2f60a35e822200a1ec50eea3a947a322b45da363/batteries/examples/euler/euler001.ml | ocaml | open Batteries
open Enum
let say e = e |> map string_of_int |> print ~last:"\n" IO.nwrite stdout
let print_sum e = e |> reduce (+) |> string_of_int |> print_endline
let top = 999
let () =
(1 -- top)
|> filter (fun x -> x mod 3 = 0 or x mod 5 = 0)
|> print_sum
let () =
let mul3 = (1 -- (top / 3)) |> map ( ( ... | |
dbe98a7c210154059e71f99f16f5ebdc9e404057315ba357075c87705ca79720 | chunsj/TH | wgan.lisp | ;; from
;; -gan/
(defpackage :wgan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :wgan)
load mnist data , takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
;; mnist data has following dataset
;; train-images, train-labels and test-imag... | null | https://raw.githubusercontent.com/chunsj/TH/890f05ab81148d9fe558be3979c30c303b448480/examples/gan/wgan.lisp | lisp | from
-gan/
mnist data has following dataset
train-images, train-labels and test-images, test-labels
generator network
discriminator network
discriminator
generator
generate samples |
(defpackage :wgan
(:use #:common-lisp
#:mu
#:th
#:th.image
#:th.db.mnist))
(in-package :wgan)
load mnist data , takes ~22 secs in macbook 2017
(defparameter *mnist* (read-mnist-data))
(prn *mnist*)
(defparameter *output* (format nil "~A/Desktop" (user-homedir-pathname)))
(defun... |
6c5d0c2359f38e3a61c6a0e3212afbcba366ff1683fa258517b4482e66841330 | Lysxia/generic-recursion-schemes | Generic.hs | # LANGUAGE AllowAmbiguousTypes #
{-# LANGUAGE ConstraintKinds #-}
# LANGUAGE DataKinds #
# LANGUAGE EmptyCase #
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE InstanceSigs #
# LANGUAGE KindSignatures #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE PolyKinds #
{-# LANGUAGE RankNTypes #-}
# LANGU... | null | https://raw.githubusercontent.com/Lysxia/generic-recursion-schemes/692505969c5774ab5f6c26be3c9b53c2d19d46c3/src/Generic/RecursionSchemes/Internal/Generic.hs | haskell | # LANGUAGE ConstraintKinds #
# LANGUAGE RankNTypes #
Construction and destruction is enabled by functions, instead of native
constructs.
[Constructors] 'con' or 'con_'
[Destructors] 'case_', 'caseDefault', and ('match' or 'match_')
parametric types, and it is often necessary to wrap type parameters in
'Dat... | # LANGUAGE AllowAmbiguousTypes #
# LANGUAGE DataKinds #
# LANGUAGE EmptyCase #
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE InstanceSigs #
# LANGUAGE KindSignatures #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE PolyKinds #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE TypeApplications #
# LAN... |
93af54af542746f6ff7b7b066873ddb75b6d5e073d9d1589f70083b7b32bc23f | mjsottile/publicstuff | ConfigurationReader.hs | -- |
-- Code to read configuration files.
--
Author : mjsottile\@computer.org
--
module DLA.ConfigurationReader (
readParameters
) where
import DLA.Params
import System.IO
import Data.Maybe
--
-- given a list of pairs mapping keys to values, lookup the various
-- parameters and populate the rates, genome, and si... | null | https://raw.githubusercontent.com/mjsottile/publicstuff/46fccc93cc62eb9de46186f53012381750fbb17b/dla3d/optimized-haskell7/DLA/ConfigurationReader.hs | haskell | |
Code to read configuration files.
given a list of pairs mapping keys to values, lookup the various
parameters and populate the rates, genome, and simparams structures
function visible to the outside world. passes in a string representing
the filename of the configuration, and passes back the params.
lo... | Author : mjsottile\@computer.org
module DLA.ConfigurationReader (
readParameters
) where
import DLA.Params
import System.IO
import Data.Maybe
extractParameters :: [(String,String)] -> DLAParams
extractParameters config = d
where
d = DLAParams {
stickiness = fromJust (lookupDouble "sticki... |
b1e8919cac0e5ff81276254aa9b041a1afd522932cf4ab4ba82c3b7dc35c1e37 | moon-chilled/loop | thereis-clause.scm | (defclass thereis-clause (termination-test-clause form-mixin) ()
(accumulation-variables (clause)
`((#f thereis t)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Compute the body-form
(body-form (clause end-tag)
`(let ((temp ,(clause 'form)))
(when temp
(,*loo... | null | https://raw.githubusercontent.com/moon-chilled/loop/db5817752928952daa621d6a52e19a801447396c/src/thereis-clause.scm | scheme |
Compute the body-form
| (defclass thereis-clause (termination-test-clause form-mixin) ()
(accumulation-variables (clause)
`((#f thereis t)))
(body-form (clause end-tag)
`(let ((temp ,(clause 'form)))
(when temp
(,*loop-return-sym* temp)))))
Parsers .
(define-parser thereis-clause-parser
(consecutive (lambd... |
561de3b70c86dd88a4155b059ef58363668409c3c8c70bdf6ae66c97bd875f62 | komadori/HsQML | TestObject.hs | {-# LANGUAGE DeriveDataTypeable, FlexibleInstances #-}
module Graphics.QML.Test.TestObject where
import Graphics.QML.Objects
import Graphics.QML.Test.Framework
import Graphics.QML.Test.MayGen
import Data.Typeable
import Data.Proxy
data TestObject deriving Typeable
testObjectType :: TestType
testObjectType = TestTy... | null | https://raw.githubusercontent.com/komadori/HsQML/f57cffe4e3595bdf743bdbe6f44bf45a4001d35f/test/Graphics/QML/Test/TestObject.hs | haskell | # LANGUAGE DeriveDataTypeable, FlexibleInstances # |
module Graphics.QML.Test.TestObject where
import Graphics.QML.Objects
import Graphics.QML.Test.Framework
import Graphics.QML.Test.MayGen
import Data.Typeable
import Data.Proxy
data TestObject deriving Typeable
testObjectType :: TestType
testObjectType = TestType (Proxy :: Proxy TestObject)
getTestObject ::
Mo... |
4be7ec2b8deb62044dd67d97c58f95326eea7c5ddb6290bc894f1ee0611b94de | haskell-opengl/OpenGLRaw | Tbuffer.hs | --------------------------------------------------------------------------------
-- |
-- Module : Graphics.GL.ThreeDFX.Tbuffer
Copyright : ( c ) 2019
-- License : BSD3
--
Maintainer : < >
-- Stability : stable
-- Portability : portable
--
------------------------------------------------... | null | https://raw.githubusercontent.com/haskell-opengl/OpenGLRaw/57e50c9d28dfa62d6a87ae9b561af28f64ce32a0/src/Graphics/GL/ThreeDFX/Tbuffer.hs | haskell | ------------------------------------------------------------------------------
|
Module : Graphics.GL.ThreeDFX.Tbuffer
License : BSD3
Stability : stable
Portability : portable
------------------------------------------------------------------------------
* Extension Support
* Functions | Copyright : ( c ) 2019
Maintainer : < >
module Graphics.GL.ThreeDFX.Tbuffer (
glGetThreeDFXTbuffer,
gl_3DFX_tbuffer,
glTbufferMask3DFX
) where
import Graphics.GL.ExtensionPredicates
import Graphics.GL.Functions
|
b54df81af033e2e81643f0808faccaaa6925266ac4e07fded10833645e11a7ad | DogLooksGood/holdem | utils_test.clj | (ns poker.utils-test
(:require [poker.utils :as sut]
[clojure.test :as t]))
(t/deftest rotate-by
(t/testing "empty list" (t/is (= [] (sut/rotate-by odd? []))))
(t/testing "one item" (t/is (= [1] (sut/rotate-by odd? [1]))))
(t/testing "one item rotate" (t/is (= [2] (sut/rotate-by odd? [2]))))
(t/t... | null | https://raw.githubusercontent.com/DogLooksGood/holdem/bc0f93ed65cab54890c91f78bb95fe3ba020a41f/test/clj/poker/utils_test.clj | clojure | (ns poker.utils-test
(:require [poker.utils :as sut]
[clojure.test :as t]))
(t/deftest rotate-by
(t/testing "empty list" (t/is (= [] (sut/rotate-by odd? []))))
(t/testing "one item" (t/is (= [1] (sut/rotate-by odd? [1]))))
(t/testing "one item rotate" (t/is (= [2] (sut/rotate-by odd? [2]))))
(t/t... | |
a4d045e88529e209157b904cedca1047b883aa84c9cb27654d8730041e8f5c22 | walkie/Hagl | Extensive.hs | # LANGUAGE FlexibleContexts , PatternGuards , TypeFamilies #
-- | Extensive form representation of games.
module Hagl.Extensive where
import Data.List (intersperse)
import Hagl.List
import Hagl.Payoff
import Hagl.Game
--
-- * Representation
--
-- | An extensive form game is a discrete game tree with no state.
type... | null | https://raw.githubusercontent.com/walkie/Hagl/ac1edda51c53d2b683c4ada3f1c3d4d14a285d38/src/Hagl/Extensive.hs | haskell | | Extensive form representation of games.
* Representation
| An extensive form game is a discrete game tree with no state.
| An edge in an extensive form game.
| Smart constructor for extensive game tree nodes.
* Incremental construction
| Decision node.
| Chance node.
| Payoff node.
| Begin a game tree i... | # LANGUAGE FlexibleContexts , PatternGuards , TypeFamilies #
module Hagl.Extensive where
import Data.List (intersperse)
import Hagl.List
import Hagl.Payoff
import Hagl.Game
type Extensive mv = Discrete () mv
type ExtEdge mv = (mv, Extensive mv)
extensive :: Action mv -> [ExtEdge mv] -> Extensive mv
extensive a =... |
79c89568050d908d18b76a7b8106f467b0c876330630aedbb10b8110e4e23b4e | mirage/qubes-mirage-firewall | client_eth.ml | Copyright ( C ) 2016 , < >
See the README file for details .
See the README file for details. *)
open Fw_utils
open Lwt.Infix
let src = Logs.Src.create "client_eth" ~doc:"Ethernet networks for NetVM clients"
module Log = (val Logs.src_log src : Logs.LOG)
type t = {
mutable iface_of_ip : client_link Ip... | null | https://raw.githubusercontent.com/mirage/qubes-mirage-firewall/47562749b2d2c62f7c5fb47df23502666d326ae3/client_eth.ml | ocaml | Fires when [iface_of_ip] changes.
The IP that clients are given as their default gateway.
Wait for old client to disappear before adding one with the same IP address.
Otherwise, its [remove_client] call will remove the new client instead.
We're now treating client networks as point-to-point links,
... | Copyright ( C ) 2016 , < >
See the README file for details .
See the README file for details. *)
open Fw_utils
open Lwt.Infix
let src = Logs.Src.create "client_eth" ~doc:"Ethernet networks for NetVM clients"
module Log = (val Logs.src_log src : Logs.LOG)
type t = {
mutable iface_of_ip : client_link Ip... |
c4bc02688f2c369a55101be3c4e6555cc05664b76b8702fba804e56a08d60c1e | erlangonrails/devdb | yaws_showarg.erl | -module(yaws_showarg).
-export([out/1]).
-include_lib("yaws/include/yaws_api.hrl").
f(Fmt, Args) ->
io_lib:format(Fmt, Args).
out(ARG) ->
[
{html,
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"-strict.dtd\">
<html>
<head>
<style type=\"text/css\">
... | null | https://raw.githubusercontent.com/erlangonrails/devdb/0e7eaa6bd810ec3892bfc3d933439560620d0941/dev/scalaris/contrib/yaws/src/yaws_showarg.erl | erlang | -module(yaws_showarg).
-export([out/1]).
-include_lib("yaws/include/yaws_api.hrl").
f(Fmt, Args) ->
io_lib:format(Fmt, Args).
out(ARG) ->
[
{html,
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"-strict.dtd\">
<html>
<head>
<style type=\"text/css\">
... | |
30fbf81dea8f48fdde2aa0b42e9b67653b30bb187d569688ddb02caa14adc085 | Frama-C/Frama-C-snapshot | inout_type.mli | (**************************************************************************)
(* *)
This file is part of Frama - C.
(* *)
Copyright ... | null | https://raw.githubusercontent.com/Frama-C/Frama-C-snapshot/639a3647736bf8ac127d00ebe4c4c259f75f9b87/src/plugins/value_types/inout_type.mli | ocaml | ************************************************************************
alternatives)
... | This file is part of Frama - C.
Copyright ( C ) 2007 - 2019
CEA ( Commissariat à l'énergie atomique et aux énergies
Lesser General Public License as published by the Free Software
Foundation , v... |
5f6340c9fede8f9330210aed0c6a83a525eb37edc9933e27101a6e6a5e040ba1 | RDTK/generator | protocol.lisp | ;;;; protocol.lisp --- Protocol provided by the report module.
;;;;
Copyright ( C ) 2015 , 2016 , 2019 Jan Moringen
;;;;
Author : < >
(cl:in-package #:build-generator.report)
(defgeneric report (object style target)
(:documentation
"Send report for OBJECT with STYLE to TARGET.
TARGET is usually a str... | null | https://raw.githubusercontent.com/RDTK/generator/8d9e6e47776f2ccb7b5ed934337d2db50ecbe2f5/src/report/protocol.lisp | lisp | protocol.lisp --- Protocol provided by the report module.
| Copyright ( C ) 2015 , 2016 , 2019 Jan Moringen
Author : < >
(cl:in-package #:build-generator.report)
(defgeneric report (object style target)
(:documentation
"Send report for OBJECT with STYLE to TARGET.
TARGET is usually a stream."))
|
a96717a7d97e85aa34061b8330802510a8dffc70a49348decd6143bd696dbbd9 | parapluu/Concuerror | many_initials.erl | -module(many_initials).
-export([many_initials/0]).
-export([scenarios/0]).
scenarios() -> [{?MODULE, inf, dpor}].
many_initials() ->
ets:new(table, [public, named_table]),
ets:insert(table, {x, 0}),
ets:insert(table, {y, 0}),
ets:insert(table, {z, 0}),
spawn(fun() -> ets:insert(table, {x, 1}) en... | null | https://raw.githubusercontent.com/parapluu/Concuerror/152a5ccee0b6e97d8c3329c2167166435329d261/tests/suites/dpor_tests/src/many_initials.erl | erlang | -module(many_initials).
-export([many_initials/0]).
-export([scenarios/0]).
scenarios() -> [{?MODULE, inf, dpor}].
many_initials() ->
ets:new(table, [public, named_table]),
ets:insert(table, {x, 0}),
ets:insert(table, {y, 0}),
ets:insert(table, {z, 0}),
spawn(fun() -> ets:insert(table, {x, 1}) en... | |
e518cc7eb58bc37e080c0386f906dbd41844615ce42e9d6e3539dcb1b940ce40 | kelamg/HtDP2e-workthrough | ex219.rkt | The first three lines of this file were inserted by . They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname ex219) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decima... | null | https://raw.githubusercontent.com/kelamg/HtDP2e-workthrough/ec05818d8b667a3c119bea8d1d22e31e72e0a958/HtDP/Arbitrarily-Large-Data/ex219.rkt | racket | about the language level of this file in a form that our tools can easily process.
Constants:
scene
worm
diameter of the worm's segments
food
Definitions:
A Worm is a structure:
(make-worm Segment List-of-segments Direction)
interp. keeps track of the position of the worm's head
is a list of the segments
... | The first three lines of this file were inserted by . They record metadata
#reader(lib "htdp-beginner-abbr-reader.ss" "lang")((modname ex219) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
(require 2htdp/image)
(require 2htdp/universe)
(define WID... |
552788a442e488997aa7ae2a4e0317692f557a67307993c86cbc4d7434d327d0 | kahua/Kahua | css.scm | ;; Provide sexp CSS
;;
Copyright ( c ) 2003 - 2007 Scheme Arts , L.L.C. , All rights reserved .
Copyright ( c ) 2003 - 2007 Time Intermedia Corporation , All rights reserved .
;; See COPYING for terms and conditions of using this software
;;
(define-module kahua.css
(use util.match)
(use util.list)
(use t... | null | https://raw.githubusercontent.com/kahua/Kahua/c90fe590233e4540923e4e5cc9f61da32873692c/src/kahua/css.scm | scheme | Provide sexp CSS
See COPYING for terms and conditions of using this software
==========================================================
parse-stylesheet :: Node -> Stree
==========================================================
CSS Color Utility
| Copyright ( c ) 2003 - 2007 Scheme Arts , L.L.C. , All rights reserved .
Copyright ( c ) 2003 - 2007 Time Intermedia Corporation , All rights reserved .
(define-module kahua.css
(use util.match)
(use util.list)
(use text.tree)
(use srfi-11)
(export parse-stylesheet
css:value-of
<css... |
86786d25439499fb16bf7d699ddefc516d30d42a635124fdebcdabdc3de88dec | juspay/euler-hs | Test.hs | {-# LANGUAGE OverloadedStrings #-}
module EulerHS.Extra.Test where
import EulerHS.Prelude
import qualified Database.Beam.Postgres as BP
import qualified Database.MySQL.Base as MySQL
import qualified Database.PostgreSQL.Simple as PG (execute_)
import EulerHS.Interpreters
import EulerHS.L... | null | https://raw.githubusercontent.com/juspay/euler-hs/0fdda6ef43c1a6c9c7221d7c194c278e375b9936/src/EulerHS/Extra/Test.hs | haskell | # LANGUAGE OverloadedStrings # |
module EulerHS.Extra.Test where
import EulerHS.Prelude
import qualified Database.Beam.Postgres as BP
import qualified Database.MySQL.Base as MySQL
import qualified Database.PostgreSQL.Simple as PG (execute_)
import EulerHS.Interpreters
import EulerHS.Language
import EulerHS.Ru... |
f50d9e2fabb7ebaa63a6573c24ea4ab04659bcfd4ca7b2189be7e61e785b7701 | spurious/sagittarius-scheme-mirror | buffer.scm | -*- mode : scheme ; coding : utf-8 ; -*-
;;;
;;; util/buffer.scm - Buffer utilities
;;;
Copyright ( c ) 2015 < >
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;;
;;; 1. Redistri... | null | https://raw.githubusercontent.com/spurious/sagittarius-scheme-mirror/53f104188934109227c01b1e9a9af5312f9ce997/sitelib/util/buffer.scm | scheme | coding : utf-8 ; -*-
util/buffer.scm - Buffer utilities
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of co... | Copyright ( c ) 2015 < >
" AS IS " AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT
SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED
LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING
(library (util buffer)
(export <pre-allocated-b... |
71c832fc722beaaa1e96bdb2ae0064893236faecea89bcc5b58e8e5807e25b56 | avsm/eeww | uucp_white_data.ml | ---------------------------------------------------------------------------
Copyright ( c ) 2020 The uucp programmers . All rights reserved .
Distributed under the ISC license , see terms at the end of the file .
---------------------------------------------------------------------------
Copyright (c) ... | null | https://raw.githubusercontent.com/avsm/eeww/f1f3a5f9c572555cd882f974e2c0cc9b36618a8c/lib/uucp/src/uucp_white_data.ml | ocaml | WARNING do not edit. This file was automatically generated. | ---------------------------------------------------------------------------
Copyright ( c ) 2020 The uucp programmers . All rights reserved .
Distributed under the ISC license , see terms at the end of the file .
---------------------------------------------------------------------------
Copyright (c) ... |
5c5cddd687de714a859e72012fa82b85c7fd6a126e9ff35ceea31bdccd4fbcd4 | rudymatela/conjure | utils.hs | Copyright ( C ) 2021
-- Distributed under the 3-Clause BSD licence (see the file LICENSE).
import Test
main :: IO ()
main = mainTest tests 5040
tests :: Int -> [Bool]
tests n =
[ True
, holds n $ \xs ys -> length xs == length ys
==> zipWith (<>) xs ys == mzip xs (ys :: [[Int]])
, h... | null | https://raw.githubusercontent.com/rudymatela/conjure/3a78a9a8a32c9c86a64c4f8622208e716172c66b/test/utils.hs | haskell | Distributed under the 3-Clause BSD licence (see the file LICENSE). | Copyright ( C ) 2021
import Test
main :: IO ()
main = mainTest tests 5040
tests :: Int -> [Bool]
tests n =
[ True
, holds n $ \xs ys -> length xs == length ys
==> zipWith (<>) xs ys == mzip xs (ys :: [[Int]])
, holds n $ \xs ys -> length xs >= length ys
==> zipW... |
6671c2a56687bd99023b5bbd15ec64a0e8796984596d02c74eda7345fe2b6b22 | ekmett/integration | TanhSinh.hs | # LANGUAGE CPP #
{-# LANGUAGE BangPatterns #-}
# LANGUAGE PatternGuards #
-----------------------------------------------------------------------------
-- |
-- Module : Numeric.Integration.TanhSinh
Copyright : ( C ) 2012 - 2015
-- License : BSD-style (see the file LICENSE)
--
Maintainer : < ... | null | https://raw.githubusercontent.com/ekmett/integration/b2fdccb6be86c60700639da0156597b20b506c9a/src/Numeric/Integration/TanhSinh.hs | haskell | # LANGUAGE BangPatterns #
---------------------------------------------------------------------------
|
Module : Numeric.Integration.TanhSinh
License : BSD-style (see the file LICENSE)
Stability : provisional
Portability : portable
of functions and is pretty much as close to a
universal quadrat... | # LANGUAGE CPP #
# LANGUAGE PatternGuards #
Copyright : ( C ) 2012 - 2015
Maintainer : < >
An implementation of and 's
< -sinh_quadrature Tanh - Sinh quadrature > .
Tanh - Sinh provides good results across a wide - range
> ghci > absolute 1e-6 $ parTrap sin ( pi/2 ) pi
> Result { result = ... |
21083fb34d9a7fc680155038c7f6c3ffe4e57652e98c24d4f9fbd149220348b0 | dgtized/shimmers | mechanism.cljs | (ns shimmers.sketches.mechanism
(:require
[quil.core :as q :include-macros true]
[quil.middleware :as m]
[shimmers.common.framerate :as framerate]
[shimmers.common.quil :as cq]
[shimmers.common.ui.controls :as ctrl]
[shimmers.common.ui.debug :as debug]
[shimmers.math.equations :as eq]
[shimmer... | null | https://raw.githubusercontent.com/dgtized/shimmers/f096c20d7ebcb9796c7830efcd7e3f24767a46db/src/shimmers/sketches/mechanism.cljs | clojure | randomly generate gear systems that don't intersect with themselves
additional mechanisms like:
* piston/rod -- or at least lateral movement
* flat gears?
* screw gears?
* pulley/belt systems?
* kinematic chain to another gear?
FIXME: mesh-offset is wrong for rings on: non-cardinal directions,
some diamet... | (ns shimmers.sketches.mechanism
(:require
[quil.core :as q :include-macros true]
[quil.middleware :as m]
[shimmers.common.framerate :as framerate]
[shimmers.common.quil :as cq]
[shimmers.common.ui.controls :as ctrl]
[shimmers.common.ui.debug :as debug]
[shimmers.math.equations :as eq]
[shimmer... |
7df8eabf29557b3f17d8295358ab0ab08cbe2986d775f8263422802b7828e0cd | tmfg/mmtis-national-access-point | common.cljs | (ns ote.ui.common
"Common small UI utilities"
(:require [cljs-react-material-ui.icons :as ic]
[cljs-react-material-ui.reagent :as ui]
[ote.localization :refer [tr tr-key]]
[stylefy.core :as stylefy]
[ote.localization :as localization]
[ote.style.base :as s... | null | https://raw.githubusercontent.com/tmfg/mmtis-national-access-point/61732a3e1224a917d46d2b710342ae8d6b727e1f/ote/src/cljs/ote/ui/common.cljs | clojure | Fintraffic properties
UI links to various resources hosted on Traficom.fi
=> [\"\" true]
URL with protocol, use as is
-noopener/ Avoid a browser vulnerability by using noopener noreferrer.
Full width gray generic help box
This is implemented because IE craps itself sometimes with the linkify | (ns ote.ui.common
"Common small UI utilities"
(:require [cljs-react-material-ui.icons :as ic]
[cljs-react-material-ui.reagent :as ui]
[ote.localization :refer [tr tr-key]]
[stylefy.core :as stylefy]
[ote.localization :as localization]
[ote.style.base :as s... |
3882744e9d33e158cc49fb5bd3b59c8c668b75b124c3b993a71ef5b342599db8 | pixlsus/registry.gimp.org_static | Rainbow Plasma.scm | ------ Rainbow Plasma --------------------
; Create an image using rainbow gradient circles
(define (script-fu-rainbow-plasma width height numCircles)
; Create an img and a layer
(let* ((img (car (gimp-image-new width height 0)))
(layer (car (gimp-layer-new img width height 0 "Rainbow Plasma" 100 0... | null | https://raw.githubusercontent.com/pixlsus/registry.gimp.org_static/ffcde7400f402728373ff6579947c6ffe87d1a5e/registry.gimp.org/files/Rainbow%20Plasma.scm | scheme | Create an image using rainbow gradient circles
Create an img and a layer
Create an image using rainbow gradient circles
Create an img and a layer
Create array of random circles.
Circles are a list of variables:
Add layer to image
Don't forget to reset counter!
y pos
Add length to x pos to get
the e... | ------ Rainbow Plasma --------------------
(define (script-fu-rainbow-plasma width height numCircles)
(let* ((img (car (gimp-image-new width height 0)))
(layer (car (gimp-layer-new img width height 0 "Rainbow Plasma" 100 0)))
(i 0)
)
(gimp-image-undo-disable img)
(gimp-image-... |
85b56254591d9817f1f2a2f9d61a63a9ebf4e3927be3bd908e1caadbb6af7d48 | uzh/ask | repository_utils.ml | module Dynparam = struct
type t = Pack : 'a Caqti_type.t * 'a -> t
let empty = Pack (Caqti_type.unit, ())
let add t x (Pack (t', x')) = Pack (Caqti_type.tup2 t' t, (x', x))
end
let raise_caqti_error err =
match err with
| Error err -> failwith (Caqti_error.show err)
| Ok result -> result
;;
| null | https://raw.githubusercontent.com/uzh/ask/5ba939c7ccbe20251b26f8d691635d94e65e518f/ask/src/repo/repository_utils.ml | ocaml | module Dynparam = struct
type t = Pack : 'a Caqti_type.t * 'a -> t
let empty = Pack (Caqti_type.unit, ())
let add t x (Pack (t', x')) = Pack (Caqti_type.tup2 t' t, (x', x))
end
let raise_caqti_error err =
match err with
| Error err -> failwith (Caqti_error.show err)
| Ok result -> result
;;
| |
32c9e864439210d8d97e100a64f8e1386bbf75d0a548230a1a6f108fef8a8d11 | russross/cownfs | csrv.ml | Copyright 2004 , 2005
* See the file COPYING for information about licensing and distribution .
* See the file COPYING for information about licensing and distribution. *)
open Mount_prot_caux;;
open Nfs3_prot_caux;;
module Nfs = Nfs_api;;
module DNfs = Nfs_api_debug;;
module Mount = Mount_api;;
external m... | null | https://raw.githubusercontent.com/russross/cownfs/cc67fae0294203a78b022d7300be8aa6c35c58af/csrv.ml | ocaml | first register callback functions
* now create an object of every struct type that needs to be created
* by the C code. We pass a list of objects to the C code and it grabs
* the type annotations from them. Ugly, but I couldn't see a better
* way to do it.
let wccstat3 = `nfs3_neg_one in
let g... | Copyright 2004 , 2005
* See the file COPYING for information about licensing and distribution .
* See the file COPYING for information about licensing and distribution. *)
open Mount_prot_caux;;
open Nfs3_prot_caux;;
module Nfs = Nfs_api;;
module DNfs = Nfs_api_debug;;
module Mount = Mount_api;;
external m... |
b5a4b48bb6967945d93b6cb874b80a599fb3ccdc47f62c9c82b382eaa54bc476 | FailWhaleBrigade/water-wars | Constants.hs | module WaterWars.Core.Game.Constants where
import ClassyPrelude
defaultPlayerHeight :: Float
defaultPlayerHeight = 1.6 * defaultPlayerWidth
defaultPlayerWidth :: Float
defaultPlayerWidth = 2
playerHeadHeight :: Float
playerHeadHeight = 1 / 2 * defaultPlayerHeight
shootCooldown :: Int
shootCooldown = 50
... | null | https://raw.githubusercontent.com/FailWhaleBrigade/water-wars/bdd0616b1eed281ace499f059b4cc1e72bc50d05/library/WaterWars/Core/Game/Constants.hs | haskell | module WaterWars.Core.Game.Constants where
import ClassyPrelude
defaultPlayerHeight :: Float
defaultPlayerHeight = 1.6 * defaultPlayerWidth
defaultPlayerWidth :: Float
defaultPlayerWidth = 2
playerHeadHeight :: Float
playerHeadHeight = 1 / 2 * defaultPlayerHeight
shootCooldown :: Int
shootCooldown = 50
... | |
0576f2f7a164b539607a855f449b716694e5dcafcfe2771adb3bcd4c81aeea00 | bschwb/cis194-solutions | Calc.hs | {-# OPTIONS_GHC -Wall -Werror #-}
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
module Calc where
import ExprT
import Parser
import StackVM
import Data.Maybe
import qualified Data.Map as M
-------------------------------------------------------------------------------
Exercise 1
> eval ( Mul ( Add (... | null | https://raw.githubusercontent.com/bschwb/cis194-solutions/e79f96083b6edbfed18a2adbc749c41d196d8ff7/05-typeclasses/Calc.hs | haskell | # OPTIONS_GHC -Wall -Werror #
# LANGUAGE TypeSynonymInstances, FlexibleInstances #
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
evaluates arithmetic expressions given as a String,
producing Nothing for input... |
module Calc where
import ExprT
import Parser
import StackVM
import Data.Maybe
import qualified Data.Map as M
Exercise 1
> eval ( Mul ( Add ( Lit 2 ) ( Lit 3 ) ) ( Lit 4 ) ) = = 20
eval :: ExprT -> Integer
eval (ExprT.Lit i) = i
eval (ExprT.Add a b) = eval a + eval b
eval (ExprT.Mul a b) = eval a * eval b
Ex... |
9b6b022d05148afdd3ca63fb84b76989d074a7572db6c07a51d2388353b9efe1 | danx0r/festival | festival.scm | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;
Centre for Speech Technology Research ; ;
University of Edinburgh , UK ; ;
;;; ... | null | https://raw.githubusercontent.com/danx0r/festival/6701715566aee6519a8b7949b567f2fdad1e2772/lib/festival.scm | scheme |
;;
;
;
Copyright (c) 1996,1997 ;;
;
;;
Permission is hereby granted, free of charge, to use and distribute ;;
this softwar... |
(defvar festival_version "unknown"
"festival_version
A string containing the current version number of the system.")
(defvar festival_version_number '(x x x)
"festival_version_number
A list of major, minor and subminor version numbers of the current
system. e.g. (1 0 12).")
(define (apply_method method utt)
... |
34db49bd28757e461e522ebd94c5288ba33661e712dcdbf8d9b675f4eb8b68cd | tezos/tezos-mirror | test_merkle_list.ml | (*****************************************************************************)
(* *)
(* Open Source License *)
Copyright ( c ) 2022 Nomadic Labs , < >
(* ... | null | https://raw.githubusercontent.com/tezos/tezos-mirror/39e976ad6eae6446af8ca17ef4a63475ab9fe2b9/src/proto_016_PtMumbai/lib_protocol/test/pbt/test_merkle_list.ml | ocaml | ***************************************************************************
Open Source License
Permission is h... | Copyright ( c ) 2022 Nomadic Labs , < >
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 WARRANTY OF ANY KIND , EXPRESS OR
LIABILITY , WHETHER IN A... |
05f4ad07002e92bf13c26136319f7114efb6c002d1fad09ffbbe183333e9e161 | hasktorch/ffi-experimental | Layout.hs | {-# LANGUAGE TypeSynonymInstances #-}
# LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
module Torch.Layout where
import ATen.Class (Castable(..))
import qualified ATen.Const as ATen
import qualified ATen.Type as ATen
data Layout = Strided | Sparse | Mkldnn
deriving (Eq, Show)
instance Castable La... | null | https://raw.githubusercontent.com/hasktorch/ffi-experimental/54192297742221c4d50398586ba8d187451f9ee0/hasktorch/src/Torch/Layout.hs | haskell | # LANGUAGE TypeSynonymInstances # | # LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
module Torch.Layout where
import ATen.Class (Castable(..))
import qualified ATen.Const as ATen
import qualified ATen.Type as ATen
data Layout = Strided | Sparse | Mkldnn
deriving (Eq, Show)
instance Castable Layout ATen.Layout where
cast Strided ... |
37f79d693123350e92b5d250434a3fef2e6df6d816dc93a494effc49108206ef | racket/racket7 | variable.rkt | #lang racket/base
(provide (struct-out variable))
;; Represents a variable that is exported by a used linklet:
(struct variable (link ; link
name) ; symbol
#:prefab)
| null | https://raw.githubusercontent.com/racket/racket7/5dbb62c6bbec198b4a790f1dc08fef0c45c2e32b/racket/src/expander/extract/variable.rkt | racket | Represents a variable that is exported by a used linklet:
link
symbol | #lang racket/base
(provide (struct-out variable))
#:prefab)
|
8992700949f313225132e633c3c4caa1b232155af4ab9eedb13b92b4e43aeefc | 8c6794b6/haskell-sc-scratch | Scratch01.hs | # LANGUAGE NoImplicitPrelude #
|
Module : $ Header$
CopyRight : ( c ) 8c6794b6
License : :
Stability : unstable
Portability : non - portable
Scratch written while reading
/purely functional data structure/ , by .
Module : $Header$
CopyRight : (c) 8c6794b6
License : ... | null | https://raw.githubusercontent.com/8c6794b6/haskell-sc-scratch/22de2199359fa56f256b544609cd6513b5e40f43/Scratch/FP/PFDS/Scratch01.hs | haskell | # LANGUAGE NoImplicitPrelude #
|
Module : $ Header$
CopyRight : ( c ) 8c6794b6
License : :
Stability : unstable
Portability : non - portable
Scratch written while reading
/purely functional data structure/ , by .
Module : $Header$
CopyRight : (c) 8c6794b6
License : ... | |
b119358c925a3305d8d1a5a2a553d5056468726e16f89490f2c2d231d9a22674 | suvash/one-time | totp_test.clj | (ns one-time.totp-test
(:require [clojure.test :refer [deftest testing is]]
[one-time.test-helper :as th]
[one-time.totp :as totp]))
(deftest get-token-test
(testing "TOTP token for parameters test"
(is (= 319222 (totp/get-token "A4I774XAQM36J7IL" {:date (th/parse-date "Thu Jul 21 01:12... | null | https://raw.githubusercontent.com/suvash/one-time/63981bbe1a27eaac80a2bda1b1887c4262c2a61f/test/one_time/totp_test.clj | clojure | (ns one-time.totp-test
(:require [clojure.test :refer [deftest testing is]]
[one-time.test-helper :as th]
[one-time.totp :as totp]))
(deftest get-token-test
(testing "TOTP token for parameters test"
(is (= 319222 (totp/get-token "A4I774XAQM36J7IL" {:date (th/parse-date "Thu Jul 21 01:12... | |
7880c84fc2435c35ab2106f3d5f4ca99b1e70ad4b45a37e17dff96dc9e018c8d | nasa/Common-Metadata-Repository | core.clj | (ns cmr.exchange.query.components.core
(:require
[cmr.exchange.common.components.config :as config]
[cmr.exchange.common.components.logging :as logging]
[cmr.exchange.query.config :as config-lib]
[com.stuartsierra.component :as component]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;... | null | https://raw.githubusercontent.com/nasa/Common-Metadata-Repository/63001cf021d32d61030b1dcadd8b253e4a221662/other/cmr-exchange/exchange-query/src/cmr/exchange/query/components/core.clj | clojure |
Common Configuration Components ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Component Initializations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
| (ns cmr.exchange.query.components.core
(:require
[cmr.exchange.common.components.config :as config]
[cmr.exchange.common.components.logging :as logging]
[cmr.exchange.query.config :as config-lib]
[com.stuartsierra.component :as component]))
(defn cfg
[]
{:config (config/create-component (config-... |
ec02efe2f59e096ef5ec94f2ab73f42cfd52ec5145fc68fd5c7117d2838ad9c6 | hjcapple/reading-sicp | exercise_3_51.scm | #lang racket
P225 - [ 练习 3.51 ]
(require "stream.scm")
(define (stream-map proc . argstreams)
(if (stream-null? (car argstreams))
the-empty-stream
(cons-stream
(apply proc (map stream-car argstreams))
(apply stream-map
(cons proc (map stream-cdr argstreams))))))
;;;;;... | null | https://raw.githubusercontent.com/hjcapple/reading-sicp/7051d55dde841c06cf9326dc865d33d656702ecc/chapter_3/exercise_3_51.scm | scheme | #lang racket
P225 - [ 练习 3.51 ]
(require "stream.scm")
(define (stream-map proc . argstreams)
(if (stream-null? (car argstreams))
the-empty-stream
(cons-stream
(apply proc (map stream-car argstreams))
(apply stream-map
(cons proc (map stream-cdr argstreams))))))
(defi... | |
dd22693e2c5886fe0472f699e616125a57f27d95c649e01651434bd72ce67f52 | IvanIvanov/fp2013 | occur-k.scm | (define (occur-k items k)
(filter (lambda (x) (= (count-occurrences items x) k)) items))
(define (filter pred items)
(cond ((null? items) '())
((pred (car items)) (cons (car items) (filter pred (cdr items))))
(else (filter pred (cdr items)))))
(define (count-occurrences items x)
(length (filter ... | null | https://raw.githubusercontent.com/IvanIvanov/fp2013/2ac1bb1102cb65e0ecbfa8d2fb3ca69953ae4ecf/exams/exam1/solutions/occur-k.scm | scheme | () | (define (occur-k items k)
(filter (lambda (x) (= (count-occurrences items x) k)) items))
(define (filter pred items)
(cond ((null? items) '())
((pred (car items)) (cons (car items) (filter pred (cdr items))))
(else (filter pred (cdr items)))))
(define (count-occurrences items x)
(length (filter ... |
3275326f885d045d7750e1f35028b62b1b165b25d23cd3c90941fd9deb58c9b3 | pallet/pallet | script_builder.clj | (ns pallet.script-builder
"Build scripts with prologues, epilogues, etc, and command lines for
running them in different environments"
(:require
[clojure.tools.logging :refer [debugf]]
[clojure.string :as string]
[clojure.string :refer [split]]
[pallet.script :refer [with-script-context *script-conte... | null | https://raw.githubusercontent.com/pallet/pallet/30226008d243c1072dcfa1f27150173d6d71c36d/src/pallet/script_builder.clj | clojure | keep slamhound from removing the pallet.stevedore.bash require | (ns pallet.script-builder
"Build scripts with prologues, epilogues, etc, and command lines for
running them in different environments"
(:require
[clojure.tools.logging :refer [debugf]]
[clojure.string :as string]
[clojure.string :refer [split]]
[pallet.script :refer [with-script-context *script-conte... |
963de2c2e24f6365a6115d27a36cc537452e7118fe792bbef3211353907f106e | vbedegi/re-alm | core.cljs | (ns clock.core
(:require-macros [cljs.core.match :refer [match]])
(:require [cljs.core.match :as m]
[re-alm.io.time :as t]
[re-alm.boot :as boot]))
(defn- init-clock []
0)
(defn deg->rad [d]
(/ (* Math/PI d) 180))
(defn- render-clock [model dispatch]
(let [angle (deg->rad (- (* mode... | null | https://raw.githubusercontent.com/vbedegi/re-alm/73fdb86b2cb92bec16865be44b101361e7e84115/examples/clock/src/clock/core.cljs | clojure | (ns clock.core
(:require-macros [cljs.core.match :refer [match]])
(:require [cljs.core.match :as m]
[re-alm.io.time :as t]
[re-alm.boot :as boot]))
(defn- init-clock []
0)
(defn deg->rad [d]
(/ (* Math/PI d) 180))
(defn- render-clock [model dispatch]
(let [angle (deg->rad (- (* mode... | |
7ccaa98ef4c9be9b99ba22b6c5ed8984bb6cee6e33029c3ec434363cb59b13f2 | racket/eopl | utils.rkt | #lang racket
(provide (all-from-out rackunit)
check-error
define-syntax-rule
define-syntax
syntax-rules)
;;------------------------------------------------------------------------
;; Testing utilities
(require rackunit)
(define-syntax-rule (check-error e msg)
(check-exn (lambda (... | null | https://raw.githubusercontent.com/racket/eopl/43575d6e95dc34ca6e49b305180f696565e16e0f/tests/private/utils.rkt | racket | ------------------------------------------------------------------------
Testing utilities | #lang racket
(provide (all-from-out rackunit)
check-error
define-syntax-rule
define-syntax
syntax-rules)
(require rackunit)
(define-syntax-rule (check-error e msg)
(check-exn (lambda (x) (and (exn:fail? x)
(string=? msg (exn-message x))))
... |
b6597a4e6f6e7a72e0df5d649adcb312449662599f499ef8244b29497c014758 | pink-gorilla/pinkie | html.cljs | (ns pinkie.html
(:require
[reagent.core :as reagent]
[reagent.dom]))
; this was moved from notebook.
(defn temp-comp-hack
[no-kw]
(when no-kw (into [(keyword (first no-kw))]
(rest no-kw))))
Scripts in Injected html are not being evaluated .
This is what worked for GorillaRepl
;; ... | null | https://raw.githubusercontent.com/pink-gorilla/pinkie/83f47f5cf793e24ab97f2c3716b7c8585d487976/src/pinkie/html.cljs | clojure | this was moved from notebook.
-in-time-script-loading-with-react-and-clojuresript.html
-script-tag-not-working-when-inserted-using-dangerouslysetinnerhtml
-script-elements-inserted-with-innerhtml
-cant-i-pass-clojurescript-functions-as-callbacks-to-javascript
-project/reagent/issues/457
-project/reagent/issues/1... | (ns pinkie.html
(:require
[reagent.core :as reagent]
[reagent.dom]))
(defn temp-comp-hack
[no-kw]
(when no-kw (into [(keyword (first no-kw))]
(rest no-kw))))
Scripts in Injected html are not being evaluated .
This is what worked for GorillaRepl
awb99 ticket on reagent : [ 2 ti... |
4a280307589c56262cefaffdfda6d3350c8ab3e95c957bbb1b8d392edf40c144 | robert-strandh/SICL | type-proclamations.lisp | (cl:in-package #:sicl-type)
;;; FIXME: try defining some more specific types
(declaim (ftype (function (t t &optional t) (member t nil))
typep))
(declaim (ftype (function (t t) t)
coerce))
;;; FIXME: the optional parameter should be of type ENVIRONMENT.
(declaim (ftype (function (t t ... | null | https://raw.githubusercontent.com/robert-strandh/SICL/89f1ce5f1b346397cd2c2c66d887d932a820aea1/Code/Types/type-proclamations.lisp | lisp | FIXME: try defining some more specific types
FIXME: the optional parameter should be of type ENVIRONMENT. | (cl:in-package #:sicl-type)
(declaim (ftype (function (t t &optional t) (member t nil))
typep))
(declaim (ftype (function (t t) t)
coerce))
(declaim (ftype (function (t t &optional t) (member t nil))
subtypep))
|
de83d87123503be8241212b4c6568b92566e60ce7529e58cda82a63ab5d90bc3 | stylewarning/deprecated-coalton-prototype | global-lexical.lisp | ;;;; global-lexical.lisp
(in-package #:coalton-impl)
Allow the definition of global lexical values in Common
Lisp . Based off of GLOBALS .
(define-symbol-property lexical-cell)
(defun get-lexical-cell (symbol)
(or (lexical-cell symbol)
(setf (lexical-cell symbol)
;; Intentionally obtuse n... | null | https://raw.githubusercontent.com/stylewarning/deprecated-coalton-prototype/4a42ffb4222fde3abfd1b50d96e455ff2eef9fe8/src/global-lexical.lisp | lisp | global-lexical.lisp
Intentionally obtuse name.
TODO: Allow the type to be declared. |
(in-package #:coalton-impl)
Allow the definition of global lexical values in Common
Lisp . Based off of GLOBALS .
(define-symbol-property lexical-cell)
(defun get-lexical-cell (symbol)
(or (lexical-cell symbol)
(setf (lexical-cell symbol)
(intern (format nil "(lexical) ~A::~A"
... |
b75be164cb4b56866b641d594c79a696a504dc046cfd244e4e91c39ca1166b3c | erlang-ls/erlang_ls | rename.erl | -module(rename).
-callback rename_me(any()) -> ok.
| null | https://raw.githubusercontent.com/erlang-ls/erlang_ls/36bf0815e35db5d25a76e80f98f306f25fff7d8c/apps/els_lsp/priv/code_navigation/src/rename.erl | erlang | -module(rename).
-callback rename_me(any()) -> ok.
| |
6af82fc33ed2b39960ebd00e6cd04034fdc3f65e86c38170ef95b7d1cdc732ea | DomainDrivenArchitecture/dda-managed-ide | domain.clj | Licensed to the Apache Software Foundation ( ASF ) under one
; or more contributor license agreements. See the NOTICE file
; distributed with this work for additional information
; regarding copyright ownership. The ASF licenses this file
to you under the Apache License , Version 2.0 ( the
; "License"); you may not... | null | https://raw.githubusercontent.com/DomainDrivenArchitecture/dda-managed-ide/1a0d9b8dea4e3b7af1754bf99b38790a927d4d10/main/src/dda/pallet/dda_managed_ide/domain.clj | clojure | or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
-2.0
Unless required b... | Licensed to the Apache Software Foundation ( ASF ) under one
to you under the Apache License , Version 2.0 ( the
distributed under the License is distributed on an " AS IS " BASIS ,
(ns dda.pallet.dda-managed-ide.domain
(:require
[schema.core :as s]
[dda.pallet.commons.secret :as secret]
[dda.confi... |
4fa78dc52588eef25af692d4fabc0424bdc8114ef4a3dc9d1ff63bcef06aa739 | solita/mnt-teet | road_query_test.clj | (ns teet.road.road-query-test
(:require [teet.road.road-query :as road-query]
[teet.util.geo :as geo]
[clojure.test :refer [deftest testing is]]))
(def simple-road-part {:start-m 100 :end-m 200 :geometry [[0 0] [100 0]]})
(deftest extract-part-interpolation
(testing "end point is interpola... | null | https://raw.githubusercontent.com/solita/mnt-teet/7a5124975ce1c7f3e7a7c55fe23257ca3f7b6411/app/backend/test/teet/road/road_query_test.clj | clojure | (ns teet.road.road-query-test
(:require [teet.road.road-query :as road-query]
[teet.util.geo :as geo]
[clojure.test :refer [deftest testing is]]))
(def simple-road-part {:start-m 100 :end-m 200 :geometry [[0 0] [100 0]]})
(deftest extract-part-interpolation
(testing "end point is interpola... | |
535a16d0bc60d96506d83b70f49ced1b12e03244faa74fac2f4a11d83e3e5bc1 | McCLIM/McCLIM | graft.lisp | ;;; ---------------------------------------------------------------------------
;;; License: LGPL-2.1+ (See file 'Copyright' for details).
;;; ---------------------------------------------------------------------------
;;;
( c ) copyright 1998 - 2000 < >
;;;
;;; -------------------------------------------------... | null | https://raw.githubusercontent.com/McCLIM/McCLIM/c079691b0913f8306ceff2620b045b6e24e2f745/Backends/CLX/graft.lisp | lisp | ---------------------------------------------------------------------------
License: LGPL-2.1+ (See file 'Copyright' for details).
---------------------------------------------------------------------------
---------------------------------------------------------------------------
| ( c ) copyright 1998 - 2000 < >
(in-package #:clim-clx)
CLX - GRAFT class
(defclass clx-graft (graft) ())
(defmethod graft-width ((graft clx-graft) &key (units :device))
(let ((screen (clx-port-screen (port graft))))
(ecase units
(:device (xlib:screen-width screen))
(:inches (/ (xlib:scree... |
309a3e5da4ea1597e2d028d682984f31bf4ba47ef47e413dc2a8c90263a7e651 | Dasudian/DSDIN | dsdct_call_tx.erl |
-module(dsdct_call_tx).
-include("dsdcontract.hrl").
-include("contract_txs.hrl").
-behavior(dsdtx).
%% Behavior API
-export([new/1,
type/0,
fee/1,
ttl/1,
nonce/1,
origin/1,
check/5,
process/5,
accounts/1,
signers/2,
serializa... | null | https://raw.githubusercontent.com/Dasudian/DSDIN/b27a437d8deecae68613604fffcbb9804a6f1729/apps/dsdcontract/src/dsdct_call_tx.erl | erlang | Behavior API
Additional getters
Contract should exist and its vm_version should match the one in the call.
Transfer the attached funds to the callee (before calling the contract!)
Create the call.
Run the contract code. Also computes the amount of gas left and updates
the call object.
Charge the fee and the use... |
-module(dsdct_call_tx).
-include("dsdcontract.hrl").
-include("contract_txs.hrl").
-behavior(dsdtx).
-export([new/1,
type/0,
fee/1,
ttl/1,
nonce/1,
origin/1,
check/5,
process/5,
accounts/1,
signers/2,
serialization_template/1,... |
4acb57e20529e43ea14824e4b24b1c9956a21a661b3967c4b999bf8ffa5c086f | clojure-interop/java-jdk | MetalDesktopIconUI.clj | (ns javax.swing.plaf.metal.MetalDesktopIconUI
"Metal desktop icon."
(:refer-clojure :only [require comment defn ->])
(:import [javax.swing.plaf.metal MetalDesktopIconUI]))
(defn ->metal-desktop-icon-ui
"Constructor."
(^MetalDesktopIconUI []
(new MetalDesktopIconUI )))
(defn *create-ui
"c - `javax.swin... | null | https://raw.githubusercontent.com/clojure-interop/java-jdk/8d7a223e0f9a0965eb0332fad595cf7649d9d96e/javax.swing/src/javax/swing/plaf/metal/MetalDesktopIconUI.clj | clojure | (ns javax.swing.plaf.metal.MetalDesktopIconUI
"Metal desktop icon."
(:refer-clojure :only [require comment defn ->])
(:import [javax.swing.plaf.metal MetalDesktopIconUI]))
(defn ->metal-desktop-icon-ui
"Constructor."
(^MetalDesktopIconUI []
(new MetalDesktopIconUI )))
(defn *create-ui
"c - `javax.swin... | |
6921d8a424e5d55123b887e29161f4165a50df3cb2565620812b366a5697ce95 | tautologico/opfp | c11-varpoli.ml |
OCaml : na Prática
do do polimórficas e extensíveis
OCaml: Programação Funcional na Prática
Andrei de A. Formiga - Casa do Código
Exemplos do Capítulo 11 - Variantes polimórficas e extensíveis
*)
Os exemplos deste capítulo foram pensados para uso no REPL , digitando uma
... | null | https://raw.githubusercontent.com/tautologico/opfp/74ef9ed97b0ab6b78c147c3edf7e0b69f2acf9d1/capitulos/c11-varpoli.ml | ocaml | Variantes com valor
sem exemplos de código nesta seção |
OCaml : na Prática
do do polimórficas e extensíveis
OCaml: Programação Funcional na Prática
Andrei de A. Formiga - Casa do Código
Exemplos do Capítulo 11 - Variantes polimórficas e extensíveis
*)
Os exemplos deste capítulo foram pensados para uso no REPL , digitando uma
... |
13bc5d02dcd4fcf3ff1eb1571237c71e1250eefe17ae2cc5dccde6eb726bf11d | xapi-project/message-switch | main.ml |
* Copyright ( c ) Citrix Systems Inc.
*
* 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 " AN... | null | https://raw.githubusercontent.com/xapi-project/message-switch/b51b75a5789bec8f8c3a7825eb2af576cdef95ab/cli/main.ml | ocaml | Options common to all commands
Help sections common to all commands
Commands
parse failure, fall back to basic printing
We don't show expected empty transient queues
Option.iter (to_arrow "<<" e.Event.queue) e.Event.output; |
* Copyright ( c ) Citrix Systems Inc.
*
* 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 " AN... |
fb911320ad049ef80263d5bc79d6dd08660c099b931c252691c0fdf1793e899f | dizengrong/erlang_game | map_api.erl | @author dzR < >
%% @doc 地图数据处理提供的一个api
-module (map_api).
-include("log.hrl").
-include("map.hrl").
-include("proto_map_pb.hrl").
-export([make_new_cell_role/1, add_role_to_cell/1, broadcast_role_enter/1]).
-export([role_jump_to/4, role_move_path/2, role_move_check/3, role_leave/1]).
-export([add_npc_to_cell/1, br... | null | https://raw.githubusercontent.com/dizengrong/erlang_game/4598f97daa9ca5eecff292ac401dd8f903eea867/gerl/src/map_srv/map_api.erl | erlang | @doc 地图数据处理提供的一个api
@doc 根据玩家的数据创建他在地图cell数据
@doc 将玩家添加到cell中
@doc 将NPC添加到cell中
@doc 向玩家所在cell的九宫格范围广播他的进入
@doc 向玩家所在cell的九宫格范围广播他的进入
@doc 向玩家所在cell的九宫格范围广播他的离开
@doc 向指定的cell范围广播玩家的离开
参数IsNotifySelf为true表示要向该玩家发送其他玩家离开自己视野的消息
为false则不需要
@doc 跳转到目的点
@doc 玩家离开当前所在地图(离开就意味着其地图上的数据和玩家的字典数据也被清理了)
注意这里只是离开,而最终离开... | @author dzR < >
-module (map_api).
-include("log.hrl").
-include("map.hrl").
-include("proto_map_pb.hrl").
-export([make_new_cell_role/1, add_role_to_cell/1, broadcast_role_enter/1]).
-export([role_jump_to/4, role_move_path/2, role_move_check/3, role_leave/1]).
-export([add_npc_to_cell/1, broadcast_npc_enter/1]).
... |
945991cb075fb1136704c966d9bcc45d84650d7fa98c46af62a1e70adb7a64aa | facebookarchive/pfff | let_underscore.ml | let _ =
1
| null | https://raw.githubusercontent.com/facebookarchive/pfff/ec21095ab7d445559576513a63314e794378c367/tests/ml/parsing/let_underscore.ml | ocaml | let _ =
1
| |
453fa1b9ffee4f11d82b2712df382628537174a10c086551bbf8c8ebeb1b793e | mbutterick/quad | fark.rkt | #lang quadwriter/markdown
#:page-size "A3"
#:page-orientation "wide"
#:column-count 3
#:column-gap 24
#:line-align "justify"
#:line-wrap "best"
#:page-margin-left 200
#:page-margin-right 100
A _macro_ is a syntactic form with an associated _transformer_ that
_expands_ the original form into existing forms. To put it ... | null | https://raw.githubusercontent.com/mbutterick/quad/395447f35c2fb9fc7b6199ed185850906d80811d/qtest/fark.rkt | racket | #lang quadwriter/markdown
#:page-size "A3"
#:page-orientation "wide"
#:column-count 3
#:column-gap 24
#:line-align "justify"
#:line-wrap "best"
#:page-margin-left 200
#:page-margin-right 100
A _macro_ is a syntactic form with an associated _transformer_ that
_expands_ the original form into existing forms. To put it ... | |
aae5ef456eeaf4d47eac31c1b79ca0e87c431feaae07c258ad01c2c747f8e4e3 | fulcrologic/statecharts | fulcro_impl.cljc | (ns com.fulcrologic.statecharts.integration.fulcro-impl
(:require
[com.fulcrologic.fulcro.raw.application :as rapp]
[com.fulcrologic.fulcro.raw.components :as rc]
[com.fulcrologic.fulcro.mutations :as m :refer [defmutation]]
[com.fulcrologic.fulcro.data-fetch :as df]
[com.fulcrologic.fulcro.algori... | null | https://raw.githubusercontent.com/fulcrologic/statecharts/681b3d7383cfd0ae6332bed5c3d974b73271b365/src/main/com/fulcrologic/statecharts/integration/fulcro_impl.cljc | clojure | mutation can be run for figuring out remote | (ns com.fulcrologic.statecharts.integration.fulcro-impl
(:require
[com.fulcrologic.fulcro.raw.application :as rapp]
[com.fulcrologic.fulcro.raw.components :as rc]
[com.fulcrologic.fulcro.mutations :as m :refer [defmutation]]
[com.fulcrologic.fulcro.data-fetch :as df]
[com.fulcrologic.fulcro.algori... |
b95cbafd735f01852170a982b636e76ac058a5349422de54266f34d5c27e0e43 | gsakkas/rite | 20060421-17:41:02-0838d2deac55fab6e99ca6a22f996fb7.seminal.ml |
exception Unimplemented
exception RuntimeTypeError
exception DoesNotTypecheck of string
(****** Syntax for our language, including types (do not change) *****)
type exp = Var of string
| Lam of string * typ * exp
| Apply of exp * exp
| Closure of string * exp * (env ref)
| Int of int
| Pl... | null | https://raw.githubusercontent.com/gsakkas/rite/958a0ad2460e15734447bc07bd181f5d35956d3b/features/data/seminal/20060421-17%3A41%3A02-0838d2deac55fab6e99ca6a22f996fb7.seminal.ml | ocaml | ***** Syntax for our language, including types (do not change) ****
***** Interpreter for our language (do not change) ****
**** helper functions provided to you (do not change) ****
##############################################################
####################################################################
... |
exception Unimplemented
exception RuntimeTypeError
exception DoesNotTypecheck of string
type exp = Var of string
| Lam of string * typ * exp
| Apply of exp * exp
| Closure of string * exp * (env ref)
| Int of int
| Plus of exp * exp
| If of exp * exp * exp
| RecordE of (string * exp)... |
b4d9502870860a9922579cb6a3d9a79f042d8debc548bc3f7f8d94a86c7b9b2b | binaryage/chromex | downloads.clj | (ns chromex.ext.downloads
"Use the chrome.downloads API to programmatically initiate,
monitor, manipulate, and search for downloads.
* available since Chrome 36
* "
(:refer-clojure :only [defmacro defn apply declare meta let partial])
(:require [chromex.wrapgen :refer [gen-wrap-helper]]
... | null | https://raw.githubusercontent.com/binaryage/chromex/33834ba5dd4f4238a3c51f99caa0416f30c308c5/src/exts/chromex/ext/downloads.clj | clojure | otherwise returns an error through 'runtime.lastError'.
otherwise return an error through
-- events -----------------------------------------------------------------------------------------------------------------
docs: /#tapping-events
-- convenience --------------------------------------------------------------... | (ns chromex.ext.downloads
"Use the chrome.downloads API to programmatically initiate,
monitor, manipulate, and search for downloads.
* available since Chrome 36
* "
(:refer-clojure :only [defmacro defn apply declare meta let partial])
(:require [chromex.wrapgen :refer [gen-wrap-helper]]
... |
2625716d2b382cebf38949a9fa4e0d837589998572079abed94f7c82ceb8a374 | hoytech/antiweb | api.lisp | -*- Mode : LISP ; Syntax : COMMON - LISP ; Package : CL - PPCRE ; Base : 10 -*-
$ Header : /usr / cvs / hcsw / antiweb / bundled / cl - ppcre / api.lisp , v 1.1 2008/04/26 02:40:56
;;; The external API for creating and using scanners.
Copyright ( c ) 2002 - 2007 , Dr. . All rights reserved .
;;; Redistrib... | null | https://raw.githubusercontent.com/hoytech/antiweb/53c38f78ea01f04f6d1a1ecdca5c012e7a9ae4bb/bundled/cl-ppcre/api.lisp | lisp | Syntax : COMMON - LISP ; Package : CL - PPCRE ; Base : 10 -*-
The external API for creating and using scanners.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above co... | $ Header : /usr / cvs / hcsw / antiweb / bundled / cl - ppcre / api.lisp , v 1.1 2008/04/26 02:40:56
Copyright ( c ) 2002 - 2007 , Dr. . All rights reserved .
DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL
INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY ,
(in-pa... |
4e5cfde2dad17c0e28087bf14be0c22ddae1cd2c0bd2fe83196c31d965298208 | footprintanalytics/footprint-web | sqlite_test.clj | (ns metabase.driver.sqlite-test
(:require [clojure.java.io :as io]
[clojure.java.jdbc :as jdbc]
[clojure.test :refer :all]
[metabase.driver :as driver]
[metabase.driver.sql-jdbc.connection :as sql-jdbc.conn]
[metabase.driver.sql.query-processor-test-util :as... | null | https://raw.githubusercontent.com/footprintanalytics/footprint-web/d3090d943dd9fcea493c236f79e7ef8a36ae17fc/modules/drivers/sqlite/test/metabase/driver/sqlite_test.clj | clojure | "
"]]
"
"]]
let's test only values we'd reasonably run into.
Caveat: TIMESTAMP stored as string doesn't get parsed and is returned as-is by the driver,
some upper layer will handle it.
TIMESTAMP
DATE
DATETIME
TIMESTAMP (raw string)
DATETIME
TIMESTAMP (raw string)
DATETIME
DATE
force creation of the ... | (ns metabase.driver.sqlite-test
(:require [clojure.java.io :as io]
[clojure.java.jdbc :as jdbc]
[clojure.test :refer :all]
[metabase.driver :as driver]
[metabase.driver.sql-jdbc.connection :as sql-jdbc.conn]
[metabase.driver.sql.query-processor-test-util :as... |
7bb1c7afec1f6d3684795bb81d599fcbbf454c7a13ec755c31690d775f02bcee | anmonteiro/ocaml-quic | direction.ml | ----------------------------------------------------------------------------
* Copyright ( c ) 2020
*
* 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... | null | https://raw.githubusercontent.com/anmonteiro/ocaml-quic/7f1a06fbe5380954bf49adc53a8fa7458bdc0024/lib/direction.ml | ocaml | ----------------------------------------------------------------------------
* Copyright ( c ) 2020
*
* 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... | |
647532105f6ec5ed536cf5b5588b5837e881f897cd12f1e8b8aa5e17aba41dde | MichaelBurge/pyramid-scheme | abi.rkt | #lang typed/racket
(require "utils.rkt")
(require (submod "types.rkt" common))
(require (submod "types.rkt" simulator))
(require (submod "typed.rkt" binaryio))
(provide infer-type
parse-type)
; -spec.html
(: parse-type (-> AbiType Bytes ContractReturnValue))
(define (parse-type type bs)
(: assert-size (... | null | https://raw.githubusercontent.com/MichaelBurge/pyramid-scheme/d38ba194dca8eced474fb26956864ea30f9e23ce/abi.rkt | racket | -spec.html
Example ABI:
(exports (uint256 (x a b c) (+ a b c)))
{
type: "function",
name: "x",
inputs:
[
{
name: "a",
type: "uint256"
},
{
name: "b",
type: "uint256"
},
{
name: "c",
type: "uint256"
}
],
outputs: [ name: "result", type: "uint256" ]
}
(define... | #lang typed/racket
(require "utils.rkt")
(require (submod "types.rkt" common))
(require (submod "types.rkt" simulator))
(require (submod "typed.rkt" binaryio))
(provide infer-type
parse-type)
(: parse-type (-> AbiType Bytes ContractReturnValue))
(define (parse-type type bs)
(: assert-size (-> Integer Vo... |
267b29712c52b69b4d5451fe1c5d8821f59154d6c6fe2a821e8792fae2dd9a23 | ocaml-multicore/ocaml-effects-tutorial | exceptions.ml | let raise (e : exn) : 'a = failwith "not implemented"
(* Todo *)
let try_with (f : unit -> 'a) (h : exn -> 'a) : 'a = failwith "not implemented"
(* Todo *)
exception Invalid_argument
(** [sqrt f] returns the square root of [f].
@raise Invalid_argument if f < 0. *)
let sqrt f =
if f < 0.0 then raise Invalid_arg... | null | https://raw.githubusercontent.com/ocaml-multicore/ocaml-effects-tutorial/998376931b7fdaed5d54cb96b39b301b993ba995/sources/exceptions.ml | ocaml | Todo
Todo
* [sqrt f] returns the square root of [f].
@raise Invalid_argument if f < 0.
Prints:
6.513064
Invalid_argument to sqrt | let raise (e : exn) : 'a = failwith "not implemented"
let try_with (f : unit -> 'a) (h : exn -> 'a) : 'a = failwith "not implemented"
exception Invalid_argument
let sqrt f =
if f < 0.0 then raise Invalid_argument
else sqrt f
let _ =
try_with (fun () ->
let r = sqrt 42.42 in
Printf.printf "%f\n%!" r;
... |
149f7a4bf6adbf1e1950767e39dd9c10746d58c6c59a58be568577b816815862 | jordanthayer/ocaml-search | bf_beam.ml |
let fp_delta = 0.000001
type 'a node = {
data : 'a; (**)
f: float;(**)
g: float;(**)
mutable heap_index: int;(*where this node resides in the heap.*)
}
let make_initial initial_state =
{ data= initial_state;
f=0.0;
g = 0.0;
heap_index = -1;
}
let set_index n v =
n.heap_index <- v
let g... | null | https://raw.githubusercontent.com/jordanthayer/ocaml-search/57cfc85417aa97ee5d8fbcdb84c333aae148175f/search/beam/bf_beam.ml | ocaml |
where this node resides in the heap. |
let fp_delta = 0.000001
type 'a node = {
}
let make_initial initial_state =
{ data= initial_state;
f=0.0;
g = 0.0;
heap_index = -1;
}
let set_index n v =
n.heap_index <- v
let get_index n =
n.heap_index
let get_f n = n.f
let get_g n = n.g
let get_h n = n.f -.n.g
let h_ordered n1 n2 =
... |
e61879b977ca084e522bf7180071283b370c56bc6da3dde99ed9f1633015f3e3 | FlowerWrong/mblog | id3_v1.erl | %% ---
Excerpted from " Programming Erlang , Second Edition " ,
published by The Pragmatic Bookshelf .
%% Copyrights apply to this code. It may not be used to create training material,
%% courses, books, articles, and the like. Contact us if you are in doubt.
%% We make no guarantees that this code is fit for... | null | https://raw.githubusercontent.com/FlowerWrong/mblog/3233ede938d2019a7b57391405197ac19c805b27/categories/erlang/demo/jaerlang2_code/id3_v1.erl | erlang | ---
Copyrights apply to this code. It may not be used to create training material,
courses, books, articles, and the like. Contact us if you are in doubt.
We make no guarantees that this code is fit for any purpose.
Visit for more book information.
---
we now have to remove all the entries from L where | Excerpted from " Programming Erlang , Second Edition " ,
published by The Pragmatic Bookshelf .
-module(id3_v1).
-import(lists, [filter/2, map/2, reverse/1]).
-export([test/0, dir/1, read_id3_tag/1]).
test() -> dir("/home/joe/music_keep").
dir(Dir) ->
Files = lib_find:files(Dir, "*.mp3", true),
L1 = map... |
581c373e6f1959522514903172916dbf9d0587babb3a542bcdbda5eeeaeec925 | lateio/kurremkarmerruk | udp_socket_control_server.erl | % ------------------------------------------------------------------------------
%
Copyright © 2018 - 2019 , < >
%
The ISC License
%
% Permission to use, copy, modify, and/or distribute this software for any
% purpose with or without fee is hereby granted, provided that the above
% copyright notice and this perm... | null | https://raw.githubusercontent.com/lateio/kurremkarmerruk/7743cb75e92ed6ffe0f147f96148299df47c9dcf/src/udp_socket_control_server.erl | erlang | ------------------------------------------------------------------------------
Permission to use, copy, modify, and/or 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.
WITH REGARD TO THIS SO... | Copyright © 2018 - 2019 , < >
The ISC License
THE SOFTWARE IS PROVIDED “ AS IS ” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
ANY SPECIAL , DIRECT , INDIRECT , OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE , DATA OR PROFITS , WHETHER IN AN
Create socketfds based on which udp_so... |
4efe16b9709306545ae85457806f681208d3dd0217036b551eb7a2f653b4bb46 | witan-org/witan | tests.ml | (*************************************************************************)
This file is part of Witan .
(* *)
Copyright ( C ) 2017
CEA ( Commi... | null | https://raw.githubusercontent.com/witan-org/witan/d26f9f810fc34bf44daccb91f71ad3258eb62037/src/tests/tests.ml | ocaml | ***********************************************************************
alternatives)
Automatique)
... | This file is part of Witan .
Copyright ( C ) 2017
CEA ( Commissariat à l'énergie atomique et aux énergies
( Institut National de Recherche en Informatique et en
CNRS ( Centre nation... |
cec8d653dd1090e75451794a6a314c73bab00b34d34e87c8acb1cc6dbf777193 | da-x/fancydiff | Text.hs | # LANGUAGE FlexibleContexts #
{-# LANGUAGE OverloadedStrings #-}
module Lib.Text (
showT
, safeDecode
, (+@)
, removeTrailingNewLine
, leadingZeros
, lineSplit
, lineSplitAfter
, textToAText
, subAText
) where
--------------------------------------------------------------------... | null | https://raw.githubusercontent.com/da-x/fancydiff/95c76034d907f715466b26e4f4001990ca98bfcc/src/Lib/Text.hs | haskell | # LANGUAGE OverloadedStrings #
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
| A line split function that preserves all character, unlike
the standard 'lines' function, where `lines "foo\n" == lines... | # LANGUAGE FlexibleContexts #
module Lib.Text (
showT
, safeDecode
, (+@)
, removeTrailingNewLine
, leadingZeros
, lineSplit
, lineSplitAfter
, textToAText
, subAText
) where
import Data.ByteString (ByteString)
import Data.Text (Text)... |
97cd575b29de426e6a82ea76e36ac0f69712736a43b00cd4611f3c10cfdcb4c5 | avsm/platform | pretty.mli | val format : ?std:bool -> json -> Easy_format.t
val to_string : ?std:bool -> json -> string
val to_channel : ?std:bool -> out_channel -> json -> unit
| null | https://raw.githubusercontent.com/avsm/platform/b254e3c6b60f3c0c09dfdcde92eb1abdc267fa1c/duniverse/yojson.1.7.0/lib/pretty.mli | ocaml | val format : ?std:bool -> json -> Easy_format.t
val to_string : ?std:bool -> json -> string
val to_channel : ?std:bool -> out_channel -> json -> unit
| |
11d43a86b2ef092d919265d4b7789b6e7161e97fe61cb5acdb2f7ee1951c2bed | bendoerr/real-world-haskell | basicio-nodo.hs | -- Example of using a sequance of steps without a do block
--
main =
putStrLn "Greetings! What is your name?" >>
getLine >>=
(\input -> putStrLn $ "Welcome to Haskell, " ++ input ++ "!")
| null | https://raw.githubusercontent.com/bendoerr/real-world-haskell/fa43aa59e42a162f5d2d5655b274b964ebeb8f0a/ch07/basicio-nodo.hs | haskell | Example of using a sequance of steps without a do block
| main =
putStrLn "Greetings! What is your name?" >>
getLine >>=
(\input -> putStrLn $ "Welcome to Haskell, " ++ input ++ "!")
|
8ea3272cb4455b712788269e90d3235e732ed429385402b4659f692cc19e584e | fortytools/holumbus | Client.hs | module Main
(
main
)
where
import Holumbus.MapReduce.Examples.SimpleDMapReduceIO
import Holumbus.MapReduce.Examples.Sum
import System.Environment
import Control.DeepSeq
import Holumbus.Common.FileHandling
import GHC.Int
import Holumbus.Common.Logging
m c = 10^c
n c = 10^(7-c) - 1
main :: IO ()
main = do
putT... | null | https://raw.githubusercontent.com/fortytools/holumbus/4b2f7b832feab2715a4d48be0b07dca018eaa8e8/mapreduce/Examples2/Sum/Sum_2/Client.hs | haskell | module Main
(
main
)
where
import Holumbus.MapReduce.Examples.SimpleDMapReduceIO
import Holumbus.MapReduce.Examples.Sum
import System.Environment
import Control.DeepSeq
import Holumbus.Common.FileHandling
import GHC.Int
import Holumbus.Common.Logging
m c = 10^c
n c = 10^(7-c) - 1
main :: IO ()
main = do
putT... | |
410a98bc888da87fe1f06cf512f4b86a1a43813f1730d72d3c82dbcff13a396a | Gbury/dolmen | hmap.ml |
This file is free software , part of Archsat . See file " LICENSE " for more details .
(* Heterogeneous Maps,
implementation taken from containers, see data.CCMixmap *)
(* Mixmap Implementation (from containers) *)
(* ************************************************************************ *)
(* Implementation... | null | https://raw.githubusercontent.com/Gbury/dolmen/12bf280df3d886ddc0faa110effbafb71bffef7e/src/standard/hmap.ml | ocaml | Heterogeneous Maps,
implementation taken from containers, see data.CCMixmap
Mixmap Implementation (from containers)
************************************************************************
Implementation taken from containers.
* A map containing values of different types, indexed by {!key}.
* Empty map
* G... |
This file is free software , part of Archsat . See file " LICENSE " for more details .
type 'b injection = {
get : (unit -> unit) -> 'b option;
set : 'b -> (unit -> unit);
}
let create_inj () =
let r = ref None in
let get f =
r := None;
f ();
!r
and set v =
(fun () -> r := Some v)
i... |
beb0ee12a028c7ef5a264061f80b86b1b31342713907cb211f7c9f1a4d61eee2 | shayne-fletcher/zen | shortest_path.ml | #require "Core" ;;
#require "Core_kernel.Pairing_heap" ;;
open Core
* Dijkstra 's algorithm for the single source shortest paths
problem .
problem. *)
module type Graph_sig = sig
type vertex_t [@@deriving sexp]
type t [@@deriving sexp]
type extern_t
type load_error = [ `Duplicate_vertex of vertex_... | null | https://raw.githubusercontent.com/shayne-fletcher/zen/10a1d0b9bf261bb133918dd62fb1593c3d4d21cb/ocaml/dijkstra/shortest_path.ml | ocaml | failwiths "Error : %s" e G.Dijkstra.sexp_of_error | #require "Core" ;;
#require "Core_kernel.Pairing_heap" ;;
open Core
* Dijkstra 's algorithm for the single source shortest paths
problem .
problem. *)
module type Graph_sig = sig
type vertex_t [@@deriving sexp]
type t [@@deriving sexp]
type extern_t
type load_error = [ `Duplicate_vertex of vertex_... |
a24f6c03d54aaba9fa396dc884d81e197d36c7de924ba05ac013b413c0000e83 | ralexstokes/stoken | p2p.clj | (ns io.stokes.p2p
(:require [com.stuartsierra.component :as component]
[manifold.deferred :as d]
[manifold.stream :as s]
[aleph.tcp :as tcp]
[gloss.core :as gloss]
[gloss.io :as io]
[clojure.edn :as edn]
[io.stokes.queue :as queue]
... | null | https://raw.githubusercontent.com/ralexstokes/stoken/b88adb36ffa1e9f3099925634eb1f98beb986442/src/io/stokes/p2p.clj | clojure | peer management
network interface following the example here: | (ns io.stokes.p2p
(:require [com.stuartsierra.component :as component]
[manifold.deferred :as d]
[manifold.stream :as s]
[aleph.tcp :as tcp]
[gloss.core :as gloss]
[gloss.io :as io]
[clojure.edn :as edn]
[io.stokes.queue :as queue]
... |
55e491e96a9ed8a76abeb29d6f9e98af31964cba3b1b59be4c8e9861085ec14b | janestreet/universe | bad_test.ml | module A = struct
module Expect_test_config = struct
include Expect_test_config
let upon_unreleasable_issue = `Warning_for_collector_testing
end
let get_a_trace () =
let rec loop n =
if n < 0
then Printexc.get_callstack 10, 0
else (
let x, y = loop (n - 1) in
x, y +... | null | https://raw.githubusercontent.com/janestreet/universe/b6cb56fdae83f5d55f9c809f1c2a2b50ea213126/ppx_expect/test/bad_test.ml | ocaml | expect_test_collector: This test expectation appears to contain a backtrace.
This is strongly discouraged as backtraces are fragile.
Please change this test to not include a backtrace. | module A = struct
module Expect_test_config = struct
include Expect_test_config
let upon_unreleasable_issue = `Warning_for_collector_testing
end
let get_a_trace () =
let rec loop n =
if n < 0
then Printexc.get_callstack 10, 0
else (
let x, y = loop (n - 1) in
x, y +... |
739f441785807649978e2c97d37b5fadb4fc63345a65ec9273096f77328c2d1a | ygmpkk/house | GIFparser.hs | From InternetLib by ,
-- /~hallgren/InternetLib/
module GIFparser(parseGIF,parseGIFs,sizeOfGIF) where
import GIF
import ParsOps2
import Utils2(bit,bits)
import Data.Array.Unboxed(listArray)
import Data.Word(Word8)
default(Int)
import Trace
--tr s = trace s $ return ()
tr s = return ()
sizeOfGIF = parse gifSizeP
... | null | https://raw.githubusercontent.com/ygmpkk/house/1ed0eed82139869e85e3c5532f2b579cf2566fa2/kernel/Gadgets/Images/GIFparser.hs | haskell | /~hallgren/InternetLib/
tr s = trace s $ return ()
r <- theRest -- allow trailing garbage | From InternetLib by ,
module GIFparser(parseGIF,parseGIFs,sizeOfGIF) where
import GIF
import ParsOps2
import Utils2(bit,bits)
import Data.Array.Unboxed(listArray)
import Data.Word(Word8)
default(Int)
import Trace
tr s = return ()
sizeOfGIF = parse gifSizeP
where
gifSizeP =
do signatureP
sd <... |
cb8ba7f59b52ab6faaedb3cf70689d4a5ce47f83eba815e48facfb251ee5db88 | fmi/clojure-examples | 01-atom-retry.clj | ;;; This example illustrates retrying an atom update with swap!
(load-file "00-utils.clj")
(def number (atom 0))
(defn slow-inc [x]
(printf "Incrementing %s slowly..." x)
(println)
(Thread/sleep 1000)
(inc x))
(defn very-slow-inc [x]
(printf "Incrementing %s very slowly..." x)
(println)
(Thread/sleep ... | null | https://raw.githubusercontent.com/fmi/clojure-examples/46ec0fe7bdfdfccde1ab74a94c64dbd73ea58269/2014/03-atoms/01-atom-retry.clj | clojure | This example illustrates retrying an atom update with swap!
The output of this program is:
→ clj 01-atom-retry.clj
Incrementing 0 very slowly...
Incrementing 0 slowly...
Incrementing 1 very slowly...
|
(load-file "00-utils.clj")
(def number (atom 0))
(defn slow-inc [x]
(printf "Incrementing %s slowly..." x)
(println)
(Thread/sleep 1000)
(inc x))
(defn very-slow-inc [x]
(printf "Incrementing %s very slowly..." x)
(println)
(Thread/sleep 3000)
(inc x))
(in-background
(swap! number very-slow-inc))... |
a02ddbc9749fe338af124994c62896ae0fadcef1bed690290bead190a9131dd4 | wangweihao/ProgrammingErlangAnswer | my_alarm_handler.erl | -module(my_alarm_handler).
-behaviour(gen_event).
%% gen_event回调函数
-export([init/1, code_change/3, handle_event/2, handle_call/2,
handle_info/2, terminate/2]).
%% init(Args) 必须返回{ok, State}
init(Args) ->
io:format("*** my_alarm_handler init:~p~n", [Args]),
{ok, 0}.
handle_event({set_alarm, tooHot}, N... | null | https://raw.githubusercontent.com/wangweihao/ProgrammingErlangAnswer/b145b5e6a19cb866ce5d2ceeac116d751f6e2b3d/23/partice/my_alarm_handler.erl | erlang | gen_event回调函数
init(Args) 必须返回{ok, State} | -module(my_alarm_handler).
-behaviour(gen_event).
-export([init/1, code_change/3, handle_event/2, handle_call/2,
handle_info/2, terminate/2]).
init(Args) ->
io:format("*** my_alarm_handler init:~p~n", [Args]),
{ok, 0}.
handle_event({set_alarm, tooHot}, N) ->
error_logger:error_msg("*** Tell the E... |
aaf054a5b650f954f37e9a935becb30275a4547850075c9d18325a6c8b109845 | madgen/exalog | SpanIrrelevance.hs | # LANGUAGE DataKinds #
module Fixture.SpanIrrelevance
( program
, initEDB
, rPred
, rTuples
) where
import Protolude hiding (SrcLoc, Set)
import Data.Maybe (fromJust)
import qualified Data.List.NonEmpty as NE
import qualified Data.Vector.Sized as V
import Data.Singletons.TypeLits
impo... | null | https://raw.githubusercontent.com/madgen/exalog/7d169b066c5c08f2b8e44f5e078df264731ac177/fixtures/Fixture/SpanIrrelevance.hs | haskell |
- r("a") :- c("1").
- r("b") :- c("2").
| # LANGUAGE DataKinds #
module Fixture.SpanIrrelevance
( program
, initEDB
, rPred
, rTuples
) where
import Protolude hiding (SrcLoc, Set)
import Data.Maybe (fromJust)
import qualified Data.List.NonEmpty as NE
import qualified Data.Vector.Sized as V
import Data.Singletons.TypeLits
impo... |
5c5b0e19cbb6cfbf5e6f1c604afcafc18632dd84d8586086f33bfa6a238522b7 | chenyukang/eopl | 01.scm | (load "../libs/init.scm")
;; (value-of <<3>> p) etc
;; there are several positions apply this rule
| null | https://raw.githubusercontent.com/chenyukang/eopl/0406ff23b993bfe020294fa70d2597b1ce4f9b78/ch3/01.scm | scheme | (value-of <<3>> p) etc
there are several positions apply this rule | (load "../libs/init.scm")
|
e4a3b9a0cbd554b9c75fef609517cc1285fdb51f9beac2c6e34b881d3929ad16 | dbuenzli/fut | sbox.ml |
open Testing
open Fut.Op
let () =
let u = Futu.apply Unix.environment () in
match Fut.await u with
| `Det (`Ok v) -> Printf.printf "env: %s" (String.concat "," (Array.to_list v))
| `Det (`Error (e, _, _)) -> Printf.printf "error: %s" (Unix.error_message e)
| `Undet -> Printf.printf "Did not determine\n%!"
... | null | https://raw.githubusercontent.com/dbuenzli/fut/907de63df12815f2df2cb796baa7fa37ac2758d4/test/sbox.ml | ocaml |
let every_d d =
let rec loop d =
Fut.delay d >>= fun diff -> loop (d +. diff)
in
loop d
let every_d' d = (* avoids fp error accumulation (are you sure ?) |
open Testing
open Fut.Op
let () =
let u = Futu.apply Unix.environment () in
match Fut.await u with
| `Det (`Ok v) -> Printf.printf "env: %s" (String.concat "," (Array.to_list v))
| `Det (`Error (e, _, _)) -> Printf.printf "error: %s" (Unix.error_message e)
| `Undet -> Printf.printf "Did not determine\n%!"
... |
738035caaaec56b3ec57925bb0e20619a03b7f093435a4b8e865bce4ee733c8d | apa512/clj-rethinkdb | query_builder.cljc | (ns rethinkdb.query-builder
(:require [clojure.string :as string]
[rethinkdb.types :refer [tt->int qt->int]]
#?@(:clj [[clj-time.coerce :as c]]))
#?(:clj
(:import (org.joda.time DateTime)
(java.util Base64 Base64$Encoder Date UUID))))
(declare parse-term)
(def encoder (atom nil)... | null | https://raw.githubusercontent.com/apa512/clj-rethinkdb/fdc23cacdfe66c72ab2bfd939ef38b043523c8ef/src/rethinkdb/query_builder.cljc | clojure | (ns rethinkdb.query-builder
(:require [clojure.string :as string]
[rethinkdb.types :refer [tt->int qt->int]]
#?@(:clj [[clj-time.coerce :as c]]))
#?(:clj
(:import (org.joda.time DateTime)
(java.util Base64 Base64$Encoder Date UUID))))
(declare parse-term)
(def encoder (atom nil)... | |
c1bc5460793050388d0789216f0b23d880d0a9be47e28f0a1b4671801e3c958e | dundalek/liz | main.clj | (set! *warn-on-reflection* true)
(ns liz.main
(:gen-class)
(:require [clojure.tools.cli :as cli]
[clojure.java.io :as io]
[clojure.string :as str]
[liz.impl.compiler :as compiler]))
(def version (str/trim (slurp (io/resource "LIZ_VERSION"))))
(defn usage [options-summary]
(->... | null | https://raw.githubusercontent.com/dundalek/liz/158129a160fe68646b164df585cae479a6cde231/src/liz/main.clj | clojure | Process all files regardless of errors, compile-file captures all errors and reports them to stderr.
so that usage like `liz src/*.liz && zig build` will not continue with zig compilation. | (set! *warn-on-reflection* true)
(ns liz.main
(:gen-class)
(:require [clojure.tools.cli :as cli]
[clojure.java.io :as io]
[clojure.string :as str]
[liz.impl.compiler :as compiler]))
(def version (str/trim (slurp (io/resource "LIZ_VERSION"))))
(defn usage [options-summary]
(->... |
e60b29f33d7e110d1ff238839b245bff2f880416c230753a72dbfff28b4daba1 | janestreet/merlin-jst | rec_check.ml | (**************************************************************************)
(* *)
(* OCaml *)
(* *)
... | null | https://raw.githubusercontent.com/janestreet/merlin-jst/980b574405617fa0dfb0b79a84a66536b46cd71b/upstream/ocaml_flambda/typing/rec_check.ml | ocaml | ************************************************************************
OCaml
... | , University of Cambridge
, , INRIA Saclay
, ENS Lyon
Copyright 2017
Copyright 2018
the GNU Lesser General Public License version 2.1 , with the
* Static checking of recurs... |
93ae1e407d787a906c7d6e449339743ee4039e1668a2c5f2d44d4366f21571c8 | wavejumper/rehook | browser.cljs | (ns rehook.test.browser
(:require [rehook.core :as rehook]
[rehook.dom :refer-macros [defui ui]]
[rehook.dom.browser :as dom.browser]
[rehook.test :as rehook.test]
[rehook.util :as util]
[zprint.core :as zp]
[clojure.data :as data]
["... | null | https://raw.githubusercontent.com/wavejumper/rehook/c1a4207918827f4b738cdad9a9645385e5e10ff4/rehook-test/src/rehook/test/browser.cljs | clojure | bootstrap iframe with 'sandboxed' ctx
TODO: not use loop
Re-run our tests everytime the registry updates. | (ns rehook.test.browser
(:require [rehook.core :as rehook]
[rehook.dom :refer-macros [defui ui]]
[rehook.dom.browser :as dom.browser]
[rehook.test :as rehook.test]
[rehook.util :as util]
[zprint.core :as zp]
[clojure.data :as data]
["... |
7929a81c3db867e9fb9c9a73ea1a20838f53ff9a4d8d506d1432ed1dbf2e4e41 | Eventuria/demonstration-gsd | Core.hs | # LANGUAGE NamedFieldPuns #
# LANGUAGE RecordWildCards #
module Eventuria.Commons.Logger.Core where
import qualified System.Log.Logger as LoggerUsed
import Control.Concurrent
type LoggerId = String
type LoggerMessage = String
data Logger = Logger { loggerId :: LoggerId }
getLogger :: LoggerId -> IO (Logger)
getLogg... | null | https://raw.githubusercontent.com/Eventuria/demonstration-gsd/5c7692b310086bc172d3fd4e1eaf09ae51ea468f/src/Eventuria/Commons/Logger/Core.hs | haskell | # LANGUAGE NamedFieldPuns #
# LANGUAGE RecordWildCards #
module Eventuria.Commons.Logger.Core where
import qualified System.Log.Logger as LoggerUsed
import Control.Concurrent
type LoggerId = String
type LoggerMessage = String
data Logger = Logger { loggerId :: LoggerId }
getLogger :: LoggerId -> IO (Logger)
getLogg... | |
e349b149c0aca46c47c51d416ccbd45f0e33448c37796e78c43c5cbf306260b2 | triffon/fp-2022-23 | solutions.rkt | #lang racket
0 . Като foldl но рекурсивно
: ( foldr * - 0 ' ( 1 2 3 4 ) ) - > -2
(define (foldr* op acc lst)
(if (null? lst)
acc
(op (car lst) (foldr* op acc (cdr lst)))))
Използвайте foldl :
;-----------------------------
1 . дължина на списък
(define (length* lst)
(foldl (lambda (x _) (+ x 1... | null | https://raw.githubusercontent.com/triffon/fp-2022-23/8a5aa65d2f5a3e00359e149765236da755bd13e5/exercises/cs3%264/05/solutions.rkt | racket | -----------------------------
------------------- | #lang racket
0 . Като foldl но рекурсивно
: ( foldr * - 0 ' ( 1 2 3 4 ) ) - > -2
(define (foldr* op acc lst)
(if (null? lst)
acc
(op (car lst) (foldr* op acc (cdr lst)))))
Използвайте foldl :
1 . дължина на списък
(define (length* lst)
(foldl (lambda (x _) (+ x 1)) 0 lst))
2 . Премахва повт... |
08a20c7bbee4b5500c98d7213a920800e3669585a2e0560ff5926d3ae729fb71 | acieroid/scala-am | race6.scm | (letrec ((counter 0)
(inc (lambda ()
(set! counter (+ counter 1))))
(dec (lambda ()
(set! counter (- counter 1))))
(t1 (future (inc)))
(t2 (future (dec)))
(t3 (future (inc)))
(t4 (future (dec)))
(t5 (future (inc)))
(... | null | https://raw.githubusercontent.com/acieroid/scala-am/13ef3befbfc664b77f31f56847c30d60f4ee7dfe/test/concurrentScheme/futures/variations/race6.scm | scheme | (letrec ((counter 0)
(inc (lambda ()
(set! counter (+ counter 1))))
(dec (lambda ()
(set! counter (- counter 1))))
(t1 (future (inc)))
(t2 (future (dec)))
(t3 (future (inc)))
(t4 (future (dec)))
(t5 (future (inc)))
(... | |
5a690976aaf5287cc535b553e57be7cb309e87ea5b4c3ccae05a780b5b1caf9e | directrix1/DuplicateBridgeTeamSteele | tests.lisp | (in-package "ACL2")
(include-book "date-time")
(include-book "doublecheck" :dir :teachpacks)
(include-book "testing" :dir :teachpacks)
(check-expect (parse-date "Jan 1, 1980") 0)
(check-expect (split2 (str->chrs "Testing!") nil #\e)
'("T" (#\s #\t #\i #\n #\g #\!)))
(check-expect (split2 (st... | null | https://raw.githubusercontent.com/directrix1/DuplicateBridgeTeamSteele/0f0d0312569fb1d26d568e2b87d66ac160ac60c3/timpl/dropbox/psp%2B%2B/tests.lisp | lisp | midnight
| (in-package "ACL2")
(include-book "date-time")
(include-book "doublecheck" :dir :teachpacks)
(include-book "testing" :dir :teachpacks)
(check-expect (parse-date "Jan 1, 1980") 0)
(check-expect (split2 (str->chrs "Testing!") nil #\e)
'("T" (#\s #\t #\i #\n #\g #\!)))
(check-expect (split2 (st... |
b21bff2a1adf9724e221d5457759fa577d006e8f2e2878ee432ac8b72cfa793f | zotonic/cowmachine | prop_cowmachine_simple.erl | -module(prop_cowmachine_simple).
-include_lib("proper/include/proper.hrl").
-export([
execute/2,
process/4
]).
%%%%%%%%%%%%%%%%%%
%%% Properties %%%
%%%%%%%%%%%%%%%%%%
%% shell command for a test: rebar3 as test proper -p prop_cowmachine_start
prop_cowmachine_start() ->
?FORALL(_Type, boolean(),
begin... | null | https://raw.githubusercontent.com/zotonic/cowmachine/7c96143c2dc26d36ba620c21b6c891a2fcabdccc/test/prop_cowmachine_simple.erl | erlang |
Properties %%%
shell command for a test: rebar3 as test proper -p prop_cowmachine_start
Wait for the server to start
Do a request to the test server, and check the response
io:format("~p~n",[Result]),
Helpers %%%
Use this module as middleware, and controller
Controller export | -module(prop_cowmachine_simple).
-include_lib("proper/include/proper.hrl").
-export([
execute/2,
process/4
]).
prop_cowmachine_start() ->
?FORALL(_Type, boolean(),
begin
{ok, _} = application:ensure_all_started(cowmachine),
TestPid = self(),
spawn_link(fun() ->
{ok, _} =... |
bc346adc5e1fe9856bf44922b001d45c237da7b4b33759d7c76fbe303ad88516 | unclechu/MIDIHasKey | Main.hs | # LANGUAGE UnicodeSyntax #
# LANGUAGE ScopedTypeVariables #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE QuasiQuotes #
{-# LANGUAGE BangPatterns #-}
# LANGUAGE LambdaCase #
# LANGUAGE DuplicateRecordFields #
module Main (main) where -- "midihaskey" app
import Prelude.Unicode
import Data.Default (def)
import Text.In... | null | https://raw.githubusercontent.com/unclechu/MIDIHasKey/4040e2efe9d3954dad055ca730d9a746361eb3f8/midihaskey/app/Main.hs | haskell | # LANGUAGE OverloadedStrings #
# LANGUAGE BangPatterns #
"midihaskey" app
local | # LANGUAGE UnicodeSyntax #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE QuasiQuotes #
# LANGUAGE LambdaCase #
# LANGUAGE DuplicateRecordFields #
import Prelude.Unicode
import Data.Default (def)
import Text.InterpolatedString.QM
import Control.Monad
import Control.Concurrent
import System.Environment (getArgs)
impor... |
d61f0f28d4e6e83281611194bf9179f59896c452bcce0b8895a52b92aa03af8e | a-vorontsov/aver | bytecode.ml | open Tast
open Instruction
open Table
open Types
let rec findi x lst acc =
match lst with
| [] ->
Printf.eprintf "Not found";
exit (-1)
| h :: t -> if x = h then acc else findi x t (1 + acc)
let structs_table = Hashtbl.create 32
let fields_to_array fields =
List.map (fun (TStructField (_, n, t)) ... | null | https://raw.githubusercontent.com/a-vorontsov/aver/d321edb72570871e7255753d35f28483689538c3/compiler/bytecode.ml | ocaml | open Tast
open Instruction
open Table
open Types
let rec findi x lst acc =
match lst with
| [] ->
Printf.eprintf "Not found";
exit (-1)
| h :: t -> if x = h then acc else findi x t (1 + acc)
let structs_table = Hashtbl.create 32
let fields_to_array fields =
List.map (fun (TStructField (_, n, t)) ... | |
d0aab5a8228a2951c253a0b0b18b319c705c95512afbc59a6951eac6fd2d18a3 | alesaccoia/festival_flinger | cmu_us_slt_duration.scm | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
Carnegie Mellon University ; ; ;
and and ; ; ;
Copyright ( c ) 1998 - 2000 ... | null | https://raw.githubusercontent.com/alesaccoia/festival_flinger/87345aad3a3230751a8ff479f74ba1676217accd/lib/voices/us/cmu_us_slt_cg/festvox/cmu_us_slt_duration.scm | scheme |
;;;
; ;
; ;
; ;
; ;
;;;
Permission is hereby granted, free of charge, to use and distribute ;;;
this software and its documentation without restriction, including ;;;
withou... | Duration for English
(require 'cmu_us_slt_durdata)
(define (cmu_us_slt::select_duration)
"(cmu_us_slt::select_duration)
Set up duration for English."
(set! duration_cart_tree cmu_us_slt::zdur_tree)
(set! duration_ph_info cmu_us_slt::phone_durs)
(Parameter.set 'Duration_Method 'Tree_ZScores)
(Parameter.set... |
928c099e6c4956c5361eadd56d790145d21c95f919ba717291cd787690459d91 | wireless-net/erlang-nommu | wxJoystickEvent.erl | %%
%% %CopyrightBegin%
%%
Copyright Ericsson AB 2008 - 2013 . All Rights Reserved .
%%
The contents of this file are subject to the Erlang Public License ,
Version 1.1 , ( the " License " ) ; you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Publi... | null | https://raw.githubusercontent.com/wireless-net/erlang-nommu/79f32f81418e022d8ad8e0e447deaea407289926/lib/wx/src/gen/wxJoystickEvent.erl | erlang |
%CopyrightBegin%
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at /.
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitatio... | Copyright Ericsson AB 2008 - 2013 . All Rights Reserved .
The contents of this file are subject to the Erlang Public License ,
Version 1.1 , ( the " License " ) ; you may not use this file except in
Software distributed under the License is distributed on an " AS IS "
< dd><em > joy_button_down</em > , < em ... |
3e1812d12c8e6ca7c08b9dde55cb4612c8901a7008024bd57c9152d53ac8b53f | erlymon/erlymon | em_geocoder.erl | %%%-------------------------------------------------------------------
@author
( C ) 2015 , < >
%%% @doc
Erlymon is an open source GPS tracking system for various GPS tracking devices .
%%%
Copyright ( C ) 2015 , < > .
%%%
This file is part of Erlymon .
%%%
Erlymon is free software : yo... | null | https://raw.githubusercontent.com/erlymon/erlymon/2250619783d6da1e33a502911a8fa52ce016c094/apps/erlymon/src/em_geocoder/em_geocoder.erl | erlang | -------------------------------------------------------------------
@doc
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
along with this program. If not, see </>.
@end
-------------------------------------------------------... | @author
( C ) 2015 , < >
Erlymon is an open source GPS tracking system for various GPS tracking devices .
Copyright ( C ) 2015 , < > .
This file is part of Erlymon .
Erlymon is free software : you can redistribute it and/or modify
it under the terms of the GNU Affero General Publ... |
3ae421c2fa093885b0a35cfd3b37751b83d1b8538d8a658e29b8f2c6b589de3d | fredlund/McErlang | sim_sched.erl | %%% File : sim_sched.erl
Author : < >
%%% Description : A scheduler for the sequential part of a run_parallel_command run
Created : 3 Mar 2010 by < >
Copyright ( c ) 2009 ,
%% All rights reserved.
%%
%% Redistribution and use in source and binary forms, with or without
%% modification, are permitted... | null | https://raw.githubusercontent.com/fredlund/McErlang/25b38a38a729fdb3c3d2afb9be016bbb14237792/app/src/sim_sched.erl | erlang | File : sim_sched.erl
Description : A scheduler for the sequential part of a run_parallel_command run
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
%% Redistributions of source code must re... | Author : < >
Created : 3 Mar 2010 by < >
Copyright ( c ) 2009 ,
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
BE LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR
@author < >
2009
@doc
application . The < code > scheduler</cod... |
ed493518964b1b49c556c51c585711ff88a793c702a549898812f48bfaef1f6e | corecursive/sicp-study-group | ex02_78.scm | * Exercise 2.78 :* The internal procedures in the ` scheme - number '
;; package are essentially nothing more than calls to the primitive
;; procedures `+', `-', etc. It was not possible to use the
;; primitives of the language directly because our type-tag system
;; requires that each data object have a type attach... | null | https://raw.githubusercontent.com/corecursive/sicp-study-group/d96cea3104243e0f92b383254a92ab454bf0bf7f/plundaahl/exercises/ex02_78.scm | scheme | package are essentially nothing more than calls to the primitive
procedures `+', `-', etc. It was not possible to use the
primitives of the language directly because our type-tag system
requires that each data object have a type attached to it. In
fact, however, all Lisp implementations do have a type system,
w... | * Exercise 2.78 :* The internal procedures in the ` scheme - number '
` attach - tag ' from section * Note 2 - 4 - 2 : : so that our generic system
takes advantage of Scheme 's internal type system . That is to say ,
(define (attach-tag type-tag contents)
(if (number? contents)
contents
(cons typ... |
a81e7899b6d1e0352dbf5fefd1471c4381de0f05a71ce9999c3c82c378436a02 | racehub/om-bootstrap | wrapper.cljs | #_
(:require [om-bootstrap.grid :as g]
[om-bootstrap.input :as i])
(i/input {:label "Input wrapper"
:help "Use this when you need something other than the
available input types."}
(g/row
{}
(g/col {:xs 6} (i/input {:type "text" :class "form-control"}))
... | null | https://raw.githubusercontent.com/racehub/om-bootstrap/18fb7f67c306d208bcb012a1b765ac1641d7a00b/dev/snippets/input/wrapper.cljs | clojure | #_
(:require [om-bootstrap.grid :as g]
[om-bootstrap.input :as i])
(i/input {:label "Input wrapper"
:help "Use this when you need something other than the
available input types."}
(g/row
{}
(g/col {:xs 6} (i/input {:type "text" :class "form-control"}))
... | |
21e9bd43f89e7082698d6dd8d3ca1ff99d6b81195747486625cfae9231bf21ab | mtolly/onyxite-customs | PartDrum.hs | # LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DerivingVia #
# LANGUAGE LambdaCase #
# LANGUAGE RecordWildCards #
module Onyx.Harmonix.GH2.PartDrum where
import Control.Monad.Codec
import qualified Data.EventList.Relative.TimeBody as RTB
import qualified Data... | null | https://raw.githubusercontent.com/mtolly/onyxite-customs/0c8acd6248fe92ea0d994b18b551973816adf85b/haskell/packages/onyx-lib/src/Onyx/Harmonix/GH2/PartDrum.hs | haskell | # LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DerivingVia #
# LANGUAGE LambdaCase #
# LANGUAGE RecordWildCards #
module Onyx.Harmonix.GH2.PartDrum where
import Control.Monad.Codec
import qualified Data.EventList.Relative.TimeBody as RTB
import qualified Data... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.