_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 |
|---|---|---|---|---|---|---|---|---|
39d864a414b04fc32cc105c32efd355bed1b87d66fa4f9f42c7278061009d8d8 | exercism/haskell | Tests.hs | # LANGUAGE RecordWildCards #
import Data.Foldable (for_)
import Test.Hspec (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
import Bowling (score, BowlingError(..))
main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs
specs :: Spec
s... | null | https://raw.githubusercontent.com/exercism/haskell/f81ee7dc338294b3dbefb7bd39fc193546fcec26/exercises/practice/bowling/test/Tests.hs | haskell | # LANGUAGE RecordWildCards #
import Data.Foldable (for_)
import Test.Hspec (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
import Bowling (score, BowlingError(..))
main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs
specs :: Spec
s... | |
9ecfc41035f9093d8863a595b82291283b0615ae0a2a2bca7957c21133d937c3 | blockmason/lndr | Config.hs | # LANGUAGE DeriveGeneric #
{-# LANGUAGE OverloadedStrings #-}
module Lndr.CLI.Config (
Config(..)
, configPath
) where
import Data.Default
import Dhall
import Network.Ethereum.Web3
import System.Directory (getCurrentDirectory)
data Config = Config { url... | null | https://raw.githubusercontent.com/blockmason/lndr/58fe5f82d5d057e463be23821454e3a0515ef9b9/lndr-cli/src/Lndr/CLI/Config.hs | haskell | # LANGUAGE OverloadedStrings # | # LANGUAGE DeriveGeneric #
module Lndr.CLI.Config (
Config(..)
, configPath
) where
import Data.Default
import Dhall
import Network.Ethereum.Web3
import System.Directory (getCurrentDirectory)
data Config = Config { url :: Text
... |
768766e71501287c4744abe7cb4a6b24aa9388a74ae23248dd315d2afc55fbf0 | plumatic/grab-bag | mongo_test.clj | (ns store.mongo-test
(:use clojure.test plumbing.core plumbing.test)
(:require
[store.bucket :as bucket]
[store.mongo :as mongo]))
(defn bucket-test [s]
(let [b (mongo/bucket-collection s "testBucket")]
(bucket/put b "k1" {:v "v1"})
(is (= (bucket/get b "k1") {:v "v1"}))
(is (= 1 (count (filte... | null | https://raw.githubusercontent.com/plumatic/grab-bag/a15e943322fbbf6f00790ce5614ba6f90de1a9b5/lib/store/test/store/mongo_test.clj | clojure | account for store | (ns store.mongo-test
(:use clojure.test plumbing.core plumbing.test)
(:require
[store.bucket :as bucket]
[store.mongo :as mongo]))
(defn bucket-test [s]
(let [b (mongo/bucket-collection s "testBucket")]
(bucket/put b "k1" {:v "v1"})
(is (= (bucket/get b "k1") {:v "v1"}))
(is (= 1 (count (filte... |
5b3cd9047625493634dde0a69fa6c23004fee905ccf94c73b9924cf536da5514 | Clojure2D/clojure2d-examples | interval.clj | (ns rt4.in-one-weekend.ch10c.interval
(:refer-clojure :exclude [empty])
(:require [fastmath.core :as m]))
(set! *warn-on-reflection* true)
(set! *unchecked-math* :warn-on-boxed)
(m/use-primitive-operators)
(defprotocol IntervalProto
(contains [interval x]) ;; a <= x <= b
;; introduced due to the bug in the bo... | null | https://raw.githubusercontent.com/Clojure2D/clojure2d-examples/ead92d6f17744b91070e6308157364ad4eab8a1b/src/rt4/in_one_weekend/ch10c/interval.clj | clojure | a <= x <= b
introduced due to the bug in the book (in the time of writing this code), a < x <= b | (ns rt4.in-one-weekend.ch10c.interval
(:refer-clojure :exclude [empty])
(:require [fastmath.core :as m]))
(set! *warn-on-reflection* true)
(set! *unchecked-math* :warn-on-boxed)
(m/use-primitive-operators)
(defprotocol IntervalProto
(contains- [interval x])
(clamp [interval x]))
(defrecord Interval [^double... |
e49b9099d5379af28ffb80859fecfaab9595c9e464e59b8930973fa63ff7285a | chenyukang/eopl | sec2.1.scm | (module sec2.1 (lib "eopl.ss" "eopl")
(require "utils.scm")
(let ()
;; Unary Representation
page 33
(define zero (lambda () '()))
(define is-zero? (lambda (n) (null? n)))
(define successor (lambda (n) (cons #t n)))
(define predecessor (lambda (n) (cdr n)))
;; Need this style of definiti... | null | https://raw.githubusercontent.com/chenyukang/eopl/0406ff23b993bfe020294fa70d2597b1ce4f9b78/base/chapter2/sec2.1.scm | scheme | Unary Representation
Need this style of definition to define a recursive function
inside a let, sorry.
Scheme number representation
Reverse-number representation
unchanged below here! | (module sec2.1 (lib "eopl.ss" "eopl")
(require "utils.scm")
(let ()
page 33
(define zero (lambda () '()))
(define is-zero? (lambda (n) (null? n)))
(define successor (lambda (n) (cons #t n)))
(define predecessor (lambda (n) (cdr n)))
(define (plus x y)
(if (is-zero? x)
y
... |
c7564a6fccc8a2bca1c3155fc79245a6e95f9acdd965c6e4f57b9364f62d6175 | Quid2/flat | PkgBE.hs | {- Binary-experiment test -}
# LANGUAGE PackageImports , FlexibleInstances , MultiParamTypeClasses #
module PkgBE(BEPkg(..)) where
import Data.Word
import Control.Exception
import Data.Monoid
import Control.Applicative
import qualified "binary-experiment" Data.Binary.Serialize as BE (serialize,deserializeOrFail)
imp... | null | https://raw.githubusercontent.com/Quid2/flat/95e5d7488451e43062ca84d5376b3adcc465f1cd/benchmarks/PkgBE.hs | haskell | Binary-experiment test
as BE -- hiding ( encode , decode )
# INLINE encodeCtr2 #
# INLINE encodeCtr7 #
encode n = int (fromEnum n)
encode = int . fromEnum
correct? | # LANGUAGE PackageImports , FlexibleInstances , MultiParamTypeClasses #
module PkgBE(BEPkg(..)) where
import Data.Word
import Control.Exception
import Data.Monoid
import Control.Applicative
import qualified "binary-experiment" Data.Binary.Serialize as BE (serialize,deserializeOrFail)
import "binary-experiment" Data.... |
23c431804d22bdd98de6c88648295c137e55cf4027a10890a509bde6e589d5e7 | haskell/directory | CreateDirectoryIfMissing001.hs | # LANGUAGE CPP #
module CreateDirectoryIfMissing001 where
#include "util.inl"
import Data.Either (lefts)
import System.Directory.Internal
import System.OsPath ((</>), addTrailingPathSeparator)
main :: TestEnv -> IO ()
main _t = do
createDirectoryIfMissing False testdir
cleanup
T(expectIOErrorType) () isDoesNot... | null | https://raw.githubusercontent.com/haskell/directory/c1895b93a49a9723c949eefef71b0855b4ee5d51/tests/CreateDirectoryIfMissing001.hs | haskell | createDirectoryIfMissing is allowed to fail with isDoesNotExistError if
of creating the hierarchy.
It is also allowed to fail with permission errors | # LANGUAGE CPP #
module CreateDirectoryIfMissing001 where
#include "util.inl"
import Data.Either (lefts)
import System.Directory.Internal
import System.OsPath ((</>), addTrailingPathSeparator)
main :: TestEnv -> IO ()
main _t = do
createDirectoryIfMissing False testdir
cleanup
T(expectIOErrorType) () isDoesNot... |
799bd135ce3510338d625be720d39c23c6cae50ec2cba56781bbfd7a425e3fa7 | hatsugai/SyncStitch | figState.ml | open Guedra
open DrawModel
open Draw
open PeFig
let color_state = color 1.0 1.0 1.0
let color_state_clone = color 1.0 1.0 1.0
let color_focus_on_path_fill = color 0.0 1.0 0.2
let color_focus_on_path_text = color_black
type handle = LT | MT | RT | LM | RM | LB | MB | RB
type transform_context =
Idle
| Resizing of h... | null | https://raw.githubusercontent.com/hatsugai/SyncStitch/cbf0d28aa77a6f4579233ff64227fd7150e300e0/src/figState.ml | ocaml | move or transform
select or unselect
select subtree
scroll text | open Guedra
open DrawModel
open Draw
open PeFig
let color_state = color 1.0 1.0 1.0
let color_state_clone = color 1.0 1.0 1.0
let color_focus_on_path_fill = color 0.0 1.0 0.2
let color_focus_on_path_text = color_black
type handle = LT | MT | RT | LM | RM | LB | MB | RB
type transform_context =
Idle
| Resizing of h... |
8ec0ad03b6ca2d655e821d180c7f239f24ae8655890f8c10550f74ccc12918e9 | mirage/ocaml-vchan | events_lwt_unix.ml |
* Copyright ( c ) 2014 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 ... | null | https://raw.githubusercontent.com/mirage/ocaml-vchan/69de0287d4eb732b42873f10c346f8473032591f/lwt/events_lwt_unix.ml | ocaml |
* Copyright ( c ) 2014 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 ... | |
73f23f020ba5fb4442df80dfa8e35b0e52813d63b8b62bfda35f06e90f55d9b0 | tsloughter/kuberl | kuberl_v1beta1_webhook_client_config.erl | -module(kuberl_v1beta1_webhook_client_config).
-export([encode/1]).
-export_type([kuberl_v1beta1_webhook_client_config/0]).
-type kuberl_v1beta1_webhook_client_config() ::
#{ 'caBundle' := kuberl_byte_array:kuberl_byte_array(),
'service' => kuberl_admissionregistration_v1beta1_service_reference:kuberl_adm... | null | https://raw.githubusercontent.com/tsloughter/kuberl/f02ae6680d6ea5db6e8b6c7acbee8c4f9df482e2/gen/kuberl_v1beta1_webhook_client_config.erl | erlang | -module(kuberl_v1beta1_webhook_client_config).
-export([encode/1]).
-export_type([kuberl_v1beta1_webhook_client_config/0]).
-type kuberl_v1beta1_webhook_client_config() ::
#{ 'caBundle' := kuberl_byte_array:kuberl_byte_array(),
'service' => kuberl_admissionregistration_v1beta1_service_reference:kuberl_adm... | |
aad339c67a52eee83f1d1c842f34a82f4c1dcacc27f30b76e6cf12404aafead5 | ecraven/r7rs-benchmarks | Guile3-prelude.scm | (use-modules (ice-9 rdelim))
(define-syntax import
(syntax-rules ()
((import stuff ...)
(begin) ;; do nothing
)))
(define flush-output-port force-output)
(define current-second current-time)
(define (jiffies-per-second) internal-time-units-per-second)
(define current-jiffy get-internal-real-time)
(defin... | null | https://raw.githubusercontent.com/ecraven/r7rs-benchmarks/b475dd8807be486a5f6230ce179eeadf9473ecf9/src/Guile3-prelude.scm | scheme | do nothing
sufficient for tail.scm | (use-modules (ice-9 rdelim))
(define-syntax import
(syntax-rules ()
((import stuff ...)
)))
(define flush-output-port force-output)
(define current-second current-time)
(define (jiffies-per-second) internal-time-units-per-second)
(define current-jiffy get-internal-real-time)
(define exact inexact->exact)
(de... |
43901eaf26527d4325781acb685efcc4e2b4606bf71e5bad62b1e24d465365da | metametadata/carry | signals.cljs | (ns app.common.signals
(:require [app.blueprint-methods :refer [on-signal]]))
(defmethod on-signal :on-start
[_model _ _dispatch-signal _dispatch-action]
nil)
(defmethod on-signal :on-stop
[_model _ _dispatch-signal _dispatch-action]
nil)
(defmethod on-signal :on-home
[_model _ _dispatch-signal dispatch-... | null | https://raw.githubusercontent.com/metametadata/carry/fa5c7cd0d8f1b71edca70330acc97c6245638efb/examples/blueprint-splitting-multimethods/src/app/common/signals.cljs | clojure | (ns app.common.signals
(:require [app.blueprint-methods :refer [on-signal]]))
(defmethod on-signal :on-start
[_model _ _dispatch-signal _dispatch-action]
nil)
(defmethod on-signal :on-stop
[_model _ _dispatch-signal _dispatch-action]
nil)
(defmethod on-signal :on-home
[_model _ _dispatch-signal dispatch-... | |
5284312fb5985671e4a11a9b5522ceddac763d0d7fadae9175dd16c83f852b07 | sjl/euler | math.lisp | (in-package :euler)
;;;; Operator Protocol
(defgeneric operatorp (object)
(:method ((object t)) nil))
(defun operandp (object)
(not (operatorp object)))
(defgeneric operator-arity (operator))
(defgeneric operator-function (operator))
(defgeneric operator-weight (operator))
(defmacro define-operator (symbol func... | null | https://raw.githubusercontent.com/sjl/euler/29cd8242172a2d11128439bb99217a0a859057ed/src/math.lisp | lisp | Operator Protocol
Binary
Parsing
implicit multiplication
API | (in-package :euler)
(defgeneric operatorp (object)
(:method ((object t)) nil))
(defun operandp (object)
(not (operatorp object)))
(defgeneric operator-arity (operator))
(defgeneric operator-function (operator))
(defgeneric operator-weight (operator))
(defmacro define-operator (symbol function arity weight)
`(... |
296baa364c523b192ad4f56233b35f76bfc3c7565ee92d11e0b42474c32201b1 | janestreet/learn-ocaml-workshop | tty_text.ml | open Core
open Async
module User_input = struct
type t =
| Ctrl_c
| Escape
| Backspace
| Return (* Enter key *)
| Char of char
[@@deriving sexp_of]
end
module Configure_terminal = struct
type t = {
attr_in : Unix.Terminal_io.t;
attr_out: Unix.Terminal_io.t;
}
let setattr_out fd... | null | https://raw.githubusercontent.com/janestreet/learn-ocaml-workshop/1ba9576b48b48a892644eb20c201c2c4aa643c32/04-bigger-projects/fuzzy-finder/bin/tty_text.ml | ocaml | Enter key
CTRL + C | open Core
open Async
module User_input = struct
type t =
| Ctrl_c
| Escape
| Backspace
| Char of char
[@@deriving sexp_of]
end
module Configure_terminal = struct
type t = {
attr_in : Unix.Terminal_io.t;
attr_out: Unix.Terminal_io.t;
}
let setattr_out fd ~attr_out =
Unix.Termina... |
bc5eb15867494ec7b4a1bb0bd8fc33f9c417d421fc29a2a9e35620b8d0babb0e | 3b/3bmd | plain-printer.lisp | (in-package #:3bmd)
;;; "plain text" printer
;;; prints the text contents of the document with no formatting
(defparameter *plain-text-pprint* (copy-pprint-dispatch nil))
(set-pprint-dispatch 'cons
(lambda (s o)
(loop for i in o
do (write i :st... | null | https://raw.githubusercontent.com/3b/3bmd/6fc5759448f6f6df6f6df556e020a289a2643288/plain-printer.lisp | lisp | "plain text" printer
prints the text contents of the document with no formatting
should this print anything?
should this print anything?
?(format s "~{~a ~}" (cdr o)) | (in-package #:3bmd)
(defparameter *plain-text-pprint* (copy-pprint-dispatch nil))
(set-pprint-dispatch 'cons
(lambda (s o)
(loop for i in o
do (write i :stream s)))
0
*plain-text-pprint*)
(set-pprint-d... |
460ce909e8ed68f1d1fa95894b9a88ce0e5c12a017e55017e4aa526db53c2229 | tisnik/clojure-examples | 2_collections.clj | Examples for : Homoiconic JS with clojure syntax , s - expressions & macros
;
( C ) Copyright 2015
;
; All rights reserved. This program and the accompanying materials
; are made available under the terms of the Eclipse Public License v1.0
; which accompanies this distribution, and is available at
-v10.... | null | https://raw.githubusercontent.com/tisnik/clojure-examples/984af4a3e20d994b4f4989678ee1330e409fdae3/wisp/2_collections.clj | clojure |
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
Contributors:
seznam řetězců
seznam "keywords"
prázdný vektor
vektor čísel
vektor řetězců
vektor "keywords"
p... | Examples for : Homoiconic JS with clojure syntax , s - expressions & macros
( C ) Copyright 2015
-v10.html
Test překladu deklarace různých typů kolekcí do JavaScriptu
Seznamy
prázdný seznam
'()
seznam čísel
'(1 2 3 4)
'("prvni" "druhy" "treti")
'(:prvni :druhy :treti)
Vektory
[... |
fcb2933f4bddeb003b7bd4f237a59585abcc90d190240ba14ba94495bfcbe801 | ocaml-multicore/parafuzz | localexn.ml | (* TEST *)
let f (type t) () =
let exception E of t in
(fun x -> E x), (function E _ -> print_endline "OK" | _ -> print_endline "KO")
let inj1, proj1 = f ()
let inj2, proj2 = f ()
let () = proj1 (inj1 42)
let () = proj1 (inj2 42)
| null | https://raw.githubusercontent.com/ocaml-multicore/parafuzz/6a92906f1ba03287ffcb433063bded831a644fd5/testsuite/tests/basic/localexn.ml | ocaml | TEST |
let f (type t) () =
let exception E of t in
(fun x -> E x), (function E _ -> print_endline "OK" | _ -> print_endline "KO")
let inj1, proj1 = f ()
let inj2, proj2 = f ()
let () = proj1 (inj1 42)
let () = proj1 (inj2 42)
|
5e340ed36f9b24aa5827fd100413bc0601274a45aeb3aa3a9f6b4387011b8ac0 | sifbiri/project-resources-operations | database.clj | (ns app.model.database
"This is a mock database implemented via Datascript, which runs completely in memory, has few deps, and requires
less setup than Datomic itself. Its API is very close to Datomics, and for a demo app makes it possible to have the
*look* of a real back-end without having quite the amount of ... | null | https://raw.githubusercontent.com/sifbiri/project-resources-operations/b08adb09ef03f123ca7ad19ec1c2bdc070a66291/src/main/app/model/database.clj | clojure | In datascript just about the only thing that needs schema
is lookup refs and entity refs. You can just wing it on
everything else.
(d/create-database db-url) | (ns app.model.database
"This is a mock database implemented via Datascript, which runs completely in memory, has few deps, and requires
less setup than Datomic itself. Its API is very close to Datomics, and for a demo app makes it possible to have the
*look* of a real back-end without having quite the amount of ... |
8408692efc62e27017de7fd3dfd0ad875cbbf67491adb173af961aa70d7c30aa | jackfirth/planning | chess.rkt | #lang racket
(require chess
planning/hash/action
rebellion/collection/multidict)
;@------------------------------------------------------------------------------
(define (chess-rank+ rank amount)
(chess-rank (+ (chess-rank-index rank) amount)))
(define (white-pawn-move start)
(define end
(... | null | https://raw.githubusercontent.com/jackfirth/planning/b880f85effd4520e14b815d1dbe0ff7e71f4aaf8/examples/chess.rkt | racket | @------------------------------------------------------------------------------ | #lang racket
(require chess
planning/hash/action
rebellion/collection/multidict)
(define (chess-rank+ rank amount)
(chess-rank (+ (chess-rank-index rank) amount)))
(define (white-pawn-move start)
(define end
(chess-square #:rank (chess-rank+ (chess-square-rank start) 1)
#... |
0a087030f304369e9d73ce3d054059c43844a6510884c2706a444e3a17b8fc34 | benknoble/frosthaven-manager | enum-helpers.rkt | #lang racket
(provide
define-serializable-enum-type
(contract-out
[make-property-maker-that-displays-as-constant-names
(-> uninitialized-enum-descriptor?
(listof (cons/c struct-type-property? any/c)))]
[compose-property-makers
(-> (-> uninitialized-enum-descriptor?
(list... | null | https://raw.githubusercontent.com/benknoble/frosthaven-manager/a771a383ddec69e079f907c5c071bbfd706ae6f4/enum-helpers.rkt | racket | display mode
everything else | #lang racket
(provide
define-serializable-enum-type
(contract-out
[make-property-maker-that-displays-as-constant-names
(-> uninitialized-enum-descriptor?
(listof (cons/c struct-type-property? any/c)))]
[compose-property-makers
(-> (-> uninitialized-enum-descriptor?
(list... |
57c757fcfde551aa5234d1de764612a166437808702d276c4531f03e9af43234 | Appliscale/xprof | xprof_core_records.erl | %%% @doc Server to store loaded record definitions.
-module(xprof_core_records).
-export([start_link/0,
load_records/1,
forget_records/0,
forget_records/1,
get_record_defs/0,
record_print_fun/0
]).
%% gen_server callbacks
-export([init/1,
handle_call/3,
... | null | https://raw.githubusercontent.com/Appliscale/xprof/fbe4c1743fd9caf003ed5fd77e2ac20a4eab4349/apps/xprof_core/src/xprof_core_records.erl | erlang | @doc Server to store loaded record definitions.
gen_server callbacks
@doc Start record store.
@doc Load record definitions from module.
@doc Remove all record definitions.
(similar to shell command ```rf('_')''')
@doc Remove selected record definitions. RecNames is a record name or a
list of record names. To re... | -module(xprof_core_records).
-export([start_link/0,
load_records/1,
forget_records/0,
forget_records/1,
get_record_defs/0,
record_print_fun/0
]).
-export([init/1,
handle_call/3,
handle_cast/2,
handle_info/2,
terminate/2,
... |
8adec95d555a378b7f9b6c4a814c6e271b827f6c2f149176ba0063c13f3513d5 | craigfe/sink | bounded.ml | module type S = sig
type t
val minimum : t
val maximum : t
end
[@@deriving typeclass]
| null | https://raw.githubusercontent.com/craigfe/sink/c5431edfa1b06f1a09845a481c4afcb3e92f0667/src/sink/bounded.ml | ocaml | module type S = sig
type t
val minimum : t
val maximum : t
end
[@@deriving typeclass]
| |
bb8a5c92129e47eef7d85128aac159a580cb0345be4ee8f58cbf3dc6d7123fa8 | berke/aurochs | pack.ml | (* Pack *)
open Bytes;;
open Int_operators;;
type packer = Bytes.sink;;
(*** write_byte *)
let write_byte sk x = Bytes.put_byte sk x;;
(* ***)
(*** write_int64 *)
let write_int64 sk x =
let (negative, x) =
if x < 0L then
(true, 0L ---- (x ++++ 1L))
else
(false, x)
in
let a = Array.make 10 0 ... | null | https://raw.githubusercontent.com/berke/aurochs/637bdc0d4682772837f9e44112212e7f20ab96ff/pack/pack.ml | ocaml | Pack
** write_byte
**
** write_int64
Head byte
Inner byte
**
** write_uint64
Head byte
Inner byte
**
** write_string
**
** test
** |
open Bytes;;
open Int_operators;;
type packer = Bytes.sink;;
let write_byte sk x = Bytes.put_byte sk x;;
let write_int64 sk x =
let (negative, x) =
if x < 0L then
(true, 0L ---- (x ++++ 1L))
else
(false, x)
in
let a = Array.make 10 0 in
let i = ref 0 in
let emit x = a.(!i) <- x; incr i i... |
28f0cdd238ca1eedfe8944ad32b9ffca24d19dabf54a5d01371ca8338b0b05c9 | danieljharvey/tmux-mate | Options.hs | module Options (command) where
import CLICommands
import Options.Applicative ((<|>))
import qualified Options.Applicative as Opt
import TmuxMate
command :: Opt.Parser CLICommand
command =
otherCommands
<|> (CLIRun <$> options)
configFilePathParser :: Opt.Parser (Maybe ConfigFilePath)
configFilePathParser =
(... | null | https://raw.githubusercontent.com/danieljharvey/tmux-mate/b156edfb84bea54ffc8be95323acd519fc2d3a3b/app/Options.hs | haskell | module Options (command) where
import CLICommands
import Options.Applicative ((<|>))
import qualified Options.Applicative as Opt
import TmuxMate
command :: Opt.Parser CLICommand
command =
otherCommands
<|> (CLIRun <$> options)
configFilePathParser :: Opt.Parser (Maybe ConfigFilePath)
configFilePathParser =
(... | |
059a98472a7559d6f73a0687a2c0e61b3dc909830a20034976595e6d7472bfb7 | mirage/colombe | reply.ml | (* Permanent positive response *)
type pos_completion =
[ `PP_211 of string list
| `PP_214 of string list
| `PP_220 of string list
| `PP_221 of string list
| `PP_250 of string list
| `PP_251 of string list
| `PP_252 of string list ]
(* Temporary positive response *)
type pos_intermediate = [ `TP_354 of s... | null | https://raw.githubusercontent.com/mirage/colombe/bbecbb17b581fa1db70a61de14efb51a66f30451/src/reply.ml | ocaml | Permanent positive response
Temporary positive response
Temporary negativ response
let code' = number decoder in
CRLF | type pos_completion =
[ `PP_211 of string list
| `PP_214 of string list
| `PP_220 of string list
| `PP_221 of string list
| `PP_250 of string list
| `PP_251 of string list
| `PP_252 of string list ]
type pos_intermediate = [ `TP_354 of string list ]
type transient_neg_completion =
[ `TN_421 of string ... |
5a6754aa2d38865f6ae8e5c34e07b338e0b5a6e222670ff6d5738192be2b0dfc | fmi/clojure-examples | 02-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...\n" x)
(Thread/sleep 100)
(inc x))
(defn very-slow-inc
[x]
(printf "Incrementing %s very slowly...\n" x)
(Thread/sleep 500)
(inc x))
... | null | https://raw.githubusercontent.com/fmi/clojure-examples/46ec0fe7bdfdfccde1ab74a94c64dbd73ea58269/2013/03-futures-atoms-vars/02-atom-retry.clj | clojure | This example illustrates retrying an atom update with swap!
The output of this program is:
→ clj 02-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...\n" x)
(Thread/sleep 100)
(inc x))
(defn very-slow-inc
[x]
(printf "Incrementing %s very slowly...\n" x)
(Thread/sleep 500)
(inc x))
(wait-futures
(future (swap! number very-slow-inc))
(future ... |
dc29dabe3a41cfaefd18f65259731a678b358f1abaea183fce3fa4de4d96393c | cgrand/dynvars | dynvars.cljc | (ns net.cgrand.dynvars
(:require [cljs.analyzer :as ana])
(:refer-clojure :exclude [binding]))
(defmacro var [name]
(let [name (ana/resolve-symbol name)]
`(or (dynvars '~name) (intern-dynvar '~name (fn
([] ~name)
... | null | https://raw.githubusercontent.com/cgrand/dynvars/031eb63e57fedb3d4a652a878bce7b44b23b8919/src/net/cgrand/dynvars.cljc | clojure | clojure-like and mostly wrong
more experimental | (ns net.cgrand.dynvars
(:require [cljs.analyzer :as ana])
(:refer-clojure :exclude [binding]))
(defmacro var [name]
(let [name (ana/resolve-symbol name)]
`(or (dynvars '~name) (intern-dynvar '~name (fn
([] ~name)
... |
5a645e8046d48b502520b33ee3a4ef17f774c925d45bdebfe3719b64e5cf4f69 | dbuenzli/qoic | trip.ml | ---------------------------------------------------------------------------
Copyright ( c ) 2021 The qoic programmers . All rights reserved .
Distributed under the ISC license , see terms at the end of the file .
---------------------------------------------------------------------------
Copyright (c) ... | null | https://raw.githubusercontent.com/dbuenzli/qoic/ebbed73cb820a0a95768666448c8769a0b1ba181/test/trip.ml | ocaml | ---------------------------------------------------------------------------
Copyright ( c ) 2021 The qoic programmers . All rights reserved .
Distributed under the ISC license , see terms at the end of the file .
---------------------------------------------------------------------------
Copyright (c) ... | |
1091c0abbd3ec5f7ffc8504ed6f2727de9fa38716f8cc8ec4826b5b556716218 | erlef/rebar3_hex | rebar3_hex_version_SUITE.erl | -module(rebar3_hex_version_SUITE).
-compile(export_all).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
all() ->
[
parse_test,
increment_test,
format_test
].
parse_test(_Config) ->
Exp = {ok, #{build => undefined, major => 1, minor => 1, patch... | null | https://raw.githubusercontent.com/erlef/rebar3_hex/17137b87050a3f24b60caa5abed93a3635621769/test/rebar3_hex_version_SUITE.erl | erlang | -module(rebar3_hex_version_SUITE).
-compile(export_all).
-include_lib("common_test/include/ct.hrl").
-include_lib("eunit/include/eunit.hrl").
all() ->
[
parse_test,
increment_test,
format_test
].
parse_test(_Config) ->
Exp = {ok, #{build => undefined, major => 1, minor => 1, patch... | |
0cf833b5420e254ff216eb9cbc8364f71f95f61cc9cbf2787356b9b73f51eaaa | wireapp/wire-server | API.hs | -- This file is part of the Wire Server implementation.
--
Copyright ( C ) 2022 Wire Swiss GmbH < >
--
-- This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation , either version 3 of the License... | null | https://raw.githubusercontent.com/wireapp/wire-server/6c4b00ec111e853871564687862a19658d04ea4f/services/gundeck/src/Gundeck/API.hs | haskell | This file is part of the Wire Server implementation.
This program is free software: you can redistribute it and/or modify it under
later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTI... | Copyright ( C ) 2022 Wire Swiss GmbH < >
the terms of the GNU Affero General Public License as published by the Free
Software Foundation , either version 3 of the License , or ( at your option ) any
You should have received a copy of the GNU Affero General Public License along
module Gundeck.API
( sitemap,
... |
e167b2cf4c67b0a153dbb7ac41f6bf1b6e7965b39c2aca7bee7e7fc2958c1a81 | redbadger/karma-tracker | core_test.clj | (ns karma-tracker.query.core-test
(:require [clj-time.core :refer [date-time]]
[clojure
[edn :as edn]
[test :refer :all]]
[clojure.java.io :as io]
[karma-tracker
[events-repository :as repo]
[resources :refer [get-resources]]]
... | null | https://raw.githubusercontent.com/redbadger/karma-tracker/c5375f32f4cd0386f6bb1560d979b79bceea19e2/test/karma_tracker/query/core_test.clj | clojure | (ns karma-tracker.query.core-test
(:require [clj-time.core :refer [date-time]]
[clojure
[edn :as edn]
[test :refer :all]]
[clojure.java.io :as io]
[karma-tracker
[events-repository :as repo]
[resources :refer [get-resources]]]
... | |
f37025393d26d830778e09afcba3cbfea3cf198f8589ac4b85a6bbd3227ab2f5 | haroldcarr/learn-haskell-coq-ml-etc | Factorial.hs | module Factorial where
f :: Integer -> Integer
f 0 = 1
f n = f (n - 1) * n
-- End
| null | https://raw.githubusercontent.com/haroldcarr/learn-haskell-coq-ml-etc/b4e83ec7c7af730de688b7376497b9f49dc24a0e/haskell/book/2019-Program_Design_by_Calculation-Oliveira/2015-05-LambdaConf/Factorial.hs | haskell | End | module Factorial where
f :: Integer -> Integer
f 0 = 1
f n = f (n - 1) * n
|
a21ae1f425b32f60d9fc1e76326cf4ac3d3a212c7b1c0357de4f5b8a2ca63cf7 | IFCA/opencl | example06.hs | Copyright ( c ) 2011 ,
All rights reserved .
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions are met :
* Redistributions of source code must retain the above copyright
notice , this list of conditions and ... | null | https://raw.githubusercontent.com/IFCA/opencl/80d0cb9d235819cd53e6a36d7a9258bc19d564ab/examples/example06.hs | haskell | Initialize Kernel
Execute Kernel
Get Result | Copyright ( c ) 2011 ,
All rights reserved .
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions are met :
* Redistributions of source code must retain the above copyright
notice , this list of conditions and ... |
3e27c4fb8b45b12dad96f9fe31a27eb9a72462205139d4b9d2a1b0d6fc036776 | haskell/lsp | SMethodMap.hs | {-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
# LANGUAGE MagicHash #
# LANGUAGE PolyKinds #
{-# LANGUAGE RankNTypes #-}
module Language.LSP.Types.SMethodMap
( SMethodMap
, singleton
, insert
, delete
, member
, lookup
, map
) where
import Prelude hiding (lookup, map)
import Data.IntMap (... | null | https://raw.githubusercontent.com/haskell/lsp/c21ac75d0149c1c6fb3b3482a8fd70371e8b1b50/lsp-types/src/Language/LSP/Types/SMethodMap.hs | haskell | # LANGUAGE DataKinds #
# LANGUAGE GADTs #
# LANGUAGE RankNTypes #
This type exists to avoid a dependency on 'dependent-map'. It is less
safe (since we use 'unsafeCoerce') but much simpler and hence easier to include.
| A specialized alternative to a full dependent map for use with 'SMethod'.
in the map. We do... | # LANGUAGE MagicHash #
# LANGUAGE PolyKinds #
module Language.LSP.Types.SMethodMap
( SMethodMap
, singleton
, insert
, delete
, member
, lookup
, map
) where
import Prelude hiding (lookup, map)
import Data.IntMap (IntMap)
import qualified Data.IntMap.Strict as IntMap
import Data.Kind (Type)
import... |
26a910ddd1207b6ab97e3a4c30c9d349fdeb66212b476296ec817f90b78edf80 | roman01la/minimax | dev.clj | (ns fg.dev
(:require [clojure.java.io :as io]
[minimax.logger :as log])
(:import (java.nio.file FileSystems Path StandardWatchEventKinds WatchEvent WatchService)))
(def ^WatchService watch-service
(.newWatchService (FileSystems/getDefault)))
(defn register! [path]
(.register path
watc... | null | https://raw.githubusercontent.com/roman01la/minimax/f371c199d55a2a219ed7cf5f2dd2e079be99f963/src/fg/dev.clj | clojure | (ns fg.dev
(:require [clojure.java.io :as io]
[minimax.logger :as log])
(:import (java.nio.file FileSystems Path StandardWatchEventKinds WatchEvent WatchService)))
(def ^WatchService watch-service
(.newWatchService (FileSystems/getDefault)))
(defn register! [path]
(.register path
watc... | |
dd0e999996a240b227f50ac8fa685378e0af6207a33f31775f0b5215f9619f9f | KingMob/TrueGrit | rate_limiter_test.clj | (ns net.modulolotus.truegrit.rate-limiter-test
(:require [clojure.test :refer [deftest is testing use-fixtures]]
[net.modulolotus.truegrit :refer [with-rate-limiter]]
[net.modulolotus.truegrit.rate-limiter :refer [rate-limiter retrieve]]
[net.modulolotus.truegrit.test-util :refer [... | null | https://raw.githubusercontent.com/KingMob/TrueGrit/ba5b87d4b6d1af3c86945270310d3deb1829c0f8/test/net/modulolotus/truegrit/rate_limiter_test.clj | clojure | (ns net.modulolotus.truegrit.rate-limiter-test
(:require [clojure.test :refer [deftest is testing use-fixtures]]
[net.modulolotus.truegrit :refer [with-rate-limiter]]
[net.modulolotus.truegrit.rate-limiter :refer [rate-limiter retrieve]]
[net.modulolotus.truegrit.test-util :refer [... | |
383004149715a6c9a9c1df7b5ed43014feee6d6a46ff44040c929bada2200e9a | slyrus/abcl | quicklisp-abcl.lisp | (in-package :cl-user)
(defpackage quicklisp-abcl
(:nicknames :quicklisp-abcl)
(:use :cl
:asdf)
(:export :*quicklisp-parent-dir*))
(in-package :quicklisp-abcl)
(defvar *quicklisp-parent-dir* (user-homedir-pathname)
"Pathname reference to the parent directory of the local Quicklisp installation")
(def... | null | https://raw.githubusercontent.com/slyrus/abcl/881f733fdbf4b722865318a7d2abe2ff8fdad96e/contrib/quicklisp/quicklisp-abcl.lisp | lisp | if so , load source , and recompile | (in-package :cl-user)
(defpackage quicklisp-abcl
(:nicknames :quicklisp-abcl)
(:use :cl
:asdf)
(:export :*quicklisp-parent-dir*))
(in-package :quicklisp-abcl)
(defvar *quicklisp-parent-dir* (user-homedir-pathname)
"Pathname reference to the parent directory of the local Quicklisp installation")
(def... |
016eff506b044342b8e0583098e33640e5f305ca088f5809b662154004dfc9e9 | nikodemus/SBCL | std-class.lisp | This software is part of the SBCL system . See the README file for
;;;; more information.
This software is derived from software originally released by Xerox
;;;; Corporation. Copyright and release statements follow. Later modifications
;;;; to the software are in the public domain and are provided with
;;;; absol... | null | https://raw.githubusercontent.com/nikodemus/SBCL/3c11847d1e12db89b24a7887b18a137c45ed4661/src/pcl/std-class.lisp | lisp | more information.
Corporation. Copyright and release statements follow. Later modifications
to the software are in the public domain and are provided with
absolutely no warranty. See the COPYING and CREDITS files for more
information.
All rights reserved.
Use and copying of this software and preparation of der... | This software is part of the SBCL system . See the README file for
This software is derived from software originally released by Xerox
copyright information from original PCL sources :
Copyright ( c ) 1985 , 1986 , 1987 , 1988 , 1989 , 1990 Xerox Corporation .
derivative works must comply with all applicabl... |
b5f1e05dbc15b1fb9d808f56cd0a6cb0ec354f997c8c952967cbc9d1b1b3c953 | apache/couchdb-rexi | rexi_server_mon.erl | Copyright 2010 - 2013 Cloudant
%
Licensed under the Apache License , Version 2.0 ( the " License " ) ; you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% -2.0
%
% Unless required by applicable law or agreed to in writing, software
distributed under ... | null | https://raw.githubusercontent.com/apache/couchdb-rexi/a327b7dbeb2b0050f7ca9072047bf8ef2d282833/src/rexi_server_mon.erl | erlang |
use this file except in compliance with the License. You may obtain a copy of
the License at
-2.0
Unless required by applicable law or agreed to in writing, software
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitatio... | Copyright 2010 - 2013 Cloudant
Licensed under the Apache License , Version 2.0 ( the " License " ) ; you may not
distributed under the License is distributed on an " AS IS " BASIS , WITHOUT
-module(rexi_server_mon).
-behaviour(gen_server).
-vsn(1).
-export([
start_link/1,
status/0
]).
-export([
i... |
1c4510ea872e64cd768974d10e4c87f526d32adfcf344a7bc158e507ce913185 | exoscale/seql | sandbox.clj | (ns sandbox
"An example namespace to exercise SEQL queries"
(:require [db.fixtures :refer [load-fixtures jdbc-config]]
[clojure.spec.alpha :as s]
[seql.query :as q]
[seql.mutation :as m :refer [mutate!]]
[seql.helpers :refer [make-schema entity-from-spec
... | null | https://raw.githubusercontent.com/exoscale/seql/300009035d1cab6de932588c2ff12a1a7f8f60c0/dataset/sandbox.clj | clojure | Define a few specs for entities
Mutation specs
Set an environment up
Load the provided entity set
Perform several mutations in a transaction
Have fun! | (ns sandbox
"An example namespace to exercise SEQL queries"
(:require [db.fixtures :refer [load-fixtures jdbc-config]]
[clojure.spec.alpha :as s]
[seql.query :as q]
[seql.mutation :as m :refer [mutate!]]
[seql.helpers :refer [make-schema entity-from-spec
... |
b7ce5e75ab372bff9959d314444150b93cdbb54aa05dc460b135f2a59c0b87c4 | chaitanyagupta/qbase64 | stream-utils.lisp | (in-package #:qbase64)
;;; stream mixin
(defclass stream-mixin ()
((openp :accessor stream-open-p :initform t)))
(defmethod open-stream-p ((stream stream-mixin))
(stream-open-p stream))
(defmethod close ((stream stream-mixin) &key abort)
(declare (ignore abort))
(setf (stream-open-p stream) nil))
#-clisp
(... | null | https://raw.githubusercontent.com/chaitanyagupta/qbase64/6374899aec189600e6b7b77c89009d0835154b93/stream-utils.lisp | lisp | stream mixin | (in-package #:qbase64)
(defclass stream-mixin ()
((openp :accessor stream-open-p :initform t)))
(defmethod open-stream-p ((stream stream-mixin))
(stream-open-p stream))
(defmethod close ((stream stream-mixin) &key abort)
(declare (ignore abort))
(setf (stream-open-p stream) nil))
#-clisp
(defmethod input-s... |
f0c54d4de6e4d828547ed573a06d076e9f526f3d042b58db55687bd5ae13b62e | SimSaladin/rnfssp | Data.hs | # LANGUAGE QuasiQuotes , TemplateHaskell , TypeFamilies , FlexibleContexts , GADTs , OverloadedStrings , EmptyDataDecls #
module MarketSub.Data where
import Yesod
import Data.Text (Text)
data MarketSub = MarketSub
share [mkPersist sqlSettings, mkMigrate "migrateMarket"] [persistUpperCase|
MarketContact
name Te... | null | https://raw.githubusercontent.com/SimSaladin/rnfssp/d04993524d13ed5d993e4b85e604c824ef7283ba/rnfssp-market/MarketSub/Data.hs | haskell | # LANGUAGE QuasiQuotes , TemplateHaskell , TypeFamilies , FlexibleContexts , GADTs , OverloadedStrings , EmptyDataDecls #
module MarketSub.Data where
import Yesod
import Data.Text (Text)
data MarketSub = MarketSub
share [mkPersist sqlSettings, mkMigrate "migrateMarket"] [persistUpperCase|
MarketContact
name Te... | |
62d5e78cad985651850d75b777b35c76881d43cb011a6ca75968425e423b05e6 | draperlaboratory/VIBES | substituter.ml | (***************************************************************************)
(* *)
Copyright ( C ) 2022/2023 The Charles Stark Draper Laboratory , Inc.
(* *)
(* This... | null | https://raw.githubusercontent.com/draperlaboratory/VIBES/7f978d66d0b022d1a9262fdfc608b7a2b7c95dff/tools/vibes-higher-vars/lib/substituter.ml | ocaml | *************************************************************************
This file is provided under the license found in the LICENSE file in
the top-level director... | Copyright ( C ) 2022/2023 The Charles Stark Draper Laboratory , Inc.
This research was developed with funding from the Defense Advanced
Research Projects Agency ( DARPA ) .
open Core
open Bap.Std
open Bap_core_theory
module T = Theory
module Log = Vibes_log.St... |
98952153f998c9b0bccaa5364b5313641bb7c8846a62209aad85d7a2a772471b | aantron/luv | file.ml | open Test_helpers
let statfs_path =
if not Sys.win32 then
"file.ml"
else
Printf.sprintf "%c:\\" (Sys.getcwd ()).[0]
let with_file_for_reading ?(to_fail = false) f =
let flags =
if not to_fail then
[`RDONLY]
else
[`WRONLY]
in
let file =
Luv.File.Sync.open_ "read_test_input" f... | null | https://raw.githubusercontent.com/aantron/luv/4b49d3edad2179c76d685500edf1b44f61ec4be8/test/file.ml | ocaml | open Test_helpers
let statfs_path =
if not Sys.win32 then
"file.ml"
else
Printf.sprintf "%c:\\" (Sys.getcwd ()).[0]
let with_file_for_reading ?(to_fail = false) f =
let flags =
if not to_fail then
[`RDONLY]
else
[`WRONLY]
in
let file =
Luv.File.Sync.open_ "read_test_input" f... | |
4bfd496bc9dfbd68a164396d5c08f454062fb6310a6c309e14565df4395d5e2f | Concordium/concordium-client | Parse.hs | module Concordium.Client.Parse
( parseTransactionHash
, parseBlockHash
, parseTime
, parseCredExpiry
, parseExpiry
) where
import Concordium.Crypto.SHA256
import Concordium.Types
import Control.Monad.Except
import Data.Text
import Data.Time
import Data.Word
import Text.Read
import Text.Printf
parseTransa... | null | https://raw.githubusercontent.com/Concordium/concordium-client/e5049bede76de5ec6237fb1cbc5136d076fc5537/src/Concordium/Client/Parse.hs | haskell | |Parse time from a string using the provided format.
This is a simple convenience wrapper around the more general function parseTimeM.
|Parse expiry time given as absolute Unix epoch or a duration string
relative to the provided "now" time.
|Parse a string into an integer and an optional duration unit. | module Concordium.Client.Parse
( parseTransactionHash
, parseBlockHash
, parseTime
, parseCredExpiry
, parseExpiry
) where
import Concordium.Crypto.SHA256
import Concordium.Types
import Control.Monad.Except
import Data.Text
import Data.Time
import Data.Word
import Text.Read
import Text.Printf
parseTransa... |
28baabecbbb706d72df492fa22cd40a949e59c3887e4263a1391cf0ab1e15a24 | xtdb/xtdb | graal.clj | (ns xtdb.main.graal
(:require [clojure.tools.logging :as log]
[xtdb.api :as xt])
(:gen-class))
(defn -main [& _args]
(with-open [node (xt/start-node {})]
(log/info "Starting XTDB native image" (pr-str (.status node)))))
| null | https://raw.githubusercontent.com/xtdb/xtdb/e2f51ed99fc2716faa8ad254c0b18166c937b134/labs/graal/src/xtdb/main/graal.clj | clojure | (ns xtdb.main.graal
(:require [clojure.tools.logging :as log]
[xtdb.api :as xt])
(:gen-class))
(defn -main [& _args]
(with-open [node (xt/start-node {})]
(log/info "Starting XTDB native image" (pr-str (.status node)))))
| |
270128d791ae935c50f14a8e6d7823f0cf026eaa2c26ee7fae7ecbb5c8b9af23 | hidaris/thinking-dumps | tt.rkt | #lang racket
(require "mkk.rkt")
(define gamma0
'((x . Nat) (y . Bool) (z . Nat)))
(defrel (lookupo gamma x t)
(fresh (x^ t^ gamma^)
(== `((,x^ . ,t^) . ,gamma^) gamma)
(conde
[(== x^ x) (== t^ t)]
[(=/= x^ x) (lookupo gamma^ x t)])))
#;
(run 1 τ
(lookupo gamma0 'x τ))
(defrel (!- gamma e t... | null | https://raw.githubusercontent.com/hidaris/thinking-dumps/05b6093c3d1239f06f3657cd3bd15bf5cd622160/c311/tt.rkt | racket | #lang racket
(require "mkk.rkt")
(define gamma0
'((x . Nat) (y . Bool) (z . Nat)))
(defrel (lookupo gamma x t)
(fresh (x^ t^ gamma^)
(== `((,x^ . ,t^) . ,gamma^) gamma)
(conde
[(== x^ x) (== t^ t)]
[(=/= x^ x) (lookupo gamma^ x t)])))
(run 1 τ
(lookupo gamma0 'x τ))
(defrel (!- gamma e t)
... | |
2b1441ef4b713c9a2382e2cf0823fc6191b6084b8509010e6291c98de43d4d78 | kana/sicp | ex-2.60.scm | Exercise 2.60 .
;;;
;;; We specified that a set would be represented as a list with no duplicates.
;;; Now suppose we allow duplicates. For instance, the set {1,2,3} could be
represented as the list ( 2 3 2 1 3 2 2 ) .
;;;
;;; Design procedures element-of-set?, adjoin-set, union-set, and
;;; intersection-set that o... | null | https://raw.githubusercontent.com/kana/sicp/912bda4276995492ffc2ec971618316701e196f6/ex-2.60.scm | scheme |
We specified that a set would be represented as a list with no duplicates.
Now suppose we allow duplicates. For instance, the set {1,2,3} could be
Design procedures element-of-set?, adjoin-set, union-set, and
intersection-set that operate on this representation.
How does the efficiency of each compare with the ... | Exercise 2.60 .
represented as the list ( 2 3 2 1 3 2 2 ) .
(define (element-of-set? x set)
(cond [(null? set) #f]
[(equal? x (car set)) #t]
[else (element-of-set? x (cdr set))]))
(define (adjoin-set x set)
(cons x set))
(define (union-set set1 set2)
(append set1 set2))
Like element - o... |
05c3f1c15997bb23a513430bd5e1841e687a2f5cb4e27db442c9a92b14541455 | OCamlPro/OCamlPro-OCaml-Branch | mandelbrot1.ml |
* The Computer Language Benchmarks Game
* /
*
* Contributed by TROESTLER
* Enhanced by ,
*
* The Computer Language Benchmarks Game
* /
*
* Contributed by Christophe TROESTLER
* Enhanced by Christian Szegedy, Yaron Minsky
*
*)
let niter = 50
let limit = 2.
let limit2 = limit *. limit
... | null | https://raw.githubusercontent.com/OCamlPro/OCamlPro-OCaml-Branch/3a522985649389f89dac73e655d562c54f0456a5/shootout-benchmark/04-mandelbrot/mandelbrot1.ml | ocaml | lor 0x00
output last few bits |
* The Computer Language Benchmarks Game
* /
*
* Contributed by TROESTLER
* Enhanced by ,
*
* The Computer Language Benchmarks Game
* /
*
* Contributed by Christophe TROESTLER
* Enhanced by Christian Szegedy, Yaron Minsky
*
*)
let niter = 50
let limit = 2.
let limit2 = limit *. limit
... |
55c1adb2048b6caa90b9e66ea1027b364659a9cf434d30b41fdcbe1b5a7c4d6f | satos---jp/mincaml_self_hosting | const_fold.ml | open Knorm
open Syntax
type ('a,'b) either = Left of 'a | Right of 'b
let rec const_fold tupleenv cenv ast =
let reccall = const_fold tupleenv cenv in
let op_fold op vs =
try
let tvs = List.map (fun ((na,_) as nad) -> try Left(List.assoc na cenv) with Not_found -> Right(nad) ) vs in (
match tvs with
... | null | https://raw.githubusercontent.com/satos---jp/mincaml_self_hosting/5fdf8b5083437d7607a924142eea52d9b1de0439/src/compiler/const_fold.ml | ocaml | 定数配列読み書きを入れて、51億命令 -> 38億命令になった
| [Right(nad);Left(CInt x);Left(ncd)] -> (
match op with
| OArrWrite -> KOp(OiArrWrite(x),[nad;ncd])
| _ -> raise Not_found
)
TODO CmpLt とかも畳み込む | open Knorm
open Syntax
type ('a,'b) either = Left of 'a | Right of 'b
let rec const_fold tupleenv cenv ast =
let reccall = const_fold tupleenv cenv in
let op_fold op vs =
try
let tvs = List.map (fun ((na,_) as nad) -> try Left(List.assoc na cenv) with Not_found -> Right(nad) ) vs in (
match tvs with
... |
6dbc231d9a2e5f6055343ca0dfd004a662c9cfa4cc7509d770ac1ce1266c442f | martinslota/protocell | test.ml | let () = Alcotest.run "Protocell test suite" @@ List.concat [Types.tests; Map_int.tests]
| null | https://raw.githubusercontent.com/martinslota/protocell/62545c7fb63ff76c95449ba015e40e0c3e0d94a5/test/test.ml | ocaml | let () = Alcotest.run "Protocell test suite" @@ List.concat [Types.tests; Map_int.tests]
| |
c78d390b254deffc7eef250c872df765add594fcf528f40c669b675bd6bc38e8 | Elzair/nazghul | bim.scm | ;; bim - binary mechanism
(define (state-mk sprite-tag opacity pclass light)
(list sprite-tag opacity pclass light))
(define (state-sprite state) (eval (car state)))
(define (state-opacity state) (cadr state))
(define (state-pclass state) (caddr state))
(define (state-light state) (cadddr state))
;; ctor
(define (b... | null | https://raw.githubusercontent.com/Elzair/nazghul/8f3a45ed6289cd9f469c4ff618d39366f2fbc1d8/worlds/haxima-1.001/bim.scm | scheme | bim - binary mechanism
ctor
(display "bim-mk")(newline)
accessors
mutators
helpers
handlers
(display "bim-off")(newline)
ifc - extensions must add a 'state message handler |
(define (state-mk sprite-tag opacity pclass light)
(list sprite-tag opacity pclass light))
(define (state-sprite state) (eval (car state)))
(define (state-opacity state) (cadr state))
(define (state-pclass state) (caddr state))
(define (state-light state) (cadddr state))
(define (bim-mk on? port members)
(list on... |
fad5a55aa353c25241775e326a992e62d3da0d7144e2fa1d8cb1c8a9d91f768e | DSiSc/why3 | destruct.ml | (********************************************************************)
(* *)
The Why3 Verification Platform / The Why3 Development Team
Copyright 2010 - 2018 -- Inria - CNRS - Paris - Sud University
(* ... | null | https://raw.githubusercontent.com/DSiSc/why3/8ba9c2287224b53075adc51544bc377bc8ea5c75/src/transform/destruct.ml | ocaml | ******************************************************************
This software is distributed under the terms of the GNU Lesser
on linking described in file LICENSE. ... | The Why3 Verification Platform / The Why3 Development Team
Copyright 2010 - 2018 -- Inria - CNRS - Paris - Sud University
General Public License version 2.1 , with the special exception
open Term
open Decl
open Args_wrapper
open Generic_arg_trans_utils
let is_lsymbol t =
match t.t_node w... |
8bd4b89344f953699c24dfa8387f27b590e8c2ab19d36f240249880a58c18dfa | patricoferris/ocaml-multicore-monorepo | websocketaf_lwt_intf.ml | ----------------------------------------------------------------------------
Copyright ( c ) 2018 Inhabited Type LLC .
Copyright ( c ) 2019
All rights reserved .
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the followin... | null | https://raw.githubusercontent.com/patricoferris/ocaml-multicore-monorepo/22b441e6727bc303950b3b37c8fbc024c748fe55/duniverse/dream/src/vendor/websocketaf/lwt/websocketaf_lwt_intf.ml | ocaml | Perform HTTP/1.1 handshake and upgrade to WS. | ----------------------------------------------------------------------------
Copyright ( c ) 2018 Inhabited Type LLC .
Copyright ( c ) 2019
All rights reserved .
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the followin... |
fa22861e98dfec179c368588bda0ac3d762b9b4605a6be5c4d3c445931542222 | 7c6f434c/lang-os | user-shell-thinkpad.lisp | ; vim:filetype=lisp
(defvar *rc-path*
(or
(uiop:getenv "USER_LISP_SHELL_RC")
*compile-file-pathname*
*load-pathname*))
(defparameter *common-rc*
(format nil
"~a/user-shell.lisp"
(cl-ppcre:regex-replace
"/[^/]*$"
(namestring
(or
*com... | null | https://raw.githubusercontent.com/7c6f434c/lang-os/6f3d7efcf1c0aa61b2d8bab462b6a50020979d96/user/user-shell-thinkpad.lisp | lisp | vim:filetype=lisp
(matrix-term) |
(defvar *rc-path*
(or
(uiop:getenv "USER_LISP_SHELL_RC")
*compile-file-pathname*
*load-pathname*))
(defparameter *common-rc*
(format nil
"~a/user-shell.lisp"
(cl-ppcre:regex-replace
"/[^/]*$"
(namestring
(or
*compile-file-pathname*
... |
d2e31144e930628ccac2217593352416e1f2b01be704037e846d1844df2061cf | gmarceau/racket-utils | saving.rkt | #lang racket
(define (read-printable? v)
(or (prefab-struct-key v)
(and (not (path-for-some-system? v))
(not (struct? v)))))
(define (size-hook v like-display? port)
(if (read-printable? v) #f 1))
(define (struct->prefab v)
(apply make-prefab-struct (vector->list (struct->vector v... | null | https://raw.githubusercontent.com/gmarceau/racket-utils/d7fdf833f0d7602d1a9c17be516c477a1614cef6/saving.rkt | racket | #lang racket
(define (read-printable? v)
(or (prefab-struct-key v)
(and (not (path-for-some-system? v))
(not (struct? v)))))
(define (size-hook v like-display? port)
(if (read-printable? v) #f 1))
(define (struct->prefab v)
(apply make-prefab-struct (vector->list (struct->vector v... | |
bbc861ea5e03d750978a3f626f335d2d0a1c9f741cddfbc8658ca9b80d901779 | CloudI/CloudI | hackney_multipart_tests.erl | -module(hackney_multipart_tests).
-include_lib("eunit/include/eunit.hrl").
-include("hackney_lib.hrl").
%% This seems necessary to list the tests including the generator
dummy_test() ->
?assertEqual(ok, ok).
multipart_test_() ->
{setup, fun start/0, fun stop/1,
[multipart_post()]}.
start() ->
error... | null | https://raw.githubusercontent.com/CloudI/CloudI/3e45031c7ee3e974ead2612ea7dd06c9edf973c9/src/external/cloudi_x_hackney/test/hackney_multipart_tests.erl | erlang | This seems necessary to list the tests including the generator | -module(hackney_multipart_tests).
-include_lib("eunit/include/eunit.hrl").
-include("hackney_lib.hrl").
dummy_test() ->
?assertEqual(ok, ok).
multipart_test_() ->
{setup, fun start/0, fun stop/1,
[multipart_post()]}.
start() ->
error_logger:tty(false),
{ok, _} = application:ensure_all_started(c... |
2f58c46b782bb17f4585b8a110b7d7eafce8d6a13cb5d792fab1fdf65ff7f330 | shirok/Gauche | regexp-sre-utf8.scm | -*- coding : utf-8 -*-
SRE tests using Unicode chars .
;; This file is included from regexp.scm. The test-* procedures
;; are defined there.
;; Charsets
(test-cset (string->char-set "BC") (& ("ABC") (w/ascii ("кириллица aBC"))))
(test-ast-error (& ("ABC") (w/ascii ("кириллица aBC") "def")))
The following tests ... | null | https://raw.githubusercontent.com/shirok/Gauche/ecaf82f72e2e946f62d99ed8febe0df8960d20c4/test/include/regexp-sre-utf8.scm | scheme | This file is included from regexp.scm. The test-* procedures
are defined there.
Charsets | -*- coding : utf-8 -*-
SRE tests using Unicode chars .
(test-cset (string->char-set "BC") (& ("ABC") (w/ascii ("кириллица aBC"))))
(test-ast-error (& ("ABC") (w/ascii ("кириллица aBC") "def")))
The following tests are taken from 's regexp-test.sld
(test-sre #f '(: bol (* lower) eol) "abcD")
(test-sre '("abcD") ... |
cfa583a2f0314eded54f3668efce1d151812359eaff6bab9c4d8bed458a3451b | aeyakovenko/rbm | Trainer.hs | |
Module : Data . DNN.Trainer
Description : Monad for training DNNs
Copyright : ( c ) , 2015 - 2016
License : MIT
Maintainer :
Stability : experimental
Portability : POSIX
This module implements a monad for training a using back - propagation or contrastive divergence .
Module ... | null | https://raw.githubusercontent.com/aeyakovenko/rbm/e1767257ba7499e09b31b34b1ec76c14272ba127/Data/DNN/Trainer.hs | haskell | # LANGUAGE BangPatterns #
| network type
| internal state
| training monad type
| terminate the training script
| terminate the training script with ()
|the probability vector as the input for the last layer.
|Increment the count and the return the previous value.
|Get the next random seed.
|Get the current le... | |
Module : Data . DNN.Trainer
Description : Monad for training DNNs
Copyright : ( c ) , 2015 - 2016
License : MIT
Maintainer :
Stability : experimental
Portability : POSIX
This module implements a monad for training a using back - propagation or contrastive divergence .
Module ... |
87afe3b6ce02a63093470e6c489cc802e34ecd3a53f295254cb86fd19c0f37bd | Yomguithereal/clj-fuzzy | soundex_test.clj | ;; -------------------------------------------------------------------
clj - fuzzy Soundex Tests
;; -------------------------------------------------------------------
;;
;;
Author : ( Yomguithereal )
Version : 0.1
;;
(ns clj-fuzzy.soundex-test
(:require [clojure.test :refer :all]
[clj-fuzzy.s... | null | https://raw.githubusercontent.com/Yomguithereal/clj-fuzzy/ce7c57dfb14f6ddc99bf4d9ab74c778128438d8b/test/clj_fuzzy/soundex_test.clj | clojure | -------------------------------------------------------------------
-------------------------------------------------------------------
| clj - fuzzy Soundex Tests
Author : ( Yomguithereal )
Version : 0.1
(ns clj-fuzzy.soundex-test
(:require [clojure.test :refer :all]
[clj-fuzzy.soundex :refer :all]))
(deftest process-test
(is (= "R163" (process "Rupert")))
(is (= "R163" (process "Robert")))
(is (= "R150" (process "Rubin"... |
a61a3c4ecf9e295e8615757ee523f94ede98c4f1795a96f849324e3069350c5c | TheLortex/mirage-monorepo | supported_version.mli | * Supported versions of the OCaml AST
type t
val all : t list
val to_string : t -> string
* Return a string such as " 4.02 "
val to_int : t -> int
* Return an integer such as [ 402 ]
val of_string : string -> t option
* a string as reported by [ ocamlc -version ]
| null | https://raw.githubusercontent.com/TheLortex/mirage-monorepo/b557005dfe5a51fc50f0597d82c450291cfe8a2a/duniverse/ppxlib/ast/supported_version/supported_version.mli | ocaml | * Supported versions of the OCaml AST
type t
val all : t list
val to_string : t -> string
* Return a string such as " 4.02 "
val to_int : t -> int
* Return an integer such as [ 402 ]
val of_string : string -> t option
* a string as reported by [ ocamlc -version ]
| |
b192e04d20f3570ec6affcde278da446fc3d978ad383c4da5dc63b638960af98 | arachne-framework/factui | pull.cljc | (ns factui.specs.pull
(:require [#?(:clj clojure.spec.alpha
:cljs cljs.spec.alpha) :as s]
[clojure.string :as str]))
(s/def ::pattern (s/coll-of ::attr-spec :min-count 1))
(s/def ::attr-spec (s/or ::attr-name ::attr-name
::wildcard ::wildcard
... | null | https://raw.githubusercontent.com/arachne-framework/factui/818ea79d7f84dfe80ad23ade0b6b2ed5bb1c6287/src/factui/specs/pull.cljc | clojure | (ns factui.specs.pull
(:require [#?(:clj clojure.spec.alpha
:cljs cljs.spec.alpha) :as s]
[clojure.string :as str]))
(s/def ::pattern (s/coll-of ::attr-spec :min-count 1))
(s/def ::attr-spec (s/or ::attr-name ::attr-name
::wildcard ::wildcard
... | |
38af16b0012111b301ca3fb3db816ec424807379d7344cb1e397653c19d70293 | opencog/opencog | pre-process-#2.scm | ;; target is a number and there does not exist "of" after it.
(define pre-process-#2
(BindLink
(VariableList
(TypedVariableLink
(VariableNode "$target")
(TypeNode "WordInstanceNode")
)
(TypedVariableLink
(VariableNode "$wor... | null | https://raw.githubusercontent.com/opencog/opencog/53f2c2c8e26160e3321b399250afb0e3dbc64d4c/opencog/nlp/anaphora/rules/pre-process/pre-process-%232.scm | scheme | target is a number and there does not exist "of" after it. |
(define pre-process-#2
(BindLink
(VariableList
(TypedVariableLink
(VariableNode "$target")
(TypeNode "WordInstanceNode")
)
(TypedVariableLink
(VariableNode "$word")
(TypeNode "WordInstanceNode")
... |
f0290f8d138d2b8f2e98b0cf5bf914b4be5a71250b8560bcb0f6601678dbb6ba | oshyshko/adventofcode | Spatial.hs | module Geom.Spatial where
import Geom.Box (Box (..), center, intersection)
import Geom.Point (Point)
import qualified Geom.Point as P
import Geom.XY (XY (..))
import Geom.XYZ (XYZ (..))
import Imports
p = coordinate , e.g. XY , XYZ
-- c = component, e.g. Int
... | null | https://raw.githubusercontent.com/oshyshko/adventofcode/153dabd913aa06b22c8bfb45f99493eea2bfbb6f/src/Geom/Spatial.hs | haskell | c = component, e.g. Int
/+---++---Z o + s
/+ | || |
+ |/+---+----+
|/|/+---++---+
|/| | || |
| |/+---++---+
|/+----//--+
A----//---/
o
# INLINE set #
new-value, new-box, source
+---------+
| |
| +-.-+ | <- outerCenter
| | | |
| I---+ |
O---------+
the m... | module Geom.Spatial where
import Geom.Box (Box (..), center, intersection)
import Geom.Point (Point)
import qualified Geom.Point as P
import Geom.XY (XY (..))
import Geom.XYZ (XYZ (..))
import Imports
p = coordinate , e.g. XY , XYZ
v = value , e.g. , Int
d... |
13daa1333a49a3c9c82c6a9503beeed781dd4d8b481795ed49ee71ed499d848b | jaredly/reason-language-server | matching.ml | (**************************************************************************)
(* *)
(* OCaml *)
(* *)
... | null | https://raw.githubusercontent.com/jaredly/reason-language-server/ce1b3f8ddb554b6498c2a83ea9c53a6bdf0b6081/ocaml_typing/406/matching.ml | ocaml | ************************************************************************
OCaml
... | , projet Cristal , INRIA Rocquencourt
Copyright 1996 Institut National de Recherche en Informatique et
the GNU Lesser General Public License version 2.1 , with the
open Misc
open Asttypes
open Types
open Typedtree
open Lambda
open Parmatch
open Printf
let dbg = fals... |
3a4f4efafca5fe9b241564c1da0f5038de2c0d385916cc41398b0e04e94a8ab3 | xcoo/pdfshot | project.clj | (defproject pdfshot "0.1.7"
:description "PDF screenshot generator for web pages"
:url ""
:license {:name "Apache License, Version 2.0"
:url "-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/core.async "1.5.648"]
[org.clojure/clojurescript "1.1... | null | https://raw.githubusercontent.com/xcoo/pdfshot/b15fc3ef0d4d9c523d155d6e5f7118efb42581dc/project.clj | clojure | (defproject pdfshot "0.1.7"
:description "PDF screenshot generator for web pages"
:url ""
:license {:name "Apache License, Version 2.0"
:url "-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/core.async "1.5.648"]
[org.clojure/clojurescript "1.1... | |
0547babc36b2072115fc2f4590b83d25b8b8ecda4d992aa27a3947b7c5142c9d | lukexi/halive | Recompiler.hs | # LANGUAGE RecordWildCards #
{-# LANGUAGE RankNTypes #-}
module Halive.Recompiler where
import Halive.SubHalive
import Halive.FileListener
import System.Mem
import Control.Concurrent.STM
import Control.Concurrent
import Control.Monad.Trans
import Control.Monad
import Data.Text (Text)
import qualified Data.Text as Text
... | null | https://raw.githubusercontent.com/lukexi/halive/cae5b327730bcea5ef25bb05e5a12a283eade97d/src/Halive/Recompiler.hs | haskell | # LANGUAGE RankNTypes #
^ This is intentionally lazy, since we want to evaluate the string on
and construct those in a smarter way.
when used after application startup, when it tries to load libraries
Grab this thread's ID (need to run this on the main thread, of course)
and process all compilation requests in it.... | # LANGUAGE RecordWildCards #
module Halive.Recompiler where
import Halive.SubHalive
import Halive.FileListener
import System.Mem
import Control.Concurrent.STM
import Control.Concurrent
import Control.Monad.Trans
import Control.Monad
import Data.Text (Text)
import qualified Data.Text as Text
import Data.IORef
import Dat... |
9da6b6933f2dfe8c3b1df3532b2c69c02d52261db41aa1614efbe970751f0d1a | zotonic/zotonic | action_wires_template.erl | @author < >
2013
%%
Based on code copyright ( c ) 2008 - 2009
Based on code copyright ( c ) 2009
Copyright 2013
%%
Licensed under the Apache License , Version 2.0 ( the " License " ) ;
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at... | null | https://raw.githubusercontent.com/zotonic/zotonic/852f627c28adf6e5212e8ad5383d4af3a2f25e3f/apps/zotonic_mod_wires/src/actions/action_wires_template.erl | erlang |
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-2.0
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing per... | @author < >
2013
Based on code copyright ( c ) 2008 - 2009
Based on code copyright ( c ) 2009
Copyright 2013
Licensed under the Apache License , Version 2.0 ( the " License " ) ;
distributed under the License is distributed on an " AS IS " BASIS ,
-module(action_wires_template).
-include_lib... |
9ccd9758d5b21138d98e6211b0fbbfadc5e0c5093a8a333180538aefa9f16b33 | shayan-najd/NativeMetaprogramming | Main.hs | ------------------------------------------------------------------------
( c ) The GHC Team , 1992 - 2012
DeriveConstants is a program that extracts information from the C
declarations in the header files ( primarily struct field offsets )
and generates various files , such as a header file that can be # in... | null | https://raw.githubusercontent.com/shayan-najd/NativeMetaprogramming/24e5f85990642d3f0b0044be4327b8f52fce2ba3/utils/deriveConstants/Main.hs | haskell | ----------------------------------------------------------------------
----------------------------------------------------------------------
---------------------------------------------------------------------- -}
These are both the C-- types used in a load
e.g. b32[addr]
b32 :: CmmType
Control group cons... |
( c ) The GHC Team , 1992 - 2012
DeriveConstants is a program that extracts information from the C
declarations in the header files ( primarily struct field offsets )
and generates various files , such as a header file that can be # included
into non - C source containing this information .
We want to get... |
01de3cb9aaf7066d6a2fde589f8363c1db53162579dd9f3a4501d96b08ed7fb8 | trentmaetzold/cs61as | hw4-tests.rkt | #lang racket
(require racket/sandbox)
(provide (all-defined-out))
(define (create-tests e questions)
(define all-names '())
(define-syntax-rule
(define/test name code ...)
(when (or (null? questions) (member (symbol->string 'name) questions))
(set! all-names (append all-names (list (symbol->strin... | null | https://raw.githubusercontent.com/trentmaetzold/cs61as/6e4830786e2c28a26203a4f2046776405af2c10e/homework/tests/hw4-tests.rkt | racket | #lang racket
(require racket/sandbox)
(provide (all-defined-out))
(define (create-tests e questions)
(define all-names '())
(define-syntax-rule
(define/test name code ...)
(when (or (null? questions) (member (symbol->string 'name) questions))
(set! all-names (append all-names (list (symbol->strin... | |
37726e646b9956ebed5c4a6ee7695fedc23feee53da5a85b72423a679aec4b98 | funcatron/tron | core_test.clj | (ns funcatron.tron.core-test
(:require [clojure.test :refer :all]
[funcatron.tron.core :refer :all]))
(deftest a-test
(testing "basic."
(is (= 1 1))))
| null | https://raw.githubusercontent.com/funcatron/tron/cfe0c227f9c3ad88b3d072b0319954786afb5f15/test/funcatron/tron/core_test.clj | clojure | (ns funcatron.tron.core-test
(:require [clojure.test :refer :all]
[funcatron.tron.core :refer :all]))
(deftest a-test
(testing "basic."
(is (= 1 1))))
| |
25d2284a991797d4eb078a98b97f1d06cc15fc0d54633b18c79a8d5e9c7784dd | Javran/advent-of-code | Day24.hs | module Javran.AdventOfCode.Y2022.Day24 (
) where
import Control.Monad
import Data.Function
import Data.Ix
import qualified Data.Map.Strict as M
import qualified Data.PSQueue as PQ
import Data.Semigroup
import qualified Data.Vector.Unboxed as VU
import Data.Word
import Javran.AdventOfCode.GridSystem.RowThenCol.Uldr
i... | null | https://raw.githubusercontent.com/Javran/advent-of-code/96fa60daf3ada21ea24f27f3c91d941bffa49869/src/Javran/AdventOfCode/Y2022/Day24.hs | haskell |
Normally we would put `cur` (i.e. waiting) as the last candidate to try.
Because intuitive moving in some directions could be better than just waiting.
But since we are using priority queue, the order doesn't really matter,
so prefer faster list generatio... | module Javran.AdventOfCode.Y2022.Day24 (
) where
import Control.Monad
import Data.Function
import Data.Ix
import qualified Data.Map.Strict as M
import qualified Data.PSQueue as PQ
import Data.Semigroup
import qualified Data.Vector.Unboxed as VU
import Data.Word
import Javran.AdventOfCode.GridSystem.RowThenCol.Uldr
i... |
664e54a8d5c29188a9d61e46c8bd7fcf0447ee41900cca900d0bbc40221356a3 | singnet/snet-minting-policy | Vesting.hs | # LANGUAGE AllowAmbiguousTypes #
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE Generalize... | null | https://raw.githubusercontent.com/singnet/snet-minting-policy/ea4c72d087db690bb9063282840ed74bd3e63c8f/src/Vesting.hs | haskell | # LANGUAGE DataKinds #
# LANGUAGE DeriveAnyClass #
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE NoImplicitPrelude #
# LANGUAGE PartialTypeSignatures #
# LANGUAGE TemplateHaskell #
# LANGUAGE TypeOperators #
... | # LANGUAGE AllowAmbiguousTypes #
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE RecordWildCards #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE TypeApplications ... |
d2bf5c6b849bb9bce40eee1b470f98b891b19d55dd4991884dfb2ffcec665ccf | mekispeter/haskell2019spring | Grid.hs |
Functional Programming for Logicians 2019 Spring
This module introduces the Grid type , which is basically
a two - dimensional vector , used in some of the projects .
It is an instance of the Foldable and Monad classes .
It has various show methods , including some that write
image files .
... | null | https://raw.githubusercontent.com/mekispeter/haskell2019spring/18fa81092cdc7a15c8ef92a2eff8274dfe79d00d/src/game_of_life/Grid.hs | haskell |
Definition and a few basic functions
g v v g v v grid
l l g v v listFromGrid
l l l l (map . map) listFromGrid
l l l map ((map concat) . L.transpose)
l l concat
g v v gridFromList
------------------------------------------------------
Applicative:
------------------------------... |
Functional Programming for Logicians 2019 Spring
This module introduces the Grid type , which is basically
a two - dimensional vector , used in some of the projects .
It is an instance of the Foldable and Monad classes .
It has various show methods , including some that write
image files .
... |
20abfe28888a218fd4e3031a4d9127e6e02b591e0429a1ba8bb4392e1da53e8f | lkuper/lvar-examples | graph-traversal-explicit-freeze.hs | # LANGUAGE TypeFamilies #
import Control.LVish
import Control.LVish.DeepFrz -- provides Frzn
import Data.LVar.Generic (addHandler, freeze)
import Data.LVar.PureSet
import qualified Data.Graph as G
-- A toy graph for demonstration purposes.
myGraph = first $ G.graphFromEdges [("node0", 0, [1, 6, 7]),
... | null | https://raw.githubusercontent.com/lkuper/lvar-examples/681c0ed83366dbb8f7d4a1f1285c0ad3e42a436b/2.0/graph-traversal-explicit-freeze.hs | haskell | provides Frzn
A toy graph for demonstration purposes.
Argh! Why isn't this built in?!
Takes a graph and a vertex and returns a list of the vertex's
to mind given the Data.Graph API.
Kick things off | # LANGUAGE TypeFamilies #
import Control.LVish
import Data.LVar.Generic (addHandler, freeze)
import Data.LVar.PureSet
import qualified Data.Graph as G
myGraph = first $ G.graphFromEdges [("node0", 0, [1, 6, 7]),
("node1", 1, [4]),
("node2", 2, [1... |
a9ae8e3c95e3a9c7ac57e0df2c0ded41e99e2e473302fbb2a5be992f717e3e12 | Kakadu/fp2022 | keyMap.ml | * Copyright 2021 - 2022 ,
* SPDX - License - Identifier : LGPL-3.0 - or - later
include Map.Make (String)
let pp pp_v ppf map =
Format.fprintf ppf "@[[@[";
iter (fun k v -> Format.fprintf ppf "@[\"%s\": %a@];@\n" k pp_v v) map;
Format.fprintf ppf "@]]@]"
;;
| null | https://raw.githubusercontent.com/Kakadu/fp2022/132b0dc58bc19e25007c40eebdff82cbe855160c/Pascal/lib/keyMap.ml | ocaml | * Copyright 2021 - 2022 ,
* SPDX - License - Identifier : LGPL-3.0 - or - later
include Map.Make (String)
let pp pp_v ppf map =
Format.fprintf ppf "@[[@[";
iter (fun k v -> Format.fprintf ppf "@[\"%s\": %a@];@\n" k pp_v v) map;
Format.fprintf ppf "@]]@]"
;;
| |
dc24d00dbe5f1d4bbd612d2a2ff3d4f1d50f42fa54943b844a5ece94b1f39cb4 | Workiva/utiliva | macros.clj | Copyright 2017 - 2019 Workiva Inc.
;;
;; Licensed under the Eclipse Public License 1.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; -1.0.php
;;
;; Unless required by applicable law or agreed to in writing, software
distribu... | null | https://raw.githubusercontent.com/Workiva/utiliva/2a8f3914ec83dec88f193bcb6293f6bec4d3f66d/src/utiliva/macros.clj | clojure |
Licensed under the Eclipse Public License 1.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-1.0.php
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o... | Copyright 2017 - 2019 Workiva Inc.
distributed under the License is distributed on an " AS IS " BASIS ,
(ns utiliva.macros
(:require [backtick :refer [resolve-symbol]]))
(defn- class-sym*
[sym]
(try
(-> sym resolve-symbol name Class/forName)
(catch Throwable e)))
(defn class-sym?
[sym]
(boolean... |
d5f84c48601b26bc184df536ac8b6b62075708ffcf4f3b0a271e4cdce15c57aa | rotatef/json-streams | input.lisp | ;;;; json-streams
;;;;
Copyright ( C ) 2013 < >
;;;;
;;;; This library is free software: you can redistribute it and/or modify
;;;; it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation , either version 3 of the License , or
;;;; (at your option) any later... | null | https://raw.githubusercontent.com/rotatef/json-streams/5da012e8133affbf75024e7500feb37394690752/tests/input.lisp | lisp | json-streams
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied... | Copyright ( C ) 2013 < >
by the Free Software Foundation , either version 3 of the License , or
You should have received a copy of the GNU General Public License
(in-package :json-streams-tests)
(defun run-all-tests ()
(quickcheck
(random-test)
(run-test-files)
(json-test-suite-test-parsing... |
612b6b254d0311002c8d215f8ef65020117d76b8a8bb6636b5a74716f906e6f7 | takikawa/racket-ppa | info.rkt | (module info setup/infotab (#%module-begin (define collection "make") (define scribblings (quote (("make.scrbl" (multi-page) (tool-library))))) (define deps (quote ("scheme-lib" "base" "cext-lib" "compiler-lib" "compatibility-lib"))) (define build-deps (quote ("racket-doc" "scribble-lib"))) (define pkg-desc "Simple tim... | null | https://raw.githubusercontent.com/takikawa/racket-ppa/26d6ae74a1b19258c9789b7c14c074d867a4b56b/share/pkgs/make/info.rkt | racket | (module info setup/infotab (#%module-begin (define collection "make") (define scribblings (quote (("make.scrbl" (multi-page) (tool-library))))) (define deps (quote ("scheme-lib" "base" "cext-lib" "compiler-lib" "compatibility-lib"))) (define build-deps (quote ("racket-doc" "scribble-lib"))) (define pkg-desc "Simple tim... | |
ff696689f14ef12d72436176ab4631a06072ce5c879eedf210e7a14957f339d1 | votinginfoproject/data-processor | ballot_response.clj | (ns vip.data-processor.output.v3-0.ballot-response
(:require [vip.data-processor.output.xml-helpers :refer :all]
[korma.core :as korma]))
(defn ->xml [{:keys [id
text
sort_order]}]
(let [children [(xml-node text)
(xml-node sort_order)]]
(s... | null | https://raw.githubusercontent.com/votinginfoproject/data-processor/b4baf334b3a6219d12125af8e8c1e3de93ba1dc9/src/vip/data_processor/output/v3_0/ballot_response.clj | clojure | (ns vip.data-processor.output.v3-0.ballot-response
(:require [vip.data-processor.output.xml-helpers :refer :all]
[korma.core :as korma]))
(defn ->xml [{:keys [id
text
sort_order]}]
(let [children [(xml-node text)
(xml-node sort_order)]]
(s... | |
f5ae695cda6c297fa93a137c1214ff7246c1f49c8813cac97084b0eb89786009 | manuel-serrano/hop | dom.scm | ;*=====================================================================*/
* serrano / prgm / project / hop / hop / runtime / dom.scm * /
;* ------------------------------------------------------------- */
* Author : * /
* Creation ... | null | https://raw.githubusercontent.com/manuel-serrano/hop/481cb10478286796addd2ec9ee29c95db27aa390/runtime/dom.scm | scheme | *=====================================================================*/
* ------------------------------------------------------------- */
* ------------------------------------------------------------- */
* Restricted DOM implementation */
*===========================... | * serrano / prgm / project / hop / hop / runtime / dom.scm * /
* Author : * /
* Creation : Fri Dec 23 16:55:15 2005 * /
* Last change : Mon Jul 1 08:29:14 2019 ( serrano ) * /
* Cop... |
d274926a9abf3051f625228d40e31ecbdcf704bfc5cf4fdcd8811b6a58da3203 | siscia/css-parser | token_test.clj | (ns css-parser.token-test
(:require [clojure.test :refer [deftest testing is]]
[instaparse.core :as p]))
(def gp
(p/parser (str "debug = token \n"
(slurp (clojure.java.io/resource "rules.bnf"))
"\n"
(slurp (clojure.java.io/resource "types.bnf")))))
(d... | null | https://raw.githubusercontent.com/siscia/css-parser/caf42a163aac27e261bd57814b7d79c129d6209c/test/css_parser/token_test.clj | clojure | (ns css-parser.token-test
(:require [clojure.test :refer [deftest testing is]]
[instaparse.core :as p]))
(def gp
(p/parser (str "debug = token \n"
(slurp (clojure.java.io/resource "rules.bnf"))
"\n"
(slurp (clojure.java.io/resource "types.bnf")))))
(d... | |
977774795d1f016150042e1ba7a397bd28c6ed880174f3229ee2a25463830de9 | vonzhou/LearnYouHaskellForGreatGood | Cube.hs | module Geometry.Cube
( volume
, area
) where
import qualified Geometry.Cuboid as Cuboid
volume :: Float -> Float
volume side = Cuboid.volume side side side
area :: Float -> Float
area side = Cuboid.area side side side
| null | https://raw.githubusercontent.com/vonzhou/LearnYouHaskellForGreatGood/439d848deac53ef6da6df433078b7f1dcf54d18d/chapter6/Geometry/Cube.hs | haskell | module Geometry.Cube
( volume
, area
) where
import qualified Geometry.Cuboid as Cuboid
volume :: Float -> Float
volume side = Cuboid.volume side side side
area :: Float -> Float
area side = Cuboid.area side side side
| |
47d58a3244278df6f2d472f28ed988ab832c5ae29c006c64539076e70f09cad6 | aeolus-project/zephyrus | json_versions_j.ml | (* Auto-generated from "json_versions.atd" *)
type version = Json_versions_t.version
type versioned_object = Json_versions_t.versioned_object = {
version: version
}
let write_version = (
Yojson.Safe.write_int
)
let string_of_version ?(len = 1024) x =
let ob = Bi_outbuf.create len in
write_version ob x;
Bi... | null | https://raw.githubusercontent.com/aeolus-project/zephyrus/0b52de4038bbab724e6a9628430165a7f09f77ae/src/atd/json_versions_j.ml | ocaml | Auto-generated from "json_versions.atd" |
type version = Json_versions_t.version
type versioned_object = Json_versions_t.versioned_object = {
version: version
}
let write_version = (
Yojson.Safe.write_int
)
let string_of_version ?(len = 1024) x =
let ob = Bi_outbuf.create len in
write_version ob x;
Bi_outbuf.contents ob
let read_version = (
Ag_... |
1ab331f15559b425584e5eede5ca8ddb3f73fbc032484e8e6509bc6108a333a6 | smarkets/smk_erlang_sdk | smk_frame.erl | -module(smk_frame).
-export([buf/0, buf_append/2, deframe/1, frame/1]).
-record(buf, {
size = waiting,
bytes = <<>>
}).
-spec buf() -> #buf{}.
buf() -> #buf{}.
-spec buf_append(#buf{}, binary()) -> #buf{}.
buf_append(Buf, Data) ->
Buf#buf{bytes = <<(Buf#buf.bytes)/binary, Data/binary>>}.
-spec defram... | null | https://raw.githubusercontent.com/smarkets/smk_erlang_sdk/f56ba38201a8d3bc6e2621a402e16f486f8acf09/src/smk_frame.erl | erlang | nothing to do | -module(smk_frame).
-export([buf/0, buf_append/2, deframe/1, frame/1]).
-record(buf, {
size = waiting,
bytes = <<>>
}).
-spec buf() -> #buf{}.
buf() -> #buf{}.
-spec buf_append(#buf{}, binary()) -> #buf{}.
buf_append(Buf, Data) ->
Buf#buf{bytes = <<(Buf#buf.bytes)/binary, Data/binary>>}.
-spec defram... |
05137ade9fc7d98759d617340cf38acd4ff7a11cb8f29db217cbb3451df29cad | BinaryAnalysisPlatform/bap | strings_main.ml | open Core_kernel[@@warning "-D"]
open Regular.Std
open Bap.Std
open Bap_strings.Std
open Format
include Self()
let min_length = Config.(param int) "min-len"
~default:4
~synonyms:["bytes"]
~doc:"ignore strings that has length less then $(docv)"
let address = Config.flag "print-address"
~doc:"prints a... | null | https://raw.githubusercontent.com/BinaryAnalysisPlatform/bap/cbdf732d46c8e38df79d9942fc49bcb97915c657/plugins/strings/strings_main.ml | ocaml | open Core_kernel[@@warning "-D"]
open Regular.Std
open Bap.Std
open Bap_strings.Std
open Format
include Self()
let min_length = Config.(param int) "min-len"
~default:4
~synonyms:["bytes"]
~doc:"ignore strings that has length less then $(docv)"
let address = Config.flag "print-address"
~doc:"prints a... | |
3a7da68aa19e42172dfdc01f67089abf2a7aa4f674b6a42f2883314314072108 | camlspotter/ocamloscope.2 | data.mli | (** Data file load/save *)
open Utils
open Sig
module SigFile : sig
* Image of < pack>.sig file .
< pack>.sig file contains signature data of OCamlFind package < pack > and
its sub - packages such as < pack.xxx >
<pack>.sig file contains signature data of OCamlFind package <pack> and
... | null | https://raw.githubusercontent.com/camlspotter/ocamloscope.2/49b5977a283cdd373021d41cb3620222351a2efe/data.mli | ocaml | * Data file load/save
* <pack>
* packages and their signatures
* the digests of the package *.cm* files
* <pack>
* packages and their humps
* the digests of the package *.cm* files
* A primitive %xxx
* <pack>
* all the items
* the digests of the package *.cm* files
* Safe with tag-checking. If check fails, ... |
open Utils
open Sig
module SigFile : sig
* Image of < pack>.sig file .
< pack>.sig file contains signature data of OCamlFind package < pack > and
its sub - packages such as < pack.xxx >
<pack>.sig file contains signature data of OCamlFind package <pack> and
its sub-packages such as ... |
db24943a8d93666e9c4b505455d7689d046fc771aca1a8b2400c74ee66040c8a | alanz/ghc-exactprint | BadTelescope2.hs | {-# LANGUAGE TypeInType, ExplicitForAll #-}
module BadTelescope2 where
import Data.Kind
import Data.Proxy
data SameKind :: k -> k -> *
foo :: forall a k (b :: k). SameKind a b
foo = undefined
bar :: forall a (c :: Proxy b) (d :: Proxy a). Proxy c -> SameKind b d
bar = undefined
| null | https://raw.githubusercontent.com/alanz/ghc-exactprint/b6b75027811fa4c336b34122a7a7b1a8df462563/tests/examples/pre-ghc86/BadTelescope2.hs | haskell | # LANGUAGE TypeInType, ExplicitForAll # |
module BadTelescope2 where
import Data.Kind
import Data.Proxy
data SameKind :: k -> k -> *
foo :: forall a k (b :: k). SameKind a b
foo = undefined
bar :: forall a (c :: Proxy b) (d :: Proxy a). Proxy c -> SameKind b d
bar = undefined
|
0259d831a141db640837898eca4bf8fe088bf08e1e817b905689f4730821c601 | hdima/erlport | ruby_options.erl | Copyright ( c ) 2009 - 2015 , < >
%%% All rights reserved.
%%%
%%% Redistribution and use in source and binary forms, with or without
%%% modification, are permitted provided that the following conditions are met:
%%%
%%% * Redistributions of source code must retain the above copyright notice,
%%% this list of... | null | https://raw.githubusercontent.com/hdima/erlport/246b7722d62b87b48be66d9a871509a537728962/src/ruby_options.erl | erlang | All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistribution... | Copyright ( c ) 2009 - 2015 , < >
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS "
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , E... |
bc21351085e75a3fa45cb651bd115f1279edeab41e53ce33fc278d4928f95c50 | dnadales/sandbox | TFEHOAS.hs | -- | Tagless final embedding with higher-order abstract syntax.
module LambdaCalc.TFEHOAS where
import qualified Data.Function as F
class Symantics repr where
int :: Int -> repr Int
add :: repr Int -> repr Int -> repr Int
lam :: (repr a -> repr b) -> repr (a -> b)
app :: repr (a -> b) -> repr a -> re... | null | https://raw.githubusercontent.com/dnadales/sandbox/401c4f0fac5f8044fb6e2e443bacddce6f135b4b/tagless/src/LambdaCalc/TFEHOAS.hs | haskell | | Tagless final embedding with higher-order abstract syntax.
Some terms in this language
Note that you cannot even express an open term like:
Since you need to use a lambda abstraction or other function!
Some othe interesting examples:
---------------------------------------------------------------------------... | module LambdaCalc.TFEHOAS where
import qualified Data.Function as F
class Symantics repr where
int :: Int -> repr Int
add :: repr Int -> repr Int -> repr Int
lam :: (repr a -> repr b) -> repr (a -> b)
app :: repr (a -> b) -> repr a -> repr b
th1 :: (Symantics repr) => repr Int
th1 = add (int 1) (int... |
3f5ecf27e8753b39b42d9972b34dcc3005a5ae3158b765a26cd63cdbb80b6a63 | reborg/clojure-essential-reference | 1.clj | (chunk-cons [chunk rest])
(chunk-first [s])
(chunk-rest [s])
(chunk-next [s])
(chunk-buffer [capacity])
(chunk-append [b x])
(chunk [b])
(chunked-seq? [s]) | null | https://raw.githubusercontent.com/reborg/clojure-essential-reference/c37fa19d45dd52b2995a191e3e96f0ebdc3f6d69/SequentialProcessing/chunk-cons%2Cchunk-first%2Cchunk-rest%2Cchunk-next%2Cchunk-buffer%2Cchunk-appendandchunk/1.clj | clojure | (chunk-cons [chunk rest])
(chunk-first [s])
(chunk-rest [s])
(chunk-next [s])
(chunk-buffer [capacity])
(chunk-append [b x])
(chunk [b])
(chunked-seq? [s]) | |
101c7f6a79965c28023495d8ae5d4d64ce2b131f49023329ce4f4c1e3b77db0b | senapk/funcional_arcade | solver.hs | import Control.Monad (replicateM)
calc :: (Int, Int) -> Int
calc (a, b) = abs (a - b)
choose :: ((Int, Int), Int) -> ((Int, Int), Int) -> ((Int, Int), Int)
choose (ab, i) (ab', i') = if calc ab < calc ab' then (ab,i) else (ab',i')
searchBest :: [[Char]] -> Int
searchBest xs
| null passed = -1
| otherwise = ... | null | https://raw.githubusercontent.com/senapk/funcional_arcade/9f0ff1a13adb46b7353f9b2e11e653160fbdcf9d/base/086/solver.hs | haskell | [(Int, Int)]
[((Int, Int), Int)]
[String] | import Control.Monad (replicateM)
calc :: (Int, Int) -> Int
calc (a, b) = abs (a - b)
choose :: ((Int, Int), Int) -> ((Int, Int), Int) -> ((Int, Int), Int)
choose (ab, i) (ab', i') = if calc ab < calc ab' then (ab,i) else (ab',i')
searchBest :: [[Char]] -> Int
searchBest xs
| null passed = -1
| otherwise = ... |
8f51f1dd10e3ea5d9b82c82556ab6d35cc8a1f96666417700d229bc7b1e4f9d8 | eponai/sulolive | s3_uploader.cljc | (ns eponai.web.s3-uploader
#?(:cljs
(:require-macros
[cljs.core.async.macros :refer [go]]))
(:require
#?(:cljs
[s3-beam.client :as s3])
#?(:cljs
[cljs.core.async :refer [chan alts! put!]])
[om.next :as om :refer [defui]]
[eponai.common.ui.dom :as dom]
[taoensso.timbre :... | null | https://raw.githubusercontent.com/eponai/sulolive/7a70701bbd3df6bbb92682679dcedb53f8822c18/src/eponai/web/s3_uploader.cljc | clojure | {:keys [on-photo-queue]} (om/get-computed component)
(debug {:original file})
(set! (.-onloadend reader) (fn []
(put! upload-queue file)))
(.readAsDataURL reader file)) | (ns eponai.web.s3-uploader
#?(:cljs
(:require-macros
[cljs.core.async.macros :refer [go]]))
(:require
#?(:cljs
[s3-beam.client :as s3])
#?(:cljs
[cljs.core.async :refer [chan alts! put!]])
[om.next :as om :refer [defui]]
[eponai.common.ui.dom :as dom]
[taoensso.timbre :... |
ac87a4dbef578977769f3570613ac06ce8caf45ee2b803fa3c4329852cf53142 | glguy/advent2017 | Day14.hs | {-# Language DataKinds #-}
|
Module : Main
Description : Day 14 solution
Copyright : ( c ) , 2017
License : ISC
Maintainer :
Day 14 ties Day 10 and Day 12 together presumably to see how quickly
we can combine our previous results to make something new .
Module : Main
Descriptio... | null | https://raw.githubusercontent.com/glguy/advent2017/fed4592b076d255297dbddf2a183c70d6d0acfa4/execs/Day14.hs | haskell | # Language DataKinds #
command-line.
| Convert the set of coordinates into a graph labeled with those
coordinates where adjacent elements have edges between them.
| Build the problem grid as a list of rows where a cell is set in
a row is set when the bit at that index is set.
| Convert a grid into a list of coord... | |
Module : Main
Description : Day 14 solution
Copyright : ( c ) , 2017
License : ISC
Maintainer :
Day 14 ties Day 10 and Day 12 together presumably to see how quickly
we can combine our previous results to make something new .
Module : Main
Description : Day 14 solution
Copyrig... |
b1ca193a64e29e12974cc0a271e8d755efc6043fb3e0e3aa871fbc95cce97c19 | fulcrologic/fulcro-inspect | version_cards.cljs | (ns fulcro.inspect.lib.version-cards
(:require [devcards.core :as dc :include-macros true]
[cljs.test :refer [is testing]]
[fulcro.inspect.lib.version :as version]))
(dc/deftest test-parse-version
(is (= (version/parse-version "2.2.0")
[2 2 0 1 nil 1]))
(is (= (version/parse-ver... | null | https://raw.githubusercontent.com/fulcrologic/fulcro-inspect/a03b61cbd95384c0f03aa936368bcf5cf573fa32/devcards/fulcro/inspect/lib/version_cards.cljs | clojure | (ns fulcro.inspect.lib.version-cards
(:require [devcards.core :as dc :include-macros true]
[cljs.test :refer [is testing]]
[fulcro.inspect.lib.version :as version]))
(dc/deftest test-parse-version
(is (= (version/parse-version "2.2.0")
[2 2 0 1 nil 1]))
(is (= (version/parse-ver... | |
2d9a54454136cb1000927631a91353f2d025ccdfed2b32e770d7841251f46712 | chenyukang/eopl | 08.scm | (load-relative "../libs/init.scm")
(load-relative "./base/environments.scm")
;;;;;;;;;;;;;;;; grammatical specification ;;;;;;;;;;;;;;;;
(define the-lexical-spec
'((whitespace (whitespace) skip)
(comment ("%" (arbno (not #\newline))) skip)
(identifier
(letter (arbno (or letter digit "_" "-" "?")))
... | null | https://raw.githubusercontent.com/chenyukang/eopl/0406ff23b993bfe020294fa70d2597b1ce4f9b78/ch3/08.scm | scheme | grammatical specification ;;;;;;;;;;;;;;;;
sllgen boilerplate ;;;;;;;;;;;;;;;;
an expressed value is either a number, a boolean or a procval.
extractors:
expval->num : ExpVal -> Int
expval->bool : ExpVal -> Bool
the interpreter ;;;;;;;;;;;;;;;;
(run "foo") -> error | (load-relative "../libs/init.scm")
(load-relative "./base/environments.scm")
(define the-lexical-spec
'((whitespace (whitespace) skip)
(comment ("%" (arbno (not #\newline))) skip)
(identifier
(letter (arbno (or letter digit "_" "-" "?")))
symbol)
(number (digit (arbno digit)) number)
(num... |
ec193feeb5cdd8666d6361bdbc2ab61fe083b7ed32c4aace3943d40555e3feac | mrphlip/aoc | 13.hs | # OPTIONS_GHC -Wno - tabs #
import Data.Function
import Data.List
import Data.Maybe
import Control.Exception
import Utils
getInput :: IO (Integer, [Maybe Integer])
getInput = do
dat <- readFile "13.txt"
return $ parseInput dat
parseInput :: String -> (Integer, [Maybe Integer])
parseInput dat = (timestamp, ids)
whe... | null | https://raw.githubusercontent.com/mrphlip/aoc/06395681eb6b50b838cd4561b2e0aa772aca570a/2020/13.hs | haskell | # OPTIONS_GHC -Wno - tabs #
import Data.Function
import Data.List
import Data.Maybe
import Control.Exception
import Utils
getInput :: IO (Integer, [Maybe Integer])
getInput = do
dat <- readFile "13.txt"
return $ parseInput dat
parseInput :: String -> (Integer, [Maybe Integer])
parseInput dat = (timestamp, ids)
whe... | |
62f394cfe92a26f2b896da58aa0ad002fbb4743faf52a2f02904033d25902999 | plum-umd/adapton.ocaml | quickhull.ml |
-- TODO * * : Test this code for correctness .
-- TODO : Maybe make it use OCaml 's Rational Number representation instead of IEEE floats .
-- TODO** : Test this code for correctness.
-- TODO : Maybe make it use OCaml's Rational Number representation instead of IEEE floats.
*)
2D geometry primitives... | null | https://raw.githubusercontent.com/plum-umd/adapton.ocaml/a8e642ac1cc113b33e1837da960940c2dfcfa772/src/test/quickhull.ml | ocaml | //////////////////
// Common Setup //
//////////////////
breaks an int in to a pair of floats
for convenience, this returns a tuple of (leftfurther:bool, furthest:point)
/////////////////////////////
/////////////////////////////
Adapton: Use a memo table here. Our accumulator, hull_accum, is
a nomin... |
-- TODO * * : Test this code for correctness .
-- TODO : Maybe make it use OCaml 's Rational Number representation instead of IEEE floats .
-- TODO** : Test this code for correctness.
-- TODO : Maybe make it use OCaml's Rational Number representation instead of IEEE floats.
*)
2D geometry primitives... |
8daff35adc060d445baefbf9b3df41ea6fca607a4d14cb77a20574158cf4c5cd | 2600hz/kazoo | kzd_flows.erl | %%%-----------------------------------------------------------------------------
( C ) 2010 - 2020 , 2600Hz
%%% @doc
This Source Code Form is subject to the terms of the Mozilla Public
License , v. 2.0 . If a copy of the MPL was not distributed with this
file , You can obtain one at /.
%%%
%%% @end
%%%--------... | null | https://raw.githubusercontent.com/2600hz/kazoo/24519b9af9792caa67f7c09bbb9d27e2418f7ad6/core/kazoo_documents/src/kzd_flows.erl | erlang | -----------------------------------------------------------------------------
@doc
@end
----------------------------------------------------------------------------- | ( C ) 2010 - 2020 , 2600Hz
This Source Code Form is subject to the terms of the Mozilla Public
License , v. 2.0 . If a copy of the MPL was not distributed with this
file , You can obtain one at /.
-module(kzd_flows).
-export([new/0]).
-export([featurecode/1, featurecode/2, set_featurecode/2]).
-export([featur... |
5b039a6bc340c1938dff4017f3d61bbd7f8b87de5790a241ab8f59f26bc4bd38 | yetanalytics/xapipe | async.clj | (ns com.yetanalytics.xapipe.util.async
"Useful Async facilities"
(:require [clojure.core.async :as a]
[clojure.spec.alpha :as s]
[com.yetanalytics.xapipe.metrics :as metrics]
[com.yetanalytics.xapipe.spec.common :as cspec]))
(s/def ::stateless-predicates
(s/map-of
keyword?
... | null | https://raw.githubusercontent.com/yetanalytics/xapipe/068ff021be1f0a543ebfdf2327b7e837013673ea/src/lib/com/yetanalytics/xapipe/util/async.clj | clojure | Send if the buffer is full
We've timed out. Flush!
We have a record
A is closed, we should close B
But only after draining anything in the buffer | (ns com.yetanalytics.xapipe.util.async
"Useful Async facilities"
(:require [clojure.core.async :as a]
[clojure.spec.alpha :as s]
[com.yetanalytics.xapipe.metrics :as metrics]
[com.yetanalytics.xapipe.spec.common :as cspec]))
(s/def ::stateless-predicates
(s/map-of
keyword?
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.