_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 |
|---|---|---|---|---|---|---|---|---|
2480d759429beb8232f16d227f51d6e0b762d03d8aad1b0c2ed757006717159f | xsc/base64-clj | core.clj | (ns ^{ :doc "Base64 Encoding/Decoding in Clojure."
:author "Yannick Scherer" }
base64-clj.core
(:use base64-clj.alphabet
base64-clj.utils)
(:import java.nio.ByteBuffer))
(set! *unchecked-math* true)
(set! *warn-on-reflection* true)
# # Encoding
;;
# # # Write Helpers
(defmacro write-base64
... | null | https://raw.githubusercontent.com/xsc/base64-clj/56a016526cb5ea9e2aed9fd89bc703a5a83c3547/src/base64_clj/core.clj | clojure |
## Decoding
| (ns ^{ :doc "Base64 Encoding/Decoding in Clojure."
:author "Yannick Scherer" }
base64-clj.core
(:use base64-clj.alphabet
base64-clj.utils)
(:import java.nio.ByteBuffer))
(set! *unchecked-math* true)
(set! *warn-on-reflection* true)
# # Encoding
# # # Write Helpers
(defmacro write-base64
"W... |
7a798b0343d4dade88f7db47d56994a6ea3cb5005a1cfad99aea21e3d7ba5420 | static-analysis-engineering/codehawk | jCHArrayInstantiation.ml | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
CodeHawk Java Analyzer
Author :
------------------------------------------------------------------------------
The MIT License ( MIT )
... | null | https://raw.githubusercontent.com/static-analysis-engineering/codehawk/98ced4d5e6d7989575092df232759afc2cb851f6/CodeHawk/CHJ/jchlib/jCHArrayInstantiation.ml | ocaml | jchlib | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
CodeHawk Java Analyzer
Author :
------------------------------------------------------------------------------
The MIT License ( MIT )
... |
2c29d97b8fbc77745869ad22537f30c9ac7b0b90505b45b44e9982a5f65f54df | Mathieu-Desrochers/Schemings | http-server-intern.scm | (import srfi-1)
(import (chicken condition))
(declare (unit http-server-intern))
(declare (uses exceptions))
(declare (uses fastcgi))
(declare (uses json))
(declare (uses regex))
(declare (uses validation))
;; invokes a procedure with compiled http binding regexes
(: with-compiled-http-binding-regexes
(forall (r)... | null | https://raw.githubusercontent.com/Mathieu-Desrochers/Schemings/3df7c8f8589a1c9c4135a3ae4c1bab3244e6444c/sources/units/http-server-intern.scm | scheme | invokes a procedure with compiled http binding regexes
searches for a http binding matching a request
invokes a procedure with validation errors exception handling
formats a list of validation errors | (import srfi-1)
(import (chicken condition))
(declare (unit http-server-intern))
(declare (uses exceptions))
(declare (uses fastcgi))
(declare (uses json))
(declare (uses regex))
(declare (uses validation))
(: with-compiled-http-binding-regexes
(forall (r) (
(list-of (struct http-binding)) ((list-of (struct r... |
95d26ec50db05536c6aa648c9449f5bb027ffb827fdcaa5a305791cda99461ac | tmprender/texy | codegen-hello.ml | Code generation : translate takes a semantically checked AST and
produces LLVM IR
LLVM tutorial : Make sure to read the OCaml version of the tutorial
Detailed documentation on the OCaml LLVM library :
/
/
produces LLVM IR
LLVM tutorial: Make sure to read the OCaml version of the tutorial
Detai... | null | https://raw.githubusercontent.com/tmprender/texy/e9bf4c9195aa7b590e8c5f3f7291f6e6005071b6/codegen-hello.ml | ocaml | Create an LLVM module -- this is a "container" into which we'll
generate actual code
declare i32 @printf(i8*, ...)
int main() {} -----> define i32 @main() {}
An LLVM "instruction builder" points to a basic block.
* Adding a new instruction mutates both the_module and builder.
Throw an exception ... | Code generation : translate takes a semantically checked AST and
produces LLVM IR
LLVM tutorial : Make sure to read the OCaml version of the tutorial
Detailed documentation on the OCaml LLVM library :
/
/
produces LLVM IR
LLVM tutorial: Make sure to read the OCaml version of the tutorial
Detai... |
39748a5446d85854232829dcf233557055595b10df1c44d10e26e7e6752f1735 | deadcode/Learning-CL--David-Touretzky | 10.10.lisp | (defun ntack (x sym)
(setf (cdr (last x)) sym))
(let* ((sample-list ''(fee fie foe))
(sym ''(fum))
(test1 (list 'ntack sample-list sym)))
(format t "~&sample-list = ~s, sym = ~s" sample-list sym)
(format t "~&Testing ~s" test1)
(eval test1)
(format t "~&sample-list = ~s, sym = ~s" samp... | null | https://raw.githubusercontent.com/deadcode/Learning-CL--David-Touretzky/b4557c33f58e382f765369971e6a4747c27ca692/Chapter%2010/10.10.lisp | lisp | (defun ntack (x sym)
(setf (cdr (last x)) sym))
(let* ((sample-list ''(fee fie foe))
(sym ''(fum))
(test1 (list 'ntack sample-list sym)))
(format t "~&sample-list = ~s, sym = ~s" sample-list sym)
(format t "~&Testing ~s" test1)
(eval test1)
(format t "~&sample-list = ~s, sym = ~s" samp... | |
e2a98c4b4d0a6cba133c610d4124815762977f8eb00165e682e9945f6daef24d | alex-gutev/cl-form-types | block-types.lisp | ;;;; block-types.lisp
;;;;
Copyright 2021 < >
;;;;
;;;; Permission is hereby granted, free of charge, to any person
;;;; obtaining a copy of this software and associated documentation
files ( the " Software " ) , to deal in the Software without
;;;; restriction, including without limitation the rights to use,
;;... | null | https://raw.githubusercontent.com/alex-gutev/cl-form-types/fc3647c948f060fb0faea4ff4409a589c4e6e168/src/block-types.lisp | lisp | block-types.lisp
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
Software is furnished to do so, subject to th... | Copyright 2021 < >
files ( the " Software " ) , to deal in the Software without
copies of the Software , and to permit persons to whom the
included in all copies or substantial portions of the Software .
THE SOFTWARE IS PROVIDED " AS IS " , WITHOUT WARRANTY OF ANY KIND ,
Determining the type of CL : BLO... |
6b4290481833f5e60c212d4dc9b58ec52a3844e973ee5a13638089b5fe9f81e9 | sixthnormal/clj-3df | core_test.cljc | (ns clj-3df.core-test
(:require
#?(:clj [clojure.test :refer [deftest is testing run-tests]]
:cljs [cljs.test :refer-macros [deftest is testing run-tests]])
[clj-3df.core :as df :refer [exec! create-debug-conn!
create-db-inputs query register interest transact]]))
(defn- ... | null | https://raw.githubusercontent.com/sixthnormal/clj-3df/7dfb89a438f9fb1a3c5d0d356f05acf3f9c51177/test/clj_3df/core_test.cljc | clojure | between tests to avoid interference
Naming guidelines: Tests in here should be named in such a way,
user-facing query engine features.
(query db name '[:find ?e1 ?e2 :where [?e1 :name ?n1] [?e2 :name ?n2]]) | (ns clj-3df.core-test
(:require
#?(:clj [clojure.test :refer [deftest is testing run-tests]]
:cljs [cljs.test :refer-macros [deftest is testing run-tests]])
[clj-3df.core :as df :refer [exec! create-debug-conn!
create-db-inputs query register interest transact]]))
(defn- ... |
3721db8bb45100e55e02e226eb6d6d29c7ef9de667e3708508bc94943925b39b | fourmolu/fourmolu | fancy-forall-1-four-out.hs | magnify ::
forall outertag innertag t outer inner m a.
( forall x. Coercible (t m x) (m x)
, forall m'.
(HasReader outertag outer m') =>
HasReader innertag inner (t m')
, HasReader outertag outer m
) =>
(forall m'. (HasReader innertag inner m') => m' a) ->
m a
| null | https://raw.githubusercontent.com/fourmolu/fourmolu/f47860f01cb3cac3b973c5df6ecbae48bbb4c295/data/examples/declaration/value/function/fancy-forall-1-four-out.hs | haskell | magnify ::
forall outertag innertag t outer inner m a.
( forall x. Coercible (t m x) (m x)
, forall m'.
(HasReader outertag outer m') =>
HasReader innertag inner (t m')
, HasReader outertag outer m
) =>
(forall m'. (HasReader innertag inner m') => m' a) ->
m a
| |
9f9615a5cb3363a53f31a3e876d4250edcfdf2d618887c297e4f6d5ad79e785b | binaryage/chromex | terminal_private.clj | (ns chromex.ext.terminal-private
" * available since Chrome 36"
(:refer-clojure :only [defmacro defn apply declare meta let partial])
(:require [chromex.wrapgen :refer [gen-wrap-helper]]
[chromex.callgen :refer [gen-call-helper gen-tap-all-events-call]]))
(declare api-table)
(declare gen-call)
-... | null | https://raw.githubusercontent.com/binaryage/chromex/33834ba5dd4f4238a3c51f99caa0416f30c308c5/src/exts_private/chromex/ext/terminal_private.clj | clojure | -- events -----------------------------------------------------------------------------------------------------------------
docs: /#tapping-events
-- convenience ------------------------------------------------------------------------------------------------------------
--------------------------------------------... | (ns chromex.ext.terminal-private
" * available since Chrome 36"
(:refer-clojure :only [defmacro defn apply declare meta let partial])
(:require [chromex.wrapgen :refer [gen-wrap-helper]]
[chromex.callgen :refer [gen-call-helper gen-tap-all-events-call]]))
(declare api-table)
(declare gen-call)
-... |
bf61060ff1de84fb4f2fa8eb3e49ecd0b2904a45e9ae01ee056c9cf26be4557d | jackrusher/geometer | lsystem.cljs | (ns geometer.lsystem
(:require [geometer.turtle :as t]))
This is an example of a classic string re - writing L - System
;; implemented in terms of geometer's 3D turtle. It's included here
;; for completeness, but I personally find coding directly to the
;; turtle using functions to represent rules and higher order... | null | https://raw.githubusercontent.com/jackrusher/geometer/b854b1d8d2f097d0be29499b1926a664754b516c/src/cljs/geometer/lsystem.cljs | clojure | implemented in terms of geometer's 3D turtle. It's included here
for completeness, but I personally find coding directly to the
turtle using functions to represent rules and higher order
functions (map, reduce, &c) to handle recursion much clearer and
more satisfying.
See: geometer.turtle/plant for an example. | (ns geometer.lsystem
(:require [geometer.turtle :as t]))
This is an example of a classic string re - writing L - System
(defn expand-l-system
"Recursively expand a L-System grammar into a sequence of operations."
[rules curr-state depth]
(if (zero? depth)
curr-state
(mapcat #(expand-l-system rules (... |
2d4fd82b2e9a99ff11ff911377440b9799d0c0af8f929dea290ec0958739c614 | gpwwjr/LISA | mycin.lisp | This file is part of LISA , the Lisp - based Intelligent Software
;;; Agents platform.
Copyright ( C ) 2000
;;; 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 2.... | null | https://raw.githubusercontent.com/gpwwjr/LISA/bc7f54b3a9b901d5648d7e9de358e29d3b794c78/misc/mycin.lisp | lisp | Agents platform.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
either version 2.1
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FI... | This file is part of LISA , the Lisp - based Intelligent Software
Copyright ( C ) 2000
of the License , or ( at your option ) any later version .
GNU Lesser General Public License for more details .
You should have received a copy of the GNU Lesser General Public License
Foundation , Inc. , 59 Temple... |
19a7a25d89e4d1fa0ef4e52896db7859396fdf7c4aaec17b29c4b2893b042976 | ryszard/Cl-Couch | conditions.lisp | (in-package :cl-couchdb-client)
(export '(couchdb-condition couchdb-server-error couchdb-conflict couchdb-not-found old-doc-of new-doc-of))
(defcondition* couchdb-condition ()
(number
error
reason)
(:report (lambda (con s)
(format s "CouchDB returned an error: ~a (~a). Reason: ~a." (error-of con) (num... | null | https://raw.githubusercontent.com/ryszard/Cl-Couch/de6900e38395dac3ddce53876b05d5e24c8d8f52/client/conditions.lisp | lisp | This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute i... | (in-package :cl-couchdb-client)
(export '(couchdb-condition couchdb-server-error couchdb-conflict couchdb-not-found old-doc-of new-doc-of))
(defcondition* couchdb-condition ()
(number
error
reason)
(:report (lambda (con s)
(format s "CouchDB returned an error: ~a (~a). Reason: ~a." (error-of con) (num... |
a5d302f0d43e6aa18c4c61a59210180d8792ae586048a1fd66a0971a8608e383 | openmusic-project/OMChroma | formant-data.lisp | ;=====================================================
; CHROMA
;=====================================================
part of the OMChroma library
- > High - level control of sound synthesis in OM
;=====================================================
;
;This program is free software; you can redistribute it and/... | null | https://raw.githubusercontent.com/openmusic-project/OMChroma/5ded34f22b59a1a93ea7b87e182c9dbdfa95e047/sources/chroma/models/formant-data.lisp | lisp | =====================================================
CHROMA
=====================================================
=====================================================
This program is free software; you can redistribute it and/or
either version 2
of the License, or (at your option) any later version.
See file LIC... | part of the OMChroma library
- > High - level control of sound synthesis in OM
modify it under the terms of the GNU General Public License
to deal with data from formant analysis ( from AudioSculpt )
(in-package :cr)
(defclass formant-data (additive-data)
()
(:documentation "Formant analysis data in Ram"))
... |
ca5f7ddb3b9c5972ca3fb082395d8cc74d1e92f23b700e7897e603d46bc994fa | sqor/riak-tools | riak_plugin.erl | -module(riak_plugin).
-compile(export_all).
%-export([postcommit_s3/1]).
-include_lib("riak_plugin.hrl").
configure() ->
erlcloud_s3:configure(?ACCESS_KEY, ?SECRET_ACCESS_KEY).
crdt_key_value(RObj) ->
Key = riak_object:key(RObj),
{map,V1} = riak_kv_crdt:value(RObj),
V2 = [{X,Y} || {{X,_Z},Y} <- V1],
... | null | https://raw.githubusercontent.com/sqor/riak-tools/1d6c964bf789711534f078ba8c8a600a6ab4eda3/plugins/src/riak_plugin.erl | erlang | -export([postcommit_s3/1]).
R = erlcloud_s3:put_object(?BUCKET, Key, Value, [], [{"Content-type", "application/x-gzip"}]),
---------------------------------------------------------------------------------------- | -module(riak_plugin).
-compile(export_all).
-include_lib("riak_plugin.hrl").
configure() ->
erlcloud_s3:configure(?ACCESS_KEY, ?SECRET_ACCESS_KEY).
crdt_key_value(RObj) ->
Key = riak_object:key(RObj),
{map,V1} = riak_kv_crdt:value(RObj),
V2 = [{X,Y} || {{X,_Z},Y} <- V1],
V3 = jsx:encode(V2),
... |
af4910b2544593b9751d48b23d46ce748842ec22910ac773e3ba0af3d50bb434 | jeromesimeon/Galax | resolve_stream_context.mli | (***********************************************************************)
(* *)
(* GALAX *)
(* XQuery Engine *)
(* ... | null | https://raw.githubusercontent.com/jeromesimeon/Galax/bc565acf782c140291911d08c1c784c9ac09b432/streaming/resolve_stream_context.mli | ocaml | *********************************************************************
GALAX
XQuery Engine
... | Copyright 2001 - 2007 .
$ I d : resolve_stream_context.mli , v 1.7 2007/08/17 18:28:54 simeon Exp $
type ts_context
val build_ts_context : unit -> ts_context
val get_nsenv : ts_context -> Namespace_context.nsenv
val pop_nsenv : ts_context -> unit
val push... |
d93e3598cf9124fce4578f2c69ff66377b15a612a0ef2cd2e563a128cb42bab5 | aspiwack/porcupine | FunflowRemoteCache.hs | {-# LANGUAGE FlexibleContexts #-}
# LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE OverloadedStrings #
module Data.Locations.FunflowRemoteCache
( locationCacher
, LiftCacher(..)
) where
import Control.Exception.Safe
import Control.Funflow.ContentHas... | null | https://raw.githubusercontent.com/aspiwack/porcupine/23dcba1523626af0fdf6085f4107987d4bf718d7/porcupine-core/src/Data/Locations/FunflowRemoteCache.hs | haskell | # LANGUAGE FlexibleContexts # | # LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE OverloadedStrings #
module Data.Locations.FunflowRemoteCache
( locationCacher
, LiftCacher(..)
) where
import Control.Exception.Safe
import Control.Funflow.ContentHashable (ContentHash, hashToPath)
import ... |
1ea8c5ce578731f0ae533fe42ce8d27ea7d6ef418ff1653c0b2e4aa28b319b59 | racket/scribble | output.rkt | #lang racket/base
(require racket/promise
racket/contract/base)
(provide
special?
outputable/c
(contract-out
[output (->* (outputable/c) (output-port?) void?)]))
;; See also `provide-special` below
;; Outputs values for the `scribble/text' language:
;; - several atomic values are printed as in `display... | null | https://raw.githubusercontent.com/racket/scribble/beb2d9834169665121d34b5f3195ddf252c3c998/scribble-text-lib/scribble/text/output.rkt | racket | See also `provide-special` below
Outputs values for the `scribble/text' language:
- several atomic values are printed as in `display',
- promises, thunks, and boxes are indirections for the value they contain
(useful in various cases),
- some "special" values are used for controlling output (eg, flushing,
pr... | #lang racket/base
(require racket/promise
racket/contract/base)
(provide
special?
outputable/c
(contract-out
[output (->* (outputable/c) (output-port?) void?)]))
this case the line prefix can have ( cons ) so it can be restored --
(define (output x [p (current-output-port)])
(define pfxs (port->s... |
24ffb577c134c1822fdee3a7008877ff208ae7e8514e4305c2a0c4f5fc3581b9 | litaocheng/erl-test | util.erl | -module(util).
-compile([export_all]).
do_with_statis(Label, Fun, Acc) ->
do_with_statis(Label, Fun, Acc, 1).
do_with_statis(Label, Fun, Acc, N) ->
erlang:garbage_collect(self()),
{memory, MP1} = erlang:process_info(self(), memory),
MT1 = erlang:memory(total),
T1 = now(),
{_, _} = erlang:statis... | null | https://raw.githubusercontent.com/litaocheng/erl-test/893679fccb1c16dda45d40d2b9e12d78db991b8a/util/util.erl | erlang | 执行多次 | -module(util).
-compile([export_all]).
do_with_statis(Label, Fun, Acc) ->
do_with_statis(Label, Fun, Acc, 1).
do_with_statis(Label, Fun, Acc, N) ->
erlang:garbage_collect(self()),
{memory, MP1} = erlang:process_info(self(), memory),
MT1 = erlang:memory(total),
T1 = now(),
{_, _} = erlang:statis... |
aa4c5f358ee0946f1c6b8fb9a9415860a70393f5f6cdbf71fabd6cef19d2b799 | vilmibm/murepl | events.clj | (ns murepl.events
(:require [murepl.common :refer :all]
[murepl.core :as core]))
(defn send-msg [player msg]
Invokes player 's send - function function .
(if-let [send-function (:send-function player)]
(send-function msg)))
(defn notify-players [players msg]
(println "Sending:" msg)
(doseq... | null | https://raw.githubusercontent.com/vilmibm/murepl/74ee5979ef2f09301103d0281b35a7e226bc1997/src/murepl/events.clj | clojure | (ns murepl.events
(:require [murepl.common :refer :all]
[murepl.core :as core]))
(defn send-msg [player msg]
Invokes player 's send - function function .
(if-let [send-function (:send-function player)]
(send-function msg)))
(defn notify-players [players msg]
(println "Sending:" msg)
(doseq... | |
8aa28eb8bb5f47b3394a5b094bfe3d4b18a9dce648fd7921eb7b3cb98220606f | Quickscript-Competiton/July2020entries | cve-search.rkt | #lang racket/base
(require quickscript)
(require racket/string)
(require net/url)
(require json)
Author :
License : [ Apache License , Version 2.0]( / licenses / LICENSE-2.0 ) or
[ MIT license]( / licenses / MIT ) at your option .
;;; From: -Competiton/July2020entries/issues/12
(script-help-string ... | null | https://raw.githubusercontent.com/Quickscript-Competiton/July2020entries/b6406a4f021671bccb6b464042ba6c91221286fe/scripts/cve-search.rkt | racket | From: -Competiton/July2020entries/issues/12
e.g. -2010-3333
I think I could make this more efficient but it seems the vast bulk of the time is in the network request (as you'd expect)
I'd like to have the references render as links | #lang racket/base
(require quickscript)
(require racket/string)
(require net/url)
(require json)
Author :
License : [ Apache License , Version 2.0]( / licenses / LICENSE-2.0 ) or
[ MIT license]( / licenses / MIT ) at your option .
(script-help-string "A function to help you gather CVE information,
... |
3cae5daf53def2e64870467f1601add1d638be2b5cc8c1e5ecd287a07db961ee | gergoerdi/clash-shake | Intel.hs | # LANGUAGE OverloadedStrings , RecordWildCards , TemplateHaskell #
module Clash.Shake.Intel
( Target(..)
, de0Nano, arrowDeca
, quartus
) where
import Clash.Shake
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Config
import Text.M... | null | https://raw.githubusercontent.com/gergoerdi/clash-shake/2f58c5522b1db62ab1d4000b06fda0197efc6adf/src/Clash/Shake/Intel.hs | haskell | # LANGUAGE OverloadedStrings , RecordWildCards , TemplateHaskell #
module Clash.Shake.Intel
( Target(..)
, de0Nano, arrowDeca
, quartus
) where
import Clash.Shake
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Config
import Text.M... | |
ed0934a6d9603d0f2299ce146f891468ebd4e3e1da23425fc48c354829cd16f4 | ghc/nofib | Rewritefns.hs |
Haskell version of ...
! rewrite functions for benchmark
! Started by on 30 March 1988
! Changes Log
! 08 - 04 - 88 ADK bug fix = rewrite(Atom(x),A ) returns Atom(x ) not Nil
! 25 - 05 - 88 ADK added applysubst to this module and assoclist replaced by LUT
Haskell version :
23 - 06 - 93 ... | null | https://raw.githubusercontent.com/ghc/nofib/f34b90b5a6ce46284693119a06d1133908b11856/spectral/boyer2/Rewritefns.hs | haskell |
Haskell version of ...
! rewrite functions for benchmark
! Started by on 30 March 1988
! Changes Log
! 08 - 04 - 88 ADK bug fix = rewrite(Atom(x),A ) returns Atom(x ) not Nil
! 25 - 05 - 88 ADK added applysubst to this module and assoclist replaced by LUT
Haskell version :
23 - 06 - 93 ... | |
e758c15e3e251f1005e38346197dcd3fb71af0c1fad3129d5e8f8622d40c33d4 | larcenists/larceny | while3.scm | (text
(while (< edx 20)
(begin
(iter (seq (pop ebx)
(!= ebx 4)
(add eax ebx)))
(add edx eax))))
; iter is sometimes better for inner loops, since both
; while and until always generate a jmp at their start
; to the test (the test is placed after their body).
; When while or until start... | null | https://raw.githubusercontent.com/larcenists/larceny/fef550c7d3923deb7a5a1ccd5a628e54cf231c75/src/Lib/Sassy/tests/prims/while3.scm | scheme | iter is sometimes better for inner loops, since both
while and until always generate a jmp at their start
to the test (the test is placed after their body).
When while or until start the body of an outer while/until
that means a jmp or jcc to a jmp will be generated.
Using iter for the inner loop fixes this.... | (text
(while (< edx 20)
(begin
(iter (seq (pop ebx)
(!= ebx 4)
(add eax ebx)))
(add edx eax))))
00000000 EB0C short 0xe
00000002 5B pop ebx
00000003 83FB04 cmp ebx , byte +0x4
00000006 7404 jz 0xc
0000000... |
841beeb481bac376a21edcb64492e7f9a0cd25db7f1a12eafeb23a4db1a374a6 | tonyday567/chart-unit | Core.hs | # LANGUAGE NoImplicitPrelude #
{-# LANGUAGE RankNTypes #-}
# LANGUAGE FlexibleContexts #
{-# LANGUAGE GADTs #-}
# LANGUAGE NegativeLiterals #
# OPTIONS_GHC -Wall #
# OPTIONS_GHC -fno - warn - orphans #
# LANGUAGE CPP #
# LANGUAGE DeriveGeneric #
# LANGUAGE ViewPatterns #
#if ( __GLASGOW_HASKELL__ < 820 )
# OPTIONS_GHC ... | null | https://raw.githubusercontent.com/tonyday567/chart-unit/5c0aefee55383b7f2dc3d0745dc92f0bd9b0f24a/chart-unit/src/Chart/Core.hs | haskell | # LANGUAGE RankNTypes #
# LANGUAGE GADTs #
- the size of the chart rendered as an image. Backends tend to shrink charts to fit the rectangle shape specified in the render function, and a loose sympathy is expected between the aspect and a chart's ultimate physical size.
> withHud
> defaultHudOptions
... | # LANGUAGE NoImplicitPrelude #
# LANGUAGE FlexibleContexts #
# LANGUAGE NegativeLiterals #
# OPTIONS_GHC -Wall #
# OPTIONS_GHC -fno - warn - orphans #
# LANGUAGE CPP #
# LANGUAGE DeriveGeneric #
# LANGUAGE ViewPatterns #
#if ( __GLASGOW_HASKELL__ < 820 )
# OPTIONS_GHC -fno - warn - incomplete - patterns #
#endif
| I... |
78d09fb53c11a41056cac6f040d18a3d33d056351205c161444551395a30ea9e | fogus/bacwn | magic.cljs | Copyright ( c ) . All rights reserved . The use and
;; distribution terms for this software are covered by the Eclipse Public
;; License 1.0 (-1.0.php) which can
;; be found in the file epl-v10.html at the root of this distribution. By
;; using this software in any fashion, you are agreeing to be bound by t... | null | https://raw.githubusercontent.com/fogus/bacwn/8aa39b6683db1772aedb7a0ecd7aa6372b72b231/src/clojurescript/fogus/datalog/bacwn/impl/magic.cljs | clojure | distribution terms for this software are covered by the Eclipse Public
License 1.0 (-1.0.php) which can
be found in the file epl-v10.html at the root of this distribution. By
using this software in any fashion, you are agreeing to be bound by the
terms of this license. You must not remove this notice, or an... | Copyright ( c ) . All rights reserved . The use and
A Clojure implementation of Datalog -- Magic Sets
straszheimjeffrey ( gmail )
Created 18 Feburary 2009
Converted to Clojure1.4 by 2012 .
(ns fogus.datalog.bacwn.impl.magic
(:require [fogus.datalog.bacwn.impl.util :as util]
[fogus.da... |
855626025d91efe47f28f7790d2622744279db17a59587b3caf3ff127f1885ad | plewto/Cadejo | matrix_editor.clj | (ns cadejo.instruments.alias.editor.matrix-editor
(:require [cadejo.instruments.alias.constants :as constants])
(:require [cadejo.ui.instruments.subedit :as subedit])
(:require [cadejo.ui.util.lnf :as lnf])
(:require [cadejo.ui.util.sgwr-factory :as sfactory])
(:require [cadejo.util.math :as math])
(:requir... | null | https://raw.githubusercontent.com/plewto/Cadejo/2a98610ce1f5fe01dce5f28d986a38c86677fd67/src/cadejo/instruments/alias/editor/matrix_editor.clj | clojure | Returns sgwr multi-state button for selection of general matrix bus
Places matrix routing overview onto sgwr drawing
Returns function to update overview
' ignore
not implemented | (ns cadejo.instruments.alias.editor.matrix-editor
(:require [cadejo.instruments.alias.constants :as constants])
(:require [cadejo.ui.instruments.subedit :as subedit])
(:require [cadejo.ui.util.lnf :as lnf])
(:require [cadejo.ui.util.sgwr-factory :as sfactory])
(:require [cadejo.util.math :as math])
(:requir... |
a7bf077860cffad375b68400c684f003ee80d12ce8b6a3a05a605e92010dbc43 | andys8/git-brunch | Spec.hs | import Data.Text (Text)
import Git
import Test.Hspec
main :: IO ()
main = hspec $
describe "Git.toBranch" $ do
it "returns a remote branch is starts with remote" $ do
toBranches "remotes/origin/master" `shouldBe` [BranchRemote "origin" "master"]
it "ignores leading spaces" $ do
toBranches " mas... | null | https://raw.githubusercontent.com/andys8/git-brunch/fe1989c82a912d689cd23bf8fbdd4cb6927d40a9/test/Spec.hs | haskell | import Data.Text (Text)
import Git
import Test.Hspec
main :: IO ()
main = hspec $
describe "Git.toBranch" $ do
it "returns a remote branch is starts with remote" $ do
toBranches "remotes/origin/master" `shouldBe` [BranchRemote "origin" "master"]
it "ignores leading spaces" $ do
toBranches " mas... | |
68e9ee67396a5efb961c6323377b7975dbcaac93bda413b0d051f61317ca8c4a | erlware/erlware_commons | ec_git_vsn.erl | %%% vi:ts=4 sw=4 et
%%%-------------------------------------------------------------------
@author < >
2011 Erlware , LLC .
%%% @doc
%%% This provides an implementation of the ec_vsn for git. That is
%%% it is capable of returning a semver for a git repository
%%% see ec_vsn
%%% see ec_semver
%%% @end
%%%----... | null | https://raw.githubusercontent.com/erlware/erlware_commons/ad559ae1f5f4cabdcc59899e20f4d3db78177574/src/ec_git_vsn.erl | erlang | vi:ts=4 sw=4 et
-------------------------------------------------------------------
@doc
This provides an implementation of the ec_vsn for git. That is
it is capable of returning a semver for a git repository
see ec_vsn
see ec_semver
@end
-------------------------------------------------------------------
API... | @author < >
2011 Erlware , LLC .
-module(ec_git_vsn).
-behaviour(ec_vsn).
-export([new/0,
vsn/1]).
-export_type([t/0]).
-type t() :: {}.
-spec new() -> t().
new() ->
{}.
-spec vsn(t()|string()) -> {ok, string()} | {error, Reason::any()}.
vsn(Data) ->
{Vsn, RawRef, RawCount} = collect_def... |
693969586eab37028ac0b9957ce589a44240ac1ccd8537f8d9959f0511341d86 | UChicago-PL/smyth | timer.mli | (** A collection of timers used to cut off program execution early. *)
module Single : sig
(** The available single timers. *)
type t =
| Total (** The timer for the total synthesis time. *)
| Eval (** The timer for live evaluation and resumption. *)
val start : t -> unit
(** Starts the timer. *)
v... | null | https://raw.githubusercontent.com/UChicago-PL/smyth/08fea281f70d3ee604fde9dde140c8a570d6905d/lib/smyth/timer.mli | ocaml | * A collection of timers used to cut off program execution early.
* The available single timers.
* The timer for the total synthesis time.
* The timer for live evaluation and resumption.
* Starts the timer.
* Returns how much time has elapsed since starting the timer.
* Returns [true] if the timer is still runnin... |
module Single : sig
type t =
val start : t -> unit
val elapsed : t -> float
val check : t -> bool
end
module Multi : sig
type t =
val reset : t -> unit
val accumulate : t -> (unit -> 'a) -> 'a
val check : t -> bool
end
val itimer_timeout :
string ->
float ->
('a -> 'b) ->
'a ->
'b ->
... |
b52f9e5f391d97cfc80d609311348acbb03f935b93b37d7bb181f99d96894219 | input-output-hk/plutus | Mark.hs | -- editorconfig-checker-disable-file
module PlutusCore.Mark
( markNonFreshTerm
, markNonFreshType
, markNonFreshProgram
) where
import Data.Set.Lens (setOf)
import PlutusCore.Core
import PlutusCore.Name
import PlutusCore.Quote
-- | Marks all the 'Unique's in a type as used, so they will not be generat... | null | https://raw.githubusercontent.com/input-output-hk/plutus/cbd5f37288eb06738be28fc49af6a6b612e6c5fc/plutus-core/plutus-core/src/PlutusCore/Mark.hs | haskell | editorconfig-checker-disable-file
| Marks all the 'Unique's in a type as used, so they will not be generated in future. Useful if you
have a type which was not generated in 'Quote'.
| Marks all the 'Unique's in a term as used, so they will not be generated in future. Useful if you
have a term which was not generat... | module PlutusCore.Mark
( markNonFreshTerm
, markNonFreshType
, markNonFreshProgram
) where
import Data.Set.Lens (setOf)
import PlutusCore.Core
import PlutusCore.Name
import PlutusCore.Quote
markNonFreshType
:: (HasUniques (Type tyname uni ann), MonadQuote m)
=> Type tyname uni ann -> m ()
mark... |
09f0f258444f5767b5fb6186ebe92419c9f5965ad294a70bb64f67c29fae7fde | haskell-repa/repa | Chunked.hs |
module Data.Repa.Eval.Generic.Seq.Chunked
( fillLinear
, fillBlock2)
where
import GHC.Exts
-------------------------------------------------------------------------------
-- | Fill something sequentially.
--
-- * The array is filled linearly from start to finish.
--
fillLinear
:: (Int# ... | null | https://raw.githubusercontent.com/haskell-repa/repa/c867025e99fd008f094a5b18ce4dabd29bed00ba/repa-eval/Data/Repa/Eval/Generic/Seq/Chunked.hs | haskell | -----------------------------------------------------------------------------
| Fill something sequentially.
* The array is filled linearly from start to finish.
^ Update function to write into result buffer.
^ Function to get the value at a given index.
^ Number of elements to fill.
# INLINE [0] fillLinea... |
module Data.Repa.Eval.Generic.Seq.Chunked
( fillLinear
, fillBlock2)
where
import GHC.Exts
fillLinear
-> IO ()
fillLinear write getElem len
= fill 0#
where fill !ix
| 1# <- ix >=# len = return ()
| otherwise
= do write ix (getElem ix)
fill (i... |
35914e283feac15adc69a6add0caf99fa6590c373ab66c03fd11c080d765cc3b | paulbutcher/lein-lambda | handler_test.clj | (ns {{name}}.handler-test
(:require [clojure.test :refer :all]
[ring.mock.request :as mock]
[{{name}}.handler :refer :all]))
(deftest test-app
(testing "main route"
(let [response (app (mock/request :get "/hello"))]
(is (= (:status response) 200))
(is (= (:body response) "{\... | null | https://raw.githubusercontent.com/paulbutcher/lein-lambda/20398b6dadeb9679d7eb258d4c47b60cd8485ff7/template/resources/leiningen/new/lambda_api/handler_test.clj | clojure | (ns {{name}}.handler-test
(:require [clojure.test :refer :all]
[ring.mock.request :as mock]
[{{name}}.handler :refer :all]))
(deftest test-app
(testing "main route"
(let [response (app (mock/request :get "/hello"))]
(is (= (:status response) 200))
(is (= (:body response) "{\... | |
678627fa29921b0830f1ef569d7ab94263fbc4dcfbedf6495921944a67e67081 | thepower/tpnode | genesis.erl | -module(genesis).
-export([genesis/0, new/2, new/1, settings/0, settings/1]).
genesis() ->
case file:consult(application:get_env(tpnode,genesis,"genesis.txt")) of
{ok, [Genesis]} ->
Genesis;
{error,enoent} ->
case file:read_file("genesis.bin") of
{ok, Bin} ->
block:unpack(Bin);
... | null | https://raw.githubusercontent.com/thepower/tpnode/8eb38eb7f6def0edcd12c63ff77cce1866dcdf4d/apps/tpnode/src/genesis.erl | erlang | URL of file, to download | -module(genesis).
-export([genesis/0, new/2, new/1, settings/0, settings/1]).
genesis() ->
case file:consult(application:get_env(tpnode,genesis,"genesis.txt")) of
{ok, [Genesis]} ->
Genesis;
{error,enoent} ->
case file:read_file("genesis.bin") of
{ok, Bin} ->
block:unpack(Bin);
... |
77ded6962d03abc0c94f54f6bc9692c4d1457801554e9fab9fe69a6dabf72a8e | ocamllabs/ocaml-modular-implicits | emitcode.mli | (***********************************************************************)
(* *)
(* OCaml *)
(* *)
, projet ... | null | https://raw.githubusercontent.com/ocamllabs/ocaml-modular-implicits/92e45da5c8a4c2db8b2cd5be28a5bec2ac2181f1/bytecomp/emitcode.mli | ocaml | *********************************************************************
OCaml
... | , projet Cristal , INRIA Rocquencourt
Copyright 1996 Institut National de Recherche en Informatique et
en Automatique . All rights reserved . This file is distributed
under the terms of the Q Public License version 1.0 .
Generation of bytecode for .cmo files... |
23a70b1190cf5c7a208b18cbf62aea8a31e6d14105ff7952de7e16ed3577bc5a | charlieg/Sparser | extend-edge.lisp | ;;; -*- Mode:LISP; Syntax:Common-Lisp; Package:(CTI-source LISP) -*-
copyright ( c ) 1991 Content Technologies Inc. -- all rights reserved
;;;
;;; File: "extend edge"
Module : " : names : companies "
version : 1.2 April 1991 ( v1.8.1 )
1.1 ( 4/3 ) Changed call to adapt to new company ind... | null | https://raw.githubusercontent.com/charlieg/Sparser/b9bb7d01d2e40f783f3214fc104062db3d15e608/Sparser/code/s/grammar/model/core/companies/extend-edge.lisp | lisp | -*- Mode:LISP; Syntax:Common-Lisp; Package:(CTI-source LISP) -*-
File: "extend edge"
edges.
construct a new edge, canibalizing the original
the extension is a list of name edges or their equivalent,
the tail may be a non-terminal name, in which case it has to be
unpacked. The pathway to look through f... | copyright ( c ) 1991 Content Technologies Inc. -- all rights reserved
Module : " : names : companies "
version : 1.2 April 1991 ( v1.8.1 )
1.1 ( 4/3 ) Changed call to adapt to new company indexing protocol
1.2 ( 4/4 ) fixed complications in the appending of extended and old
(in-package :CT... |
ad33f7aac8c79d98db4c32f0abe467aaf62d57cc63804400f1523df7a9662521 | haskell-nix/hnix-store | Parsers.hs | # language AllowAmbiguousTypes #
{-# language ScopedTypeVariables #-}
# language RankNTypes #
# language DataKinds #
module System.Nix.Store.Remote.Parsers
( parseContentAddressableAddress
)
where
import Data.Attoparsec.ByteString.Char8
import System.Nix.Hash
import ... | null | https://raw.githubusercontent.com/haskell-nix/hnix-store/5e55781516178939bf9a86f943e120e6ad775b9d/hnix-store-remote/src/System/Nix/Store/Remote/Parsers.hs | haskell | # language ScopedTypeVariables #
| Parser for content addressable field
| Parser for @fixed:<r?>:<ht>:<h>@ | # language AllowAmbiguousTypes #
# language RankNTypes #
# language DataKinds #
module System.Nix.Store.Remote.Parsers
( parseContentAddressableAddress
)
where
import Data.Attoparsec.ByteString.Char8
import System.Nix.Hash
import System.Nix.StorePath ( ... |
601faa130a1dd44dc1824d5a23eb8870641f1f71296aeebb089f634e82779c81 | life0fun/clojure-idiom | ants.clj | Ant sim ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
Copyright ( c ) . All rights reserved .
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 ()
; which can be found in the file CPL.TXT at the root of this distribution.
; By using t... | null | https://raw.githubusercontent.com/life0fun/clojure-idiom/481b297eeabea917a68b492b1fb78b8151408507/ants.clj | clojure | ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
The use and distribution terms for this software are covered by the
Common Public License 1.0 ()
which can be found in the file CPL.TXT at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
... | Copyright ( c ) . All rights reserved .
(def dim 80)
(def nants-sqrt 7)
(def food-places 35)
(def food-range 100)
(def pher-scale 20.0)
(def food-scale 30.0)
(def evap-rate 0.99)
(def animation-sleep-ms 100)
(def ant-sleep-ms 40)
(def evap-sleep-ms 1000)
(def running true)
alter ref 's state(cell 's stat... |
ec25a783caa966d5799565ad27c14a1e2326e21571f1ab3993e393a092500204 | Carnap/Carnap | Goldfarb.hs | # LANGUAGE FlexibleContexts , FlexibleInstances , MultiParamTypeClasses #
module Carnap.Languages.PureFirstOrder.Logic.Goldfarb where
import Text.Parsec
import Control.Lens (view)
import Carnap.Core.Data.Types (Form,Term)
import Carnap.Core.Data.Classes (lhs)
import Carnap.Languages.Util.LanguageClasses
import Car... | null | https://raw.githubusercontent.com/Carnap/Carnap/f02d6dc5b4790edfddaa07d75ee8617a5f6f8332/Carnap/src/Carnap/Languages/PureFirstOrder/Logic/Goldfarb.hs | haskell | ----------------------------------
----------------------------------
----------------------------------------------------------------------
----------------------------------------------------------------------
XXX: including v is important, since the memoization relies
hashing the rule, which relies on its show ins... | # LANGUAGE FlexibleContexts , FlexibleInstances , MultiParamTypeClasses #
module Carnap.Languages.PureFirstOrder.Logic.Goldfarb where
import Text.Parsec
import Control.Lens (view)
import Carnap.Core.Data.Types (Form,Term)
import Carnap.Core.Data.Classes (lhs)
import Carnap.Languages.Util.LanguageClasses
import Car... |
81ff7a69702317439f664dc5e33daa54e78a78228000abc420850f369f4fb96c | danlarkin/subrosa | project.clj | (defproject subrosa (.trim (slurp "etc/version.txt"))
:main subrosa.main
:repositories {"jboss"
"/"}
:resource-paths ["etc"]
:dependencies [[aleph "0.3.0-beta8"]
[log4j "1.2.16"]
[org.clojure/clojure "1.4.0"]
[org.clojure/tools.logging "0.2.4"]... | null | https://raw.githubusercontent.com/danlarkin/subrosa/b8e554ffc1b83572acbbb8f50704d3db44b3770f/project.clj | clojure | (defproject subrosa (.trim (slurp "etc/version.txt"))
:main subrosa.main
:repositories {"jboss"
"/"}
:resource-paths ["etc"]
:dependencies [[aleph "0.3.0-beta8"]
[log4j "1.2.16"]
[org.clojure/clojure "1.4.0"]
[org.clojure/tools.logging "0.2.4"]... | |
7dcbe594381e1d88cd2f358da4b779eeeef3b12a8f4200fbf01e22c4d884bb34 | input-output-hk/plutus-apps | HandlingBlockchainEvents.hs | # OPTIONS_GHC -fno - warn - unused - top - binds #
module HandlingBlockchainEvents() where
import Data.List.NonEmpty (NonEmpty)
import Ledger (CardanoAddress, TxId, TxOutRef)
import Plutus.ChainIndex (ChainIndexTx, TxStatus)
import Plutus.Contract (AsContractError, Contract)
import Plutus.Contract qualified as Contrac... | null | https://raw.githubusercontent.com/input-output-hk/plutus-apps/cd70d8acbde66c0f9a637d6b114cb6ca8bc4bb31/doc/plutus/tutorials/HandlingBlockchainEvents.hs | haskell | BLOCK1
BLOCK2
| Wait for the status of a transaction to change
BLOCK5 | # OPTIONS_GHC -fno - warn - unused - top - binds #
module HandlingBlockchainEvents() where
import Data.List.NonEmpty (NonEmpty)
import Ledger (CardanoAddress, TxId, TxOutRef)
import Plutus.ChainIndex (ChainIndexTx, TxStatus)
import Plutus.Contract (AsContractError, Contract)
import Plutus.Contract qualified as Contrac... |
35856c41a1cc4ffa27fdffd8b9857900faa1f653f38e00e3a094697d152dcf34 | parapluu/Concuerror | depend_5.erl | -module(depend_5).
-export([depend_5/0]).
-export([scenarios/0]).
scenarios() -> [{?MODULE, inf, dpor}].
depend_5() ->
ets:new(table, [public, named_table]),
ets:insert(table, {x, 0}),
ets:insert(table, {y, 0}),
ets:insert(table, {z, 0}),
spawn(fun() -> ets:insert(table, {z, 1}) end),
spawn(f... | null | https://raw.githubusercontent.com/parapluu/Concuerror/152a5ccee0b6e97d8c3329c2167166435329d261/tests/suites/dpor_tests/src/depend_5.erl | erlang | -module(depend_5).
-export([depend_5/0]).
-export([scenarios/0]).
scenarios() -> [{?MODULE, inf, dpor}].
depend_5() ->
ets:new(table, [public, named_table]),
ets:insert(table, {x, 0}),
ets:insert(table, {y, 0}),
ets:insert(table, {z, 0}),
spawn(fun() -> ets:insert(table, {z, 1}) end),
spawn(f... | |
138e2ce1942f8a4589b02a35914ade8837ec9a084cedd5a521ad357ea57d5149 | konn/smooth | Types.hs | # LANGUAGE MonoLocalBinds #
# LANGUAGE ScopedTypeVariables #
module Numeric.Algebra.Smooth.Types (Vec, UVec, convVec) where
import Data.Sized (Sized)
import qualified Data.Sized as SV
import Data.Vector (Vector)
import qualified Data.Vector.Generic as G
import qualified Data.Vector.Unboxed as U
import GHC.TypeNats (K... | null | https://raw.githubusercontent.com/konn/smooth/ce47287f6277f54b42a87df9ff2a444f185cde87/src/Numeric/Algebra/Smooth/Types.hs | haskell | # LANGUAGE MonoLocalBinds #
# LANGUAGE ScopedTypeVariables #
module Numeric.Algebra.Smooth.Types (Vec, UVec, convVec) where
import Data.Sized (Sized)
import qualified Data.Sized as SV
import Data.Vector (Vector)
import qualified Data.Vector.Generic as G
import qualified Data.Vector.Unboxed as U
import GHC.TypeNats (K... | |
e6b61e03079b57306454fc5b818327c1a63e3796707c249907fd1c38a97b064c | fukamachi/fukacl | macro.lisp | (in-package :fukacl)
(defun g!-symbol-p (s)
(if (symbolp s)
(let ((str (symbol-name s)))
(string= str "#" :start1 (1- (length str))))))
(defun o!-symbol-p (s)
(if (symbolp s)
(let ((str (symbol-name s)))
(string= str "%" :start1 (1- (length str))))))
(defun o!-symbol-to-g!-symbol (s)
... | null | https://raw.githubusercontent.com/fukamachi/fukacl/c633005755c4273dbee3aef54a8d86a8fbecc6f5/macro.lisp | lisp | (in-package :fukacl)
(defun g!-symbol-p (s)
(if (symbolp s)
(let ((str (symbol-name s)))
(string= str "#" :start1 (1- (length str))))))
(defun o!-symbol-p (s)
(if (symbolp s)
(let ((str (symbol-name s)))
(string= str "%" :start1 (1- (length str))))))
(defun o!-symbol-to-g!-symbol (s)
... | |
97b6d46541dc831aedc4842621df7b10e6a298523aff18728535016e01e7db61 | aggelgian/erlang-algorithms | dfs_demo.erl | -module(dfs_demo).
-export([s1/0, s2/0]).
-spec s1() -> ok.
s1() ->
Root = 0,
G = graph_demo:g1(),
DFS = dfs:run(G, Root),
io:format("~p~n", [DFS]).
-spec s2() -> ok.
s2() ->
Root = "a",
G = graph_demo:g4(),
DFS = dfs:run(G, Root),
io:format("~p~n", [DFS]).
| null | https://raw.githubusercontent.com/aggelgian/erlang-algorithms/8ceee72146f2a6eff70a16e3e9a74d2ed072fa0a/demo/src/dfs_demo.erl | erlang | -module(dfs_demo).
-export([s1/0, s2/0]).
-spec s1() -> ok.
s1() ->
Root = 0,
G = graph_demo:g1(),
DFS = dfs:run(G, Root),
io:format("~p~n", [DFS]).
-spec s2() -> ok.
s2() ->
Root = "a",
G = graph_demo:g4(),
DFS = dfs:run(G, Root),
io:format("~p~n", [DFS]).
| |
acaf703b0bccfd640fe4e629340f25aabb2fdd0ddc396f9b5e9921ab2687c039 | jwiegley/hierarchy | Hierarchy.hs | {-# LANGUAGE RankNTypes #-}
# LANGUAGE ScopedTypeVariables #
module Hierarchy where
import Control.Monad
import Control.Comonad.Trans.Cofree
import Control.Cond
-- | A 'TreeT' is a tree of values, where the (possible) branches are
represented by some MonadPlus ' m ' .
type TreeT m = CofreeT Maybe m
-- | Turn a ... | null | https://raw.githubusercontent.com/jwiegley/hierarchy/8c1a730605fef59e655c258684e89f5a7151d275/src/Hierarchy.hs | haskell | # LANGUAGE RankNTypes #
| A 'TreeT' is a tree of values, where the (possible) branches are
| Turn a list into a series of possibilities:
possible associated trees.
| Perform a depth-first traversal of a 'TreeT', yielding each of its
contents. Note that breadth-first traversals cannot offer static memory
gua... | # LANGUAGE ScopedTypeVariables #
module Hierarchy where
import Control.Monad
import Control.Comonad.Trans.Cofree
import Control.Cond
represented by some MonadPlus ' m ' .
type TreeT m = CofreeT Maybe m
select :: MonadPlus m => [a] -> m a
select = msum . map pure
| Descend one level into a ' TreeT ' , yieldin... |
9b6cb77d2e22ba9eebe5bd4ea277a255c3d37d429557519a898c9711164fb17e | qingliangcn/mgee | mgee_tcp_listener.erl | %%%----------------------------------------------------------------------
%%% File : mgee_tcp_listener.erl
%%% Author : Qingliang
Created : 2010 - 01 - 02
Description : Ming game engine erlang
%%%----------------------------------------------------------------------
-module(mgee_tcp_listener).
-behaviour(gen_... | null | https://raw.githubusercontent.com/qingliangcn/mgee/b65babc3a34ef678ae2b25ce1a8fdd06b2707bb8/src/mgee_tcp_listener.erl | erlang | ----------------------------------------------------------------------
File : mgee_tcp_listener.erl
Author : Qingliang
----------------------------------------------------------------------
--------------------------------------------------------------------
-------------------------------------------------------... | Created : 2010 - 01 - 02
Description : Ming game engine erlang
-module(mgee_tcp_listener).
-behaviour(gen_server).
-include("mgee.hrl").
-export([start_link/8]).
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3]).
-record(state, {sock, on_startup, on_shutdown, ... |
ce271e97b56012ad46100a337952ca818ec07dba89d9cdc6a94c3bd25034aea2 | headwinds/reagent-reframe-material-ui | templating.cljs | (ns devtools.formatters.templating
(:require-macros [devtools.oops :refer [oget oset ocall oapply safe-call]])
(:require [clojure.walk :refer [prewalk]]
[devtools.util :refer [pprint-str]]
[devtools.protocols :refer [ITemplate IGroup ISurrogate IFormat]]
[devtools.formatters.help... | null | https://raw.githubusercontent.com/headwinds/reagent-reframe-material-ui/8a6fba82a026cfedca38491becac85751be9a9d4/resources/public/js/out/devtools/formatters/templating.cljs | clojure | -- object marking support -------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
passing :target as body means that targt object body should be render... | (ns devtools.formatters.templating
(:require-macros [devtools.oops :refer [oget oset ocall oapply safe-call]])
(:require [clojure.walk :refer [prewalk]]
[devtools.util :refer [pprint-str]]
[devtools.protocols :refer [ITemplate IGroup ISurrogate IFormat]]
[devtools.formatters.help... |
f385a46e48969d1a67cbef9e4712b2df7cf76b20a23489f85cb036a29428ecd5 | typedclojure/typedclojure | rep.cljc | Copyright ( c ) , contributors .
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;... | null | https://raw.githubusercontent.com/typedclojure/typedclojure/45556897356f3c9cbc7b1b6b4df263086a9d5803/typed/clj.annotator/src/typed/clj/annotator/rep.cljc | clojure | The use and distribution terms for this software are covered by the
Eclipse Public License 1.0 (-1.0.php)
which can be found in the file epl-v10.html at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not remove ... | Copyright ( c ) , contributors .
(ns typed.clj.annotator.rep
"Intermediate representation for types"
Note : depends on this ns
)
(defn type? [t]
(and (map? t)
(keyword? (:op t))))
(defn alias? [t]
(= :alias (:op t)))
(defn HMap? [t]
(= :HMap (:op t)))
(defn HVec? [t]
(= :HVec (:op... |
7effe8867ffae1457e4961a1c67b7adcf7f68ffcb26d244273b4689668c5f5dd | dstarcev/stepic-haskell | Task17_Unique.hs | module Module3.Task17_Unique (change) where
import Data.List (nub, sort)
-- system code
coins :: (Ord a, Num a) => [a]
coins = [2, 3, 7]
--solution code
change :: (Ord a, Num a) => a -> [[a]]
change = f where
f 0 = [[]]
f s = nub [
sort (coin:ch) |
coin <- coins,
coin <= s,
ch <- (f $ s - coin)]
| null | https://raw.githubusercontent.com/dstarcev/stepic-haskell/6a8cf4b3cc17333ac4175e825db57dbe151ebae0/src/Module3/Task17_Unique.hs | haskell | system code
solution code | module Module3.Task17_Unique (change) where
import Data.List (nub, sort)
coins :: (Ord a, Num a) => [a]
coins = [2, 3, 7]
change :: (Ord a, Num a) => a -> [[a]]
change = f where
f 0 = [[]]
f s = nub [
sort (coin:ch) |
coin <- coins,
coin <= s,
ch <- (f $ s - coin)]
|
2b5bace69e6e92f244b1f07a5084c12cabeca03755a38c01843aad538ff3583e | bohonghuang/cl-gtk4 | gdk4-cairo.lisp | ;;;; examples/gdk4-cairo.lisp
Copyright ( C ) 2022 - 2023
;;;;
;;;; This program is free software: you can redistribute it and/or modify
;;;; it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation , either version 3 of the License , or
;;;; (at your option) any l... | null | https://raw.githubusercontent.com/bohonghuang/cl-gtk4/ad8fae4171bdf9532cd268d3e0a57548b3d92ec6/examples/gdk4-cairo.lisp | lisp | examples/gdk4-cairo.lisp
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the... |
Copyright ( C ) 2022 - 2023
the Free Software Foundation , either version 3 of the License , or
GNU Lesser General Public License for more details .
You should have received a copy of the GNU Lesser General Public License
(cl:defpackage cairo-gobject
(:use)
(:export #:*ns*))
(cl:in-package #:cairo-gobj... |
03781eeb2d42f524d8c130ece3f43381750dc99c122459ab4370ea99dc220203 | TrustInSoft/tis-kernel | source_manager.ml | (**************************************************************************)
(* *)
This file is part of .
(* *)
is a fork of Frama - C. Al... | null | https://raw.githubusercontent.com/TrustInSoft/tis-kernel/748d28baba90c03c0f5f4654d2e7bb47dfbe4e7d/src/plugins/gui/source_manager.ml | ocaml | ************************************************************************
... | This file is part of .
is a fork of Frama - C. All the differences are :
Copyright ( C ) 2016 - 2017
is released under GPLv2
This file is part of Frama - C.
Copyright ( C ) 2007 - 2015 ... |
e955c381668e2df18e4cfd1f248d58afacc234774d39e4732929eb1782124555 | davazp/cl-icalendar | types-utc-offset.lisp | ;; types-utc-offset.lisp ---
;;
Copyrigth ( C ) 2009 , 2010 < marioxcc >
Copyrigth ( C ) 2009 , 2010
;;
This file is part of cl - icalendar .
;;
;; cl-icalendar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software F... | null | https://raw.githubusercontent.com/davazp/cl-icalendar/b5295ac245f5d333fa593352039ca4fd6a52a058/types-utc-offset.lisp | lisp | types-utc-offset.lisp ---
cl-icalendar is free software: you can redistribute it and/or modify
(at your option) any later version.
cl-icalendar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.... | Copyrigth ( C ) 2009 , 2010 < marioxcc >
Copyrigth ( C ) 2009 , 2010
This file is part of cl - icalendar .
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
You should have received a copy of the GNU General Public L... |
d0689a9ec8725bdc004a3f4ba4e3fa564222afaba3bdb74dd839e717f9ba7ffb | basho/yokozuna | yz_fallback.erl | %% @doc Verify that fallback data is handled properly. I.e. not indexed.
-module(yz_fallback).
-compile(export_all).
-include_lib("eunit/include/eunit.hrl").
-define(NUM_KEYS, 1000).
-define(INDEX, <<"fallback">>).
-define(BUCKET, {?INDEX, <<"bucket">>}).
-define(KEY, <<"key">>).
-define(FMT(S, Args), lists:flatten(io... | null | https://raw.githubusercontent.com/basho/yokozuna/e15fe64f9ef9318c0cc21754f3dfdd073d2dc77d/riak_test/yz_fallback.erl | erlang | @doc Verify that fallback data is handled properly. I.e. not indexed. | -module(yz_fallback).
-compile(export_all).
-include_lib("eunit/include/eunit.hrl").
-define(NUM_KEYS, 1000).
-define(INDEX, <<"fallback">>).
-define(BUCKET, {?INDEX, <<"bucket">>}).
-define(KEY, <<"key">>).
-define(FMT(S, Args), lists:flatten(io_lib:format(S, Args))).
-define(CFG,
[{riak_core,
[
... |
9e652b1405d532559037eb2f2d8382b69902781bc0a557541c114aeb926d492c | shonfeder/nomad | git_cmd.ml | open Bos
let bin = Cmd.v "git"
let init () = Cmd_util.run Cmd.(bin % "init")
let add files = Cmd_util.run Cmd.(bin % "add" %% of_list files)
let changed_files () =
Cmd.(bin % "diff" % "--name-only" % "HEAD")
|> OS.Cmd.(run_out ~err:err_run_out)
|> OS.Cmd.to_lines ~trim:true
let commit msg = Cmd_util.run Cmd.(b... | null | https://raw.githubusercontent.com/shonfeder/nomad/40c00e1792b3d45c0aa51ecec46abbc15410dd1c/lib/git_cmd.ml | ocaml | open Bos
let bin = Cmd.v "git"
let init () = Cmd_util.run Cmd.(bin % "init")
let add files = Cmd_util.run Cmd.(bin % "add" %% of_list files)
let changed_files () =
Cmd.(bin % "diff" % "--name-only" % "HEAD")
|> OS.Cmd.(run_out ~err:err_run_out)
|> OS.Cmd.to_lines ~trim:true
let commit msg = Cmd_util.run Cmd.(b... | |
55ce203232d4c0be077fededac086d73ada4ef69729fb44a53ae8292a1fba0ec | DataHaskell/dh-core | Html.hs | -- | Functions for working with HTML.
module Analyze.Html where
import Analyze.RFrame (RFrame (..))
import Control.Monad (forM_)
import qualified Lucid as L
-- | Renders an 'RFrame' to an HTML table.
renderHtml :: (L.ToHtml k, L.ToHtml v, Monad m)
=> RFrame k v -> L.HtmlT m ()... | null | https://raw.githubusercontent.com/DataHaskell/dh-core/2beb8740f27fa9683db70eb8d8424ee6c75d3e91/analyze/src/Analyze/Html.hs | haskell | | Functions for working with HTML.
| Renders an 'RFrame' to an HTML table. | module Analyze.Html where
import Analyze.RFrame (RFrame (..))
import Control.Monad (forM_)
import qualified Lucid as L
renderHtml :: (L.ToHtml k, L.ToHtml v, Monad m)
=> RFrame k v -> L.HtmlT m ()
renderHtml (RFrame ks _ vs) =
L.table_ $ do
L.thead_ $
L.tr_ $ forM_... |
6332c0e488794aa3f896bcce3f51656820cded07cb1e844a0478b482a9298f41 | avalor/eJason | scanner.erl | -module(scanner).
-compile(export_all).
-include("include/macros.hrl").
getTokens(File)->
{ok, RawTokens} =
case file:path_open(code:get_path(),File,[read]) of
{ok, F, _Path} ->
scan(F);
{error, enoent} ->
io:format("File: ~s cannot be found.~n",[File]),
exit(asl_file_not_found)
end,
%% io:... | null | https://raw.githubusercontent.com/avalor/eJason/3e5092d42de0a3df5c5e5ec42cb552a2f282bbb1/src/scanner.erl | erlang | io:format("RAW TOKENS: ~p~n",[lists:flatten(RawTokens)]),
io:format("RAW TOKENS: ~p~n",[Tokens]),
Toks = lex(Tokens),
io:format("Result Scan: ~p~n",[ResultScan]),
io:format("Token: ~p~n",[Token]),
[{integer,Line2,Int}|MoreTokens] ->
%% -Int -> + (-1*Int)
[{'+',Line2},{'(',Line2},{number,Line2,-1},{'*',Lin... | -module(scanner).
-compile(export_all).
-include("include/macros.hrl").
getTokens(File)->
{ok, RawTokens} =
case file:path_open(code:get_path(),File,[read]) of
{ok, F, _Path} ->
scan(F);
{error, enoent} ->
io:format("File: ~s cannot be found.~n",[File]),
exit(asl_file_not_found)
end,
{ok, l... |
3bb3e6580ac51cacd086332dabbd04e15df61e0f410bd3966d5f3a631ef33585 | canonical/jepsen.dqlite | append.clj | (ns jepsen.dqlite.append
"Test for transactional list append."
(:require [clojure [string :as str]]
[jepsen [client :as client]]
[jepsen.tests.cycle.append :as append]
[jepsen.dqlite [client :as c]]))
(defrecord Client [conn]
client/Client
(open! [this test node]
(assoc ... | null | https://raw.githubusercontent.com/canonical/jepsen.dqlite/be21c914b13d5a86e845856cda9357fc326006cb/src/jepsen/dqlite/append.clj | clojure | (ns jepsen.dqlite.append
"Test for transactional list append."
(:require [clojure [string :as str]]
[jepsen [client :as client]]
[jepsen.tests.cycle.append :as append]
[jepsen.dqlite [client :as c]]))
(defrecord Client [conn]
client/Client
(open! [this test node]
(assoc ... | |
d9cc033be87aaae23e319d92fb30ae2767d89000ba25eb08e5d12a1dbf15ba24 | dvcrn/proton | keymap.cljs | (ns proton.lib.keymap
#_(:require [proton.core]
[proton.lib.mode])
(:require [proton.lib.atom :as atom-env :refer [workspace commands views eval-action! eval-actions!]]
[proton.lib.helpers :as helpers :refer [deep-merge]]))
(defonce atom-keymap (atom {}))
(defonce proton-keymap (atom {}))... | null | https://raw.githubusercontent.com/dvcrn/proton/427d83ffdb61d84a04e3d30032b792a9cfbfc53f/src/cljs/proton/lib/keymap.cljs | clojure | if it is a vector, it means we are dealing with a multi keybinding | (ns proton.lib.keymap
#_(:require [proton.core]
[proton.lib.mode])
(:require [proton.lib.atom :as atom-env :refer [workspace commands views eval-action! eval-actions!]]
[proton.lib.helpers :as helpers :refer [deep-merge]]))
(defonce atom-keymap (atom {}))
(defonce proton-keymap (atom {}))... |
3385f768db064ab703259a1faf945b36c6b2ffa8c3bbe12235e1db0e2c2c0a14 | oklm-wsh/MrMime | parser.ml | let () = Printexc.record_backtrace true
module Input = RingBuffer.Committed
let locate buff off len f =
let idx = ref 0 in
while !idx < len && f (Internal_buffer.get buff (off + !idx))
do incr idx done;
!idx
module type S =
sig
type s =
| Complete
| Incomplete
val pp : Format.formatter -> s -> ... | null | https://raw.githubusercontent.com/oklm-wsh/MrMime/4d2a9dc75905927a092c0424cff7462e2b26bb96/lib/parser.ml | ocaml | we rollback to old read position
forget the mark, and may be switch to
ring-buffer | let () = Printexc.record_backtrace true
module Input = RingBuffer.Committed
let locate buff off len f =
let idx = ref 0 in
while !idx < len && f (Internal_buffer.get buff (off + !idx))
do incr idx done;
!idx
module type S =
sig
type s =
| Complete
| Incomplete
val pp : Format.formatter -> s -> ... |
a98631612ca1e122fad9362869eca8b5f2dc7e2567e06dc4ce27ab02c7c42277 | meriken/ju | util.clj | (ns ju.util
(:require [ju.param :as param]
[taoensso.timbre :as timbre]
[pandect.algo.sha1 :refer :all]
[clojure.data.codec.base64]
[taoensso.timbre.appenders.3rd-party.rotor :as rotor])
(:import (java.net URLEncoder InetAddress)
(java.nio.file Files)
... | null | https://raw.githubusercontent.com/meriken/ju/99caa4625535d3da66002c460bf16d8708cabd7e/src/ju/util.clj | clojure | (timbre/debug "key: " (apply str (map #(format "%02X " %) (get-byte-array-for-tripcode-key key))))
")
(timbre/debug "modified-key-0x80:" (apply str (map #(format "%02X " %) (get-byte-array-for-tripcode-key modified-key-0x80))))
key-byte-list-0x80
key-byte-list-0x80
key-byte-list-0x80
◆IshBgEJs9E ;◆77789331... | (ns ju.util
(:require [ju.param :as param]
[taoensso.timbre :as timbre]
[pandect.algo.sha1 :refer :all]
[clojure.data.codec.base64]
[taoensso.timbre.appenders.3rd-party.rotor :as rotor])
(:import (java.net URLEncoder InetAddress)
(java.nio.file Files)
... |
4a90f05c20f126d1a759a4e044e8f07dc0601ba7a551bd39f0de4da31dd29977 | infinisil/nixbot | Escape.hs | # LANGUAGE ScopedTypeVariables #
{-# LANGUAGE OverloadedStrings #-}
module Plugins.Commands.Escape where
import Data.Text (Text)
import qualified Data.Text as Text
import Plugins
import Types
import NixEval
import Data.Char
import Data.Text.Encoding
import qual... | null | https://raw.githubusercontent.com/infinisil/nixbot/e8695fd73c07bc115ee0dd3e7c121cd985c04c06/src/Plugins/Commands/Escape.hs | haskell | # LANGUAGE OverloadedStrings # | # LANGUAGE ScopedTypeVariables #
module Plugins.Commands.Escape where
import Data.Text (Text)
import qualified Data.Text as Text
import Plugins
import Types
import NixEval
import Data.Char
import Data.Text.Encoding
import qualified Data.ByteString.Lazy as LBS
i... |
13e6ab68f3b024e66cf3838f1c945f7cab2033cdb2c3d2812d5ce5fb62281302 | muyinliu/cl-diskspace | packages.lisp | packages.lisp
(defpackage #:cl-diskspace
(:use #:cl
#:cffi
#:cffi-grovel)
(:nicknames :diskspace :ds)
(:export #:list-all-disks
#:list-all-disk-info
#:disk-space
#:disk-total-space
#:disk-free-space
#:disk-available-space
#:size-... | null | https://raw.githubusercontent.com/muyinliu/cl-diskspace/2dce2d0387d58221c452bd76c7b9b7a7de81ef55/src/packages.lisp | lisp | packages.lisp
(defpackage #:cl-diskspace
(:use #:cl
#:cffi
#:cffi-grovel)
(:nicknames :diskspace :ds)
(:export #:list-all-disks
#:list-all-disk-info
#:disk-space
#:disk-total-space
#:disk-free-space
#:disk-available-space
#:size-... | |
fbd15e3a172052a880d452c32fcef2e7a17912536f135a74942cc72adf99cca0 | metabase/metabase | before_insert.clj | (ns macros.toucan2.tools.before-insert
(:require [macros.toucan2.common :as common]))
(defmacro define-before-insert
[model [instance-binding] & body]
`(do
~model
(fn [~(common/ignore-unused '&model)
~instance-binding]
~@body)))
| null | https://raw.githubusercontent.com/metabase/metabase/b34fae975cf6e3893f37209920561cf1acd94949/.clj-kondo/com.github.camsaul/toucan2/macros/toucan2/tools/before_insert.clj | clojure | (ns macros.toucan2.tools.before-insert
(:require [macros.toucan2.common :as common]))
(defmacro define-before-insert
[model [instance-binding] & body]
`(do
~model
(fn [~(common/ignore-unused '&model)
~instance-binding]
~@body)))
| |
3e8d4d3250767e983c28e87a855a305a276aa6629f1390dca197bf35a14b749a | bscarlet/llvm-general | Diagnostic.hs | # LANGUAGE
TemplateHaskell ,
MultiParamTypeClasses
#
TemplateHaskell,
MultiParamTypeClasses
#-}
module LLVM.General.Internal.Diagnostic where
import LLVM.General.Prelude
import qualified LLVM.General.Internal.FFI.LLVMCTypes as FFI
import qualified LLVM.General.Internal.FFI.SMDiagnostic as FFI
imp... | null | https://raw.githubusercontent.com/bscarlet/llvm-general/61fd03639063283e7dc617698265cc883baf0eec/llvm-general/src/LLVM/General/Internal/Diagnostic.hs | haskell | # LANGUAGE
TemplateHaskell ,
MultiParamTypeClasses
#
TemplateHaskell,
MultiParamTypeClasses
#-}
module LLVM.General.Internal.Diagnostic where
import LLVM.General.Prelude
import qualified LLVM.General.Internal.FFI.LLVMCTypes as FFI
import qualified LLVM.General.Internal.FFI.SMDiagnostic as FFI
imp... | |
32ce27cece74731bc68accc8cee266c54e120089f8e4bfeb66fb0dfb5c16c808 | mkoppmann/eselsohr | Article.hs | module Lib.Domain.Article
( Article (..)
, ArticleState (..)
, changeTitle
, markAsUnread
, markAsRead
, titleFromText
) where
import Data.Time.Clock (UTCTime)
import Prelude hiding
( id
, state
)
import qualified Lib.Domain.NonEmptyText as NET
import Lib.Domain.Error (AppErro... | null | https://raw.githubusercontent.com/mkoppmann/eselsohr/3bb8609199c1dfda94935e6dde0c46fc429de84e/src/Lib/Domain/Article.hs | haskell | ----------------------------------------------------------------------
Util
---------------------------------------------------------------------- | module Lib.Domain.Article
( Article (..)
, ArticleState (..)
, changeTitle
, markAsUnread
, markAsRead
, titleFromText
) where
import Data.Time.Clock (UTCTime)
import Prelude hiding
( id
, state
)
import qualified Lib.Domain.NonEmptyText as NET
import Lib.Domain.Error (AppErro... |
3a0ca52cff46314a02a51f217752367250f6b9f24ff7bfb6f48b85c1184919dc | triffon/fp-2019-20 | 10--exists.rkt | #lang racket
(require rackunit rackunit/text-ui)
# # # Задача 10
Напишете функция ` ( exists ? pred ? a b ) ` ,
която проверява дали има цяло число в интервала [ a , b ] , за което предикатът ` pred ? ` е истина .
(define (exists? pred? a b)
void)
(run-tests (test-suite "exists? tests"
(check-tr... | null | https://raw.githubusercontent.com/triffon/fp-2019-20/7efb13ff4de3ea13baa2c5c59eb57341fac15641/exercises/computer-science-2/03--higher-order-functions--accumulate/10--exists.rkt | racket | #lang racket
(require rackunit rackunit/text-ui)
# # # Задача 10
Напишете функция ` ( exists ? pred ? a b ) ` ,
която проверява дали има цяло число в интервала [ a , b ] , за което предикатът ` pred ? ` е истина .
(define (exists? pred? a b)
void)
(run-tests (test-suite "exists? tests"
(check-tr... | |
2baeb50f0d73203a22663f7db74f15db760bc099c1b72dfeaf86f394120d086b | alanz/ghc-exactprint | SH_Overlap2.hs | # LANGUAGE Trustworthy #
# LANGUAGE FlexibleInstances #
| Same as SH_Overlap1 , but SH_Overlap2_A is not imported as ' safe ' .
--
-- Question: Should the OI-check be enforced? Y, see reasoning in
-- `SH_Overlap4.hs` for why the Safe Haskell overlapping instance check should
-- be tied to Safe Haskell mode only, and... | null | https://raw.githubusercontent.com/alanz/ghc-exactprint/b6b75027811fa4c336b34122a7a7b1a8df462563/tests/examples/ghc80/SH_Overlap2.hs | haskell |
Question: Should the OI-check be enforced? Y, see reasoning in
`SH_Overlap4.hs` for why the Safe Haskell overlapping instance check should
be tied to Safe Haskell mode only, and not to safe imports. | # LANGUAGE Trustworthy #
# LANGUAGE FlexibleInstances #
| Same as SH_Overlap1 , but SH_Overlap2_A is not imported as ' safe ' .
module SH_Overlap2 where
import SH_Overlap2_A
instance
C [a] where
f _ = "[a]"
test :: String
test = f ([1,2,3,4] :: [Int])
|
9f7c10bf2c999658d179691b077cf11ef16fbd3807858fe51cf356446265c34b | finnishtransportagency/harja | bonukset_lomake.cljs | (ns harja.views.urakka.laadunseuranta.bonukset-lomake
"Bonuksien käsittely ja luonti"
(:require [reagent.core :as r]
[tuck.core :as tuck]
[harja.pvm :as pvm]
[harja.domain.laadunseuranta.sanktio :as sanktio-domain]
[harja.domain.yllapitokohde :as yllapitokohde-domai... | null | https://raw.githubusercontent.com/finnishtransportagency/harja/6666ecfc5ab49605006144ed0557a8dbdfe9f210/src/cljs/harja/views/urakka/laadunseuranta/bonukset_lomake.cljs | clojure | (ns harja.views.urakka.laadunseuranta.bonukset-lomake
"Bonuksien käsittely ja luonti"
(:require [reagent.core :as r]
[tuck.core :as tuck]
[harja.pvm :as pvm]
[harja.domain.laadunseuranta.sanktio :as sanktio-domain]
[harja.domain.yllapitokohde :as yllapitokohde-domai... | |
918e53d6acea3249c0ea209cb0596d92fd0e421e1dcb793947da33a0f94bf7cb | input-output-hk/plutus-apps | V1.hs | {-# LANGUAGE DeriveAnyClass #-}
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
{-# LANGUAGE DerivingVia #-}
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE MonoLocalBinds #
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell ... | null | https://raw.githubusercontent.com/input-output-hk/plutus-apps/5ff40dafcdb07483442093efb4eaa39d12f34880/plutus-ledger/src/Ledger/Tx/Orphans/V1.hs | haskell | # LANGUAGE DeriveAnyClass #
# LANGUAGE DerivingVia #
# LANGUAGE OverloadedStrings #
# LANGUAGE TemplateHaskell # | # LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE MonoLocalBinds #
# LANGUAGE UndecidableInstances #
# OPTIONS_GHC -fno - warn - orphans #
module Ledger.Tx.Orphans.V1 where
import Ledger.Scripts.Orphans ()
im... |
6088c220250c9f0f80d0da90367a5b8fe58f9e2c58294531f6262ddeb7116db4 | ocharles/hs-quake-3 | RenderGraph.hs | {-# LANGUAGE BangPatterns #-}
# LANGUAGE ExplicitNamespaces #
# LANGUAGE DeriveFunctor #
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE FunctionalDependencies #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE TypeApplications #
# LANGUAGE TypeOperators #
mod... | null | https://raw.githubusercontent.com/ocharles/hs-quake-3/655f6ce2b04c69f5e05c01cf57356132aa711589/RenderGraph.hs | haskell | # LANGUAGE BangPatterns #
| The class of types that act as rendering nodes - generally operations that
manipulate OpenGL state.
Composing render graphs (functor composition)
Monoidal maps
glCullFace
Multi-pass rendering
Set blend mode
Texture units
Monoidal IntMaps
Set uniform parameters
Setting depth functi... | # LANGUAGE ExplicitNamespaces #
# LANGUAGE DeriveFunctor #
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE FunctionalDependencies #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE TypeApplications #
# LANGUAGE TypeOperators #
module RenderGraph
( RenderNode... |
94093e8e4c1e3395dc62478c329d6a48bad6487657fc12d65f00fec70d614e83 | eduardoaguacate/Object-Oriented-Haskell | TypeChecker.hs | module TypeChecker where
import Data.Decimal
import DataTypes
import Text.Show.Pretty
import Control.Monad
import Control.Monad.State
import Control.Monad.Identity
import Control.Monad.Trans.Class (lift)
import Control.Concurrent
import Control.Monad.Except
import SymbolTable
import ClassSymbolTable
import Expression
... | null | https://raw.githubusercontent.com/eduardoaguacate/Object-Oriented-Haskell/2f6192ca98513886cbedffa7429c87c44ffdcf05/Analysis/TypeChecker.hs | haskell | import qualified Data.Map.Strict as Map
modify $ \s -> (s { tcSymTab = newSymTab})
de análisis semántico.
el mapa de herencias
, entonces
modify $ \s -> (s { tcClassSymTab = newClassSymTable})
if Map.member classIdentifier classSymTab
then lift $ throwError (ClassDeclared classIdentifier (show ... | module TypeChecker where
import Data.Decimal
import DataTypes
import Text.Show.Pretty
import Control.Monad
import Control.Monad.State
import Control.Monad.Identity
import Control.Monad.Trans.Class (lift)
import Control.Concurrent
import Control.Monad.Except
import SymbolTable
import ClassSymbolTable
import Expression
... |
3beade881c4d4bc859671a18aa715d2aeca742e791d15c9903cc6c33ee84e56c | janestreet/sexp | query.ml | open Core
open Sexp_app
type output_mode =
| Sexp
| Count
| Silent
type t =
{ inputs : unit Located.t
; output_mode : output_mode
; allow_empty_output : bool
; labeled : bool
; group : bool
; machine : bool
; fail_on_parse_error : bool
; perform_query : Sexp_ext.t -> on_result:(Sexp.t -> unit) -... | null | https://raw.githubusercontent.com/janestreet/sexp/56e485b3cbf8a43e1a8d7647b0df31b27053febf/bin/query.ml | ocaml | open Core
open Sexp_app
type output_mode =
| Sexp
| Count
| Silent
type t =
{ inputs : unit Located.t
; output_mode : output_mode
; allow_empty_output : bool
; labeled : bool
; group : bool
; machine : bool
; fail_on_parse_error : bool
; perform_query : Sexp_ext.t -> on_result:(Sexp.t -> unit) -... | |
bf386bcf248d4169658dc477cf21d8e6085d317cfdfc3ce0859d8c44348007f0 | adventuring/tootsville.net | i18n+l10n.lisp | (in-package :oliphaunt)
Internationalization and Localization Support
(define-constant +language-names+
'((:en "English" "English" "Language")
(:es "Español" "Spanish" "Idioma")
(:fr "Français" "French" "Langue")
(:ga "Gaeilge" "Irish" "Teanga")
(:ru "Русский" "Russian" "Язык")
(... | null | https://raw.githubusercontent.com/adventuring/tootsville.net/985c11a91dd1a21b77d7378362d86cf1c031b22c/src/lib/oliphaunt/i18n%2Bl10n.lisp | lisp | Genders of words which cannot be guessed by their declensions
Determine the gender and declension of a word
totally random guess
bad fallback
Presentation and internalized forms.
apostrophe
e.g. as an “bPoblacht.“
or ei; when?
ditto for gaiscíoch→gaiscígh (gaiscigh)
dl retained in writing?
(format *trace-out... | (in-package :oliphaunt)
Internationalization and Localization Support
(define-constant +language-names+
'((:en "English" "English" "Language")
(:es "Español" "Spanish" "Idioma")
(:fr "Français" "French" "Langue")
(:ga "Gaeilge" "Irish" "Teanga")
(:ru "Русский" "Russian" "Язык")
(... |
d997544485733f2f67cb34b07ca0da291deca083bb1999ce680b0f7627d8a0fa | lojic/LearningRacket | sieve-test.rkt | #lang racket
(require "sieve.rkt")
(module+ test
(require rackunit rackunit/text-ui)
(define suite
(test-suite
"Tests for the sieve exercise"
(for ([(limit primes) #hash((2 . (2))
(3 . (3 2))
(4 . (3 2))
(5 . (5 3 ... | null | https://raw.githubusercontent.com/lojic/LearningRacket/eb0e75b0e16d3e0a91b8fa6612e2678a9e12e8c7/exercism.io/sieve/sieve-test.rkt | racket | #lang racket
(require "sieve.rkt")
(module+ test
(require rackunit rackunit/text-ui)
(define suite
(test-suite
"Tests for the sieve exercise"
(for ([(limit primes) #hash((2 . (2))
(3 . (3 2))
(4 . (3 2))
(5 . (5 3 ... | |
4b7fafdd4abf8d446caccba9f7ce5ecac46ce36e531df7358e554efe88cf1def | freckle/blammo | Terminal.hs | -- | Colorful logging for humans
--
-- Lines are formatted as
--
-- @
-- {timestamp} [{level}] {message} {details}
-- @
--
@level@ is padded to 9 characters and @message@ is padded to 31 . This means
-- things will align as long as values are shorter than that. Longer values will
-- overflow (not be truncated).
--
... | null | https://raw.githubusercontent.com/freckle/blammo/a5b70d0c6d8d3022e78de60984d6f846b06b5086/src/Blammo/Logging/Terminal.hs | haskell | | Colorful logging for humans
Lines are formatted as
@
{timestamp} [{level}] {message} {details}
@
things will align as long as values are shorter than that. Longer values will
overflow (not be truncated).
[structlog](/) package in its default
configuration.
| @level@ is padded to 9 characters and @message@ is padded to 31 . This means
This format was designed to match Python 's
module Blammo.Logging.Terminal
( reformatTerminal
) where
import Prelude
import Blammo.Logging.Colors
import Blammo.Logging.Terminal.LogPiece (LogPiece, logPiece)
import qualified Blammo.Lo... |
f0ef880b0b07dbd6444d7504a67c51fad9dd642dc88b7b40b100e3a21b48fb65 | rtoy/ansi-cl-tests | pathnames.lsp | ;-*- Mode: Lisp -*-
Author :
Created : Sat Nov 29 04:21:53 2003
;;;; Contains: Various tests on pathnames
(in-package :cl-test)
(deftest pathnames-print-and-read-properly
(with-standard-io-syntax
(loop
for p1 in *pathnames*
for s = (handler-case (write-to-string p1 :readably t)
... | null | https://raw.githubusercontent.com/rtoy/ansi-cl-tests/9708f3977220c46def29f43bb237e97d62033c1d/pathnames.lsp | lisp | -*- Mode: Lisp -*-
Contains: Various tests on pathnames | Author :
Created : Sat Nov 29 04:21:53 2003
(in-package :cl-test)
(deftest pathnames-print-and-read-properly
(with-standard-io-syntax
(loop
for p1 in *pathnames*
for s = (handler-case (write-to-string p1 :readably t)
(print-not-readable () :unreadable-error))
unle... |
d1bd21dc6ddfadc6c85f0d1c3ab6edf9eda436d4e6250adeb00c6be18c04da60 | CarlosMChica/HaskellBook | MakeItBottom.hs | module MakeItBottom where
-- Make it bottom up with bang patterns or seq
x = undefined
y = "blah"
main = do
print (snd (x, y))
main' = do
print (snd (x, x `seq` y))
| null | https://raw.githubusercontent.com/CarlosMChica/HaskellBook/86f82cf36cd00003b1a1aebf264e4b5d606ddfad/chapter27/MakeItBottom.hs | haskell | Make it bottom up with bang patterns or seq | module MakeItBottom where
x = undefined
y = "blah"
main = do
print (snd (x, y))
main' = do
print (snd (x, x `seq` y))
|
03cb11358ad9738f6728a8371cbcc4e8dff446a424ce040c07a059f96f74393d | tweag/asterius | T10104.hs | # LANGUAGE MagicHash #
module Main where
import GHC.Prim
data P = Positives Int# Float# Double# Char# Word# deriving Show
data N = Negatives Int# Float# Double# deriving Show
main = do
print $ Positives 42# 4.23# 4.23## '4'# 4##
print $ Negatives -4# -4.0# -4.0##
| null | https://raw.githubusercontent.com/tweag/asterius/e7b823c87499656860f87b9b468eb0567add1de8/asterius/test/ghc-testsuite/deriving/T10104.hs | haskell | # LANGUAGE MagicHash #
module Main where
import GHC.Prim
data P = Positives Int# Float# Double# Char# Word# deriving Show
data N = Negatives Int# Float# Double# deriving Show
main = do
print $ Positives 42# 4.23# 4.23## '4'# 4##
print $ Negatives -4# -4.0# -4.0##
| |
f0fd42dd5652d2384195a3d6719de64f7ee646596786241e82da2cac023974ed | fpco/inline-c | ParseSpec.hs | {-# LANGUAGE ConstraintKinds #-}
# LANGUAGE CPP #
# LANGUAGE FlexibleContexts #
{-# LANGUAGE RankNTypes #-}
# LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE QuasiQuotes #
# LANGUAGE TemplateHaskell #
{-# LANGUAGE OverloadedStrings #-}
module Language.C.Inline.ParseSpec (spec) where
import ... | null | https://raw.githubusercontent.com/fpco/inline-c/b37b60f1712b12b43c86493cafb9ac324443d22e/inline-c/test/Language/C/Inline/ParseSpec.hs | haskell | # LANGUAGE ConstraintKinds #
# LANGUAGE RankNTypes #
# LANGUAGE OverloadedStrings #
We use show + length to fully evaluate the result -- there | # LANGUAGE CPP #
# LANGUAGE FlexibleContexts #
# LANGUAGE FlexibleInstances #
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE QuasiQuotes #
# LANGUAGE TemplateHaskell #
module Language.C.Inline.ParseSpec (spec) where
import Control.Exception (evaluate)
import Control.Monad (void)
import Con... |
a1883e5412b6bc49eed2d374b910935480ac055ef282969c447c2273c62ba1ce | theodormoroianu/SecondYearCourses | LambdaChurch_20210415171302.hs | module LambdaChurch where
import Data.Char (isLetter)
import Data.List ( nub )
class ShowNice a where
showNice :: a -> String
class ReadNice a where
readNice :: String -> (a, String)
data Variable
= Variable
{ name :: String
, count :: Int
}
deriving (Show, Eq, Ord)
var :: String -> Variable
var ... | null | https://raw.githubusercontent.com/theodormoroianu/SecondYearCourses/5e359e6a7cf588a527d27209bf53b4ce6b8d5e83/FLP/Laboratoare/Lab%209/.history/LambdaChurch_20210415171302.hs | haskell | alpha-equivalence
subst u x t defines [u/x]t, i.e., substituting u for x in t
This substitution avoids variable captures so it is safe to be used when
reducing terms with free variables (e.g., if evaluating inside lambda abstractions)
^ substitution term
^ variable to be substitutes
^ term in which the substit... | module LambdaChurch where
import Data.Char (isLetter)
import Data.List ( nub )
class ShowNice a where
showNice :: a -> String
class ReadNice a where
readNice :: String -> (a, String)
data Variable
= Variable
{ name :: String
, count :: Int
}
deriving (Show, Eq, Ord)
var :: String -> Variable
var ... |
cef14b53945937c3a2e44e0b12ec81d137cca842dfa110475a0f58449e87ad6c | disco-lang/disco | Util.hs |
-----------------------------------------------------------------------------
-- |
Module : Disco . . Util
Copyright : ( c ) 2016 disco team ( see LICENSE )
-- License : BSD-style (see LICENSE)
-- Maintainer :
--
-- Definition of type contexts, type errors, and various utilities
-- used durin... | null | https://raw.githubusercontent.com/disco-lang/disco/a855e854850a00e5cae06a1aa3076e53531d261b/src/Disco/Typecheck/Util.hs | haskell | ---------------------------------------------------------------------------
|
License : BSD-style (see LICENSE)
Maintainer :
Definition of type contexts, type errors, and various utilities
used during type checking.
---------------------------------------------------------------------------
-------------... |
Module : Disco . . Util
Copyright : ( c ) 2016 disco team ( see LICENSE )
module Disco.Typecheck.Util where
import Disco.Effects.Fresh
import Polysemy
import Polysemy.Error
import Polysemy.Output
import Polysemy.Reader
import Polysemy.Writ... |
00597de0fe34b5d4a5423ae53bc7414c7904c47acab01ffb3015afa3a853b01c | jumarko/web-development-with-clojure | core.clj | (ns ring-app.core
(:require [ring.adapter.jetty :as jetty]
[ring.middleware.reload :refer [wrap-reload]]
[ring.util.http-response :as r]
[ring.middleware.format :refer [wrap-restful-format]]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
[co... | null | https://raw.githubusercontent.com/jumarko/web-development-with-clojure/dfff6e40c76b64e9fcd440d80c7aa29809601b6b/examples/ring-app/src/ring_app/core.clj | clojure | example from -Syntax
notice that output of following is a little bit strange with additional commas in quotes between elements
compojure also allows us to avoid repetition using context macro
notice that we need to create var from handler for wrap-reload to work | (ns ring-app.core
(:require [ring.adapter.jetty :as jetty]
[ring.middleware.reload :refer [wrap-reload]]
[ring.util.http-response :as r]
[ring.middleware.format :refer [wrap-restful-format]]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
[co... |
6f31712b50fb974361fee88052e781dcd234bb5a729d594173be58d438c2e511 | ktakashi/sagittarius-scheme | rsa_pss_2048_sha512_256_mgf1_28_test.scm | (test-signature/testvector
"rsa_pss_2048_sha512_256_mgf1_28_test"
:algorithm
"RSASSA-PSS"
:digest
"SHA-512/224"
:public-key
#vu8(48 130 1 34 48 13 6 9 42 134 72 134 247 13 1 1 1 5 0 3 130 1 15 0 48 130 1 10 2 130 1 1 0 163 143 188 243 78 239 24 16 203 42 226 31 239 30 154 30 3 127 125 37 212 62 139 79 5 3... | null | https://raw.githubusercontent.com/ktakashi/sagittarius-scheme/8d3be98032133507b87d6c0466d60f982ebf9b15/ext/crypto/tests/testvectors/signature/rsa_pss_2048_sha512_256_mgf1_28_test.scm | scheme | (test-signature/testvector
"rsa_pss_2048_sha512_256_mgf1_28_test"
:algorithm
"RSASSA-PSS"
:digest
"SHA-512/224"
:public-key
#vu8(48 130 1 34 48 13 6 9 42 134 72 134 247 13 1 1 1 5 0 3 130 1 15 0 48 130 1 10 2 130 1 1 0 163 143 188 243 78 239 24 16 203 42 226 31 239 30 154 30 3 127 125 37 212 62 139 79 5 3... | |
194991c71f30880c9514c185a44693e5eca9c3a431ce6460735dbaf031da6d7d | alephcloud/wai-cors | Cors.hs | -- ------------------------------------------------------ --
Copyright © 2014 AlephCloud Systems , Inc.
-- ------------------------------------------------------ --
# LANGUAGE UnicodeSyntax #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE ScopedTypeVariables #
# LANGUAGE RecordWildCards #
# LANGUAGE LambdaCase #
{-# ... | null | https://raw.githubusercontent.com/alephcloud/wai-cors/069b7ecf63812223e589d78ed6f2c398c383b3f9/src/Network/Wai/Middleware/Cors.hs | haskell | ------------------------------------------------------ --
------------------------------------------------------ --
# LANGUAGE OverloadedStrings #
# LANGUAGE GADTs #
aims to be compliant with <>.
The function 'simpleCors' enables support of simple cross-origin requests.
The following is an example how to enable ... | Copyright © 2014 AlephCloud Systems , Inc.
# LANGUAGE UnicodeSyntax #
# LANGUAGE ScopedTypeVariables #
# LANGUAGE RecordWildCards #
# LANGUAGE LambdaCase #
# LANGUAGE PatternGuards #
# LANGUAGE CPP #
| An implemenation of Cross - Origin resource sharing ( CORS ) for WAI that
for a < > application .
> import... |
d687b55b65834b687f0ee9cebc11120e9b6f0d7d2baba21b1266eb5e3cb0ae08 | opencog/learn | launch-mst-parser.scm | ;
; launch-mst-parser.scm
;
; Run the cogserver, needed for the language-learning disjunct
; counting pipeline. Starts the cogserver, opens the database,
loads the database ( which can take an hour or more ! )
;
(use-modules (opencog) (opencog persist) (opencog persist-sql))
(use-modules (opencog cogserver))
(use-mod... | null | https://raw.githubusercontent.com/opencog/learn/c599c856f59c1815b92520bee043c588d0d1ebf9/attic/run-poc/misc/launch-mst-parser.scm | scheme |
launch-mst-parser.scm
Run the cogserver, needed for the language-learning disjunct
counting pipeline. Starts the cogserver, opens the database,
Get the database connection and language details
set the prompt for the given language
Start the cogserver with configs for the given language
Open the database.
alr... | loads the database ( which can take an hour or more ! )
(use-modules (opencog) (opencog persist) (opencog persist-sql))
(use-modules (opencog cogserver))
(use-modules (opencog nlp))
(use-modules (system repl common))
(use-modules (system repl server))
(use-modules (opencog logger))
(use-modules (opencog matrix))
(ad... |
835fcb744cd636902548fe7174a828e180273a9dceba364d9fe030445bc92818 | metosin/sormilla | math_test.clj | (ns sormilla.math-test
(:require [midje.sweet :refer :all]
[sormilla.math :refer :all]))
(facts "avg"
(avg [1.0 1.0 1.0]) => (roughly 1.0)
(avg [1.0 2.0 3.0]) => (roughly 2.0))
(facts "lin-scale"
(let [s (lin-scale [0.0 1.0] [10.0 20.0])]
(s 0.0) => (roughly 10.0)
(s 0.5) => (roughly 15.0)... | null | https://raw.githubusercontent.com/metosin/sormilla/e50930930c41f64272f06c4bd02a4e3ab58e923f/test/sormilla/math_test.clj | clojure | (ns sormilla.math-test
(:require [midje.sweet :refer :all]
[sormilla.math :refer :all]))
(facts "avg"
(avg [1.0 1.0 1.0]) => (roughly 1.0)
(avg [1.0 2.0 3.0]) => (roughly 2.0))
(facts "lin-scale"
(let [s (lin-scale [0.0 1.0] [10.0 20.0])]
(s 0.0) => (roughly 10.0)
(s 0.5) => (roughly 15.0)... | |
95513af55c079527926e5f8b816528a1344bac7349386e7b915c1a92db22e3fb | lfe/rebar3_lfe | rebar3_lfe.erl | -module(rebar3_lfe).
-export([init/1]).
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
rebar_api:debug("Intializing rebar3_lfe plugin ...", []),
Commands = [ fun rebar3_lfe_prv_clean:init/1,
fun rebar3_lfe_prv_clean_all:init/1,
fun rebar3_lfe_prv_clean_build:ini... | null | https://raw.githubusercontent.com/lfe/rebar3_lfe/9b929daf74d95e3ed048878569ced99eded0b2a7/src/rebar3_lfe.erl | erlang | Useful for debugging new plugins:
{ok, State} = rebar3_lfe:init(rebar_state:new()).
rebar_state:command_parsed_args(rebar_state:new()).
rebar_prv_eunit:eunit_opts(rebar_state:new()). | -module(rebar3_lfe).
-export([init/1]).
-spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
init(State) ->
rebar_api:debug("Intializing rebar3_lfe plugin ...", []),
Commands = [ fun rebar3_lfe_prv_clean:init/1,
fun rebar3_lfe_prv_clean_all:init/1,
fun rebar3_lfe_prv_clean_build:ini... |
77896ac6ca7eb3e0b70082b9cbdad480b6e0f76521349c72155aa32f823c8de1 | spartango/CS153 | mips.ml | This structure defines the abstract syntax for MIPS assembly
* language that we will be using . It should be fairly self-
* explanatory .
*
* IMPORTANT : do not use registers R1 , R26 , or R27 as these
* are reserved by the assembler and operating system . See
* page A-24 of the MIPS documenta... | null | https://raw.githubusercontent.com/spartango/CS153/16faf133889f1b287cb95c1ea1245d76c1d8db49/ps6/mips.ml | ocaml | DO NOT USE ME: assembler temp
DO NOT USE ME: reserved for OS
used for special purposes...
Converts an instruction to a string | This structure defines the abstract syntax for MIPS assembly
* language that we will be using . It should be fairly self-
* explanatory .
*
* IMPORTANT : do not use registers R1 , R26 , or R27 as these
* are reserved by the assembler and operating system . See
* page A-24 of the MIPS documenta... |
109f403c0a0eb68a5de0307c2f21d764bb82a219c8ba031798bcb885629c0527 | LightTable/LightTable | deploy.cljs | (ns lt.objs.deploy
"Provide behaviors to check for app updates and fns for downloading
and unpacking downloaded assets"
(:require [lt.object :as object]
[lt.objs.clients :as clients]
[lt.objs.files :as files]
[lt.objs.popup :as popup]
[lt.objs.cache :as cache]
... | null | https://raw.githubusercontent.com/LightTable/LightTable/3760844132a17fb0c9cf3f3b099905865aed7e3b/src/lt/objs/deploy.cljs | clojure | TODO: get-proxy
Ensure only version tags
*********************************************************
Behaviors
*********************************************************
(when-let [proxy (proxy?)]
(.defaults request (clj->js {:proxy proxy}))) | (ns lt.objs.deploy
"Provide behaviors to check for app updates and fns for downloading
and unpacking downloaded assets"
(:require [lt.object :as object]
[lt.objs.clients :as clients]
[lt.objs.files :as files]
[lt.objs.popup :as popup]
[lt.objs.cache :as cache]
... |
28a85cf282678e94b1e93bf3c4caed636f4f3beeaa235d8c7d14c1b59ccd4d19 | openbadgefactory/salava | badges_test.clj | (ns salava.gallery.badges-test
(:require [midje.sweet :refer :all]
[salava.test-utils :refer [test-api-request login! logout! test-user-credentials]]))
(def test-user 4)
(def another-user 5)
(def user-with-no-public-badges 3)
(def public-badge-id "f6e2a6480a832a29200007cfc602ed7e79b9ccb00b2611c58041e7... | null | https://raw.githubusercontent.com/openbadgefactory/salava/97f05992406e4dcbe3c4bff75c04378d19606b61/test_old/clj/salava/gallery/badges_test.clj | clojure | (ns salava.gallery.badges-test
(:require [midje.sweet :refer :all]
[salava.test-utils :refer [test-api-request login! logout! test-user-credentials]]))
(def test-user 4)
(def another-user 5)
(def user-with-no-public-badges 3)
(def public-badge-id "f6e2a6480a832a29200007cfc602ed7e79b9ccb00b2611c58041e7... | |
364f9cffd03098ebe021ea9e01fe8c91e812e47e848f02bdb716b4b3d288df68 | GaloisInc/msf-haskell | Host.hs | |Various types of hosts that Metasploit might interact
-- with. Particularly, /attackable/ and /scannable/ hosts.
{-# LANGUAGE EmptyDataDecls #-}
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE FunctionalDependencies #
module MSF.Host where
import MsgPack
-- | A metasploit framework RPC server.
data Server
-- | A ... | null | https://raw.githubusercontent.com/GaloisInc/msf-haskell/76cee10771f9e9d10aa3301198e09f08bde907be/src/MSF/Host.hs | haskell | with. Particularly, /attackable/ and /scannable/ hosts.
# LANGUAGE EmptyDataDecls #
| A metasploit framework RPC server.
| A host that can have attacks launched against it.
| A host that can be scanned.
Individual Hosts ------------------------------------------------------------
| A host is just a name or an add... | |Various types of hosts that Metasploit might interact
# LANGUAGE MultiParamTypeClasses #
# LANGUAGE FunctionalDependencies #
module MSF.Host where
import MsgPack
data Server
data Attackable
data Scannable
class ScanCxt t
instance ScanCxt Scannable
instance ScanCxt Attackable
class ScanCxt t => AttackCxt t
i... |
137eaba14e94da9e02d1e3dec1226c902eb9180d50f97d8db0b8f5970e43ba47 | mRrvz/bmstu-ca | Main.hs | import Parse
import Spline
import System.IO
main :: IO ()
main = do
handle <- openFile "table.csv" ReadMode
content <- hGetContents handle
let table = parseTable $ lines content
mapM_ print table
hClose handle
putStrLn "Enter X:"
x0 <- fmap toDouble getLine
putStr "Result: "
print... | null | https://raw.githubusercontent.com/mRrvz/bmstu-ca/866a32b37878d45006ec3c4f99f67983ae681717/lab_03/src/Main.hs | haskell | import Parse
import Spline
import System.IO
main :: IO ()
main = do
handle <- openFile "table.csv" ReadMode
content <- hGetContents handle
let table = parseTable $ lines content
mapM_ print table
hClose handle
putStrLn "Enter X:"
x0 <- fmap toDouble getLine
putStr "Result: "
print... | |
67d4f4cc76485da655558e5693602851352f97d6e953f559b00086c170706e02 | erleans/erleans | stateless_test_grain.erl | %%% ---------------------------------------------------------------------------
@author < >
2016 Space - Time Insight < >
%%%
%%% @doc A test grain that increments a counter every time it is activated.
%%% @end
%%% ---------------------------------------------------------------------------
-module(stateless_te... | null | https://raw.githubusercontent.com/erleans/erleans/ecccf9e900f23660847bd63555b54478e9a00530/test/stateless_test_grain.erl | erlang | ---------------------------------------------------------------------------
@doc A test grain that increments a counter every time it is activated.
@end
---------------------------------------------------------------------------
===================================================================
==================... | @author < >
2016 Space - Time Insight < >
-module(stateless_test_grain).
-behaviour(erleans_grain).
-export([placement/0,
provider/0,
node/1,
deactivated_counter/1,
activated_counter/1,
call_counter/1,
hold/1,
pid/1]).
-export([state/1,
... |
4f10b37c9d25fa72e4fd9f61dfa8dc949343de08769e91f55a31cca922313386 | yueyoum/codebattle-server | cb_observer_sup.erl | -module(cb_observer_sup).
-behaviour(supervisor).
%% API
-export([start_link/0,
create_observer/1]).
%% Supervisor callbacks
-export([init/1]).
-define(CHILD(Id, Mod, Type, Args), {Id, {Mod, start_link, Args},
temporary, brutal_kill, Type, [Mod]}).
%%%==================... | null | https://raw.githubusercontent.com/yueyoum/codebattle-server/5e8ae24649be14eb7c3dc1910502bf88af97ed8d/src/cb_observer_sup.erl | erlang | API
Supervisor callbacks
===================================================================
API functions
===================================================================
--------------------------------------------------------------------
@doc
Starts the supervisor
@end
-------------------------------------... | -module(cb_observer_sup).
-behaviour(supervisor).
-export([start_link/0,
create_observer/1]).
-export([init/1]).
-define(CHILD(Id, Mod, Type, Args), {Id, {Mod, start_link, Args},
temporary, brutal_kill, Type, [Mod]}).
( ) - > { ok , Pid } | ignore | { error , Error... |
4e662a7c304d6ec388872b705b38169fec42f0e217589721d73f8801a115ad3f | bn-d/ppx_pyformat | utils.mli | val get_arg_name : int -> string
val parse : string -> Types.elements
| null | https://raw.githubusercontent.com/bn-d/ppx_pyformat/bcb0031cf9fbce12d54d0e8d927ecf41ff3cab97/src/utils.mli | ocaml | val get_arg_name : int -> string
val parse : string -> Types.elements
| |
e58cecc2129f4d7b5273c0c12e20bcbb17b077d0ba56b34c6d692bbcc3353113 | charlieg/Sparser | arg-str-original.lisp | ;;; -*- Mode:LISP; Syntax:Common-Lisp; Package:(CTI-source LISP) -*-
copyright ( c ) 1990,1991 Content Technologies Inc. -- all rights reserved
;;;
;;; File: "arg str"
Module : " model forms;sl : whos news : acts : "
version : February 1991 ( v1.8.1 )
(in-package :CTI-source)
;;;... | null | https://raw.githubusercontent.com/charlieg/Sparser/b9bb7d01d2e40f783f3214fc104062db3d15e608/Sparser/code/s/grammar/model/sl/Who's-News/acts/arg%20str/arg-str-original.lisp | lisp | -*- Mode:LISP; Syntax:Common-Lisp; Package:(CTI-source LISP) -*-
File: "arg str"
---------------------------------------------------------
subcategorization frames of the various job event-types
---------------------------------------------------------
------------------------------------------
passive -- pro... | copyright ( c ) 1990,1991 Content Technologies Inc. -- all rights reserved
Module : " model forms;sl : whos news : acts : "
version : February 1991 ( v1.8.1 )
(in-package :CTI-source)
(def-category job-event/co!__pers!title-pp)
(def-category job-event/co!__pers!title)
(def-category... |
84dbde3ae06def9d24bf4713da16af669c2402fc5b50f66d6443be1b3297e498 | c4-project/c4f | ast.ml | This file is part of c4f .
Copyright ( c ) 2018 - 2022 C4 Project
c4 t itself is licensed under the MIT License . See the LICENSE file in the
project root for more information .
Parts of c4 t are based on code from the Herdtools7 project
( ) : see the LICENSE.herd file in the
project... | null | https://raw.githubusercontent.com/c4-project/c4f/8939477732861789abc807c8c1532a302b2848a5/lib/litmus/src/ast.ml | ocaml | * [M] allows AST type creation through referring to an existing language
module. | This file is part of c4f .
Copyright ( c ) 2018 - 2022 C4 Project
c4 t itself is licensed under the MIT License . See the LICENSE file in the
project root for more information .
Parts of c4 t are based on code from the Herdtools7 project
( ) : see the LICENSE.herd file in the
project... |
fa4037474b17f350b4302850dc845f75d77d2a8086f51cdaa412a56c300000aa | coot/free-algebras | Free.hs | {-# LANGUAGE CPP #-}
# LANGUAGE TemplateHaskell #
module Test.Data.Group.Free
( tests
) where
#if __GLASGOW_HASKELL__ < 808
import Data.Semigroup (Semigroup (..))
#endif
import Data.Bool (bool)
import Data.Group (invert)
import Data.DList (DList)
import quali... | null | https://raw.githubusercontent.com/coot/free-algebras/78481662438a66d0af217133eab7769d44bc77e2/test/Test/Data/Group/Free.hs | haskell | # LANGUAGE CPP # | # LANGUAGE TemplateHaskell #
module Test.Data.Group.Free
( tests
) where
#if __GLASGOW_HASKELL__ < 808
import Data.Semigroup (Semigroup (..))
#endif
import Data.Bool (bool)
import Data.Group (invert)
import Data.DList (DList)
import qualified Data.DList as DList
import ... |
133992bccacb4d2702e441b9f5f32d2516a721a06c2207668c1ae1cc7e09a20b | cedlemo/OCaml-GLib2 | gen.ml | module BG = GI_bindings_generator
module Loader = BG.Loader
(** The namespace to be loaded: ie. the lib for which the bindings will be
* generated. *)
let namespace = "GLib"
let version = "2.0"
* A suffix for the filenames of the raw bindings of the Core part . For example ,
* all the constants and functions ... | null | https://raw.githubusercontent.com/cedlemo/OCaml-GLib2/084a148faa4f18d0ddf78315d57c1d623aa9522c/generator/gen.ml | ocaml | * The namespace to be loaded: ie. the lib for which the bindings will be
* generated.
* Instead of generate all the data structures (and theirs related methods or
* constants), the idea is to choose what is needed.
* One can choose to skip the bindings of some constants because they are not
* needed or because ... | module BG = GI_bindings_generator
module Loader = BG.Loader
let namespace = "GLib"
let version = "2.0"
* A suffix for the filenames of the raw bindings of the Core part . For example ,
* all the constants and functions defined directly in the namespace are defined
* in a " Core " module and generated in " ... |
30981cf17e01c5d826ae1ad4d84c571dc1a16d03f654ff41c283d4098776098a | SquidDev/urn | matrix.lisp | (import test ())
(import math/numerics ())
(import math/matrix ())
(describe "The math library has matrices which"
(can "be compared"
(affirm (eq? (matrix 2 2 1 2 3 4) (matrix 2 2 1 2 3 4))
(neq? (matrix 2 2 1 2 3 4) (matrix 2 2 1 2 4 3))))
(can "be queried"
(with (m (matrix 2 2 1 2 3 4))
... | null | https://raw.githubusercontent.com/SquidDev/urn/6e6717cf1376b0950e569e3771cb7e287aed291d/tests/lib/math/matrix.lisp | lisp | (import test ())
(import math/numerics ())
(import math/matrix ())
(describe "The math library has matrices which"
(can "be compared"
(affirm (eq? (matrix 2 2 1 2 3 4) (matrix 2 2 1 2 3 4))
(neq? (matrix 2 2 1 2 3 4) (matrix 2 2 1 2 4 3))))
(can "be queried"
(with (m (matrix 2 2 1 2 3 4))
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.