Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add missing symbols to the export list.
;;;; $Id$ ;;;; $URL$ ;;;; See the LICENSE file for licensing information. #+lispworks (cl:require "comm") (cl:eval-when (:execute :load-toplevel :compile-toplevel) (cl:defpackage :usocket (:use :cl) (:export #:*wildcard-host* #:*auto-port* #:socket-connect ; socket constructors...
;;;; $Id$ ;;;; $URL$ ;;;; See the LICENSE file for licensing information. #+lispworks (cl:require "comm") (cl:eval-when (:execute :load-toplevel :compile-toplevel) (cl:defpackage :usocket (:use :cl) (:export #:*wildcard-host* #:*auto-port* #:socket-connect ; socket constructors...
Deal with NIL to add.
; tré – Copyright (c) 2010–2014,2016 Sven Michael Klose <pixel@copei.de> (defun path-append (dir &rest path-components) (@ (x path-components dir) (= dir (+ (trim-tail dir "/") "/" (trim x "/")))))
; tré – Copyright (c) 2010–2014,2016 Sven Michael Klose <pixel@copei.de> (defun path-append (dir &rest path-components) (@ (x (remove-if #'not path-components) dir) (= dir (+ (trim-tail dir "/") "/" (trim x "/")))))
Update .asd to allow YARTY to watch tests file
;;;; dishes.asd (asdf:defsystem #:dishes :serial t :description "Some simple reader macros." :author "Matt Niemeir <matt.niemeir@gmail.com>" :license "BSD 2-clause" :depends-on () :components ((:file "package") (:file "utils") (:file "dishes"))) (asdf:defsystem #:dishes-test ...
;;;; dishes.asd (asdf:defsystem #:dishes :serial t :description "Some simple reader macros." :author "Matt Niemeir <matt.niemeir@gmail.com>" :license "BSD 2-clause" :depends-on () :components ((:file "package") (:file "utils") (:file "dishes")) :in-order-to ((test-op (load-o...
Add condition reporter for new condition.
(cl:in-package #:sicl-data-and-control-flow) (defmethod cleavir-i18n:report-condition ((condition odd-number-of-arguments-to-setf) stream (langauge cleavir-i18n:english)) (format stream "An odd number of arguments was given to SETF~@ in the following form:~@ ~s" (for...
(cl:in-package #:sicl-data-and-control-flow) (defmethod cleavir-i18n:report-condition ((condition odd-number-of-arguments-to-setf) stream (langauge cleavir-i18n:english)) (format stream "An odd number of arguments was given to SETF~@ in the following form:~@ ~s" (for...
Define TEST-OP within DEFSYSTEM (the modern way)
;;; -*- Lisp -*- (defsystem :split-sequence :author "Arthur Lemmens <alemmens@xs4all.nl>" :maintainer "Sharp Lispers <sharplispers@googlegroups.com>" :description "Splits a sequence into a list of subsequences delimited by objects satisfying a test." :license "MIT" :version (:read-file-form "version.sexp")...
;;; -*- Lisp -*- (defsystem :split-sequence :author "Arthur Lemmens <alemmens@xs4all.nl>" :maintainer "Sharp Lispers <sharplispers@googlegroups.com>" :description "Splits a sequence into a list of subsequences delimited by objects satisfying a test." :license "MIT" :version (:read-file-form "version.sexp")...
Add method specialized to ENTER-INSTRUCTION.
(cl:in-package #:cleavir-remove-useless-instructions) (defgeneric instruction-may-be-removed-p (instruction)) (defmethod instruction-may-be-removed-p (instruction) (and (= (length (cleavir-ir:successors instruction)) 1) (loop for output in (cleavir-ir:outputs instruction) always (null (cleavir-ir:using...
(cl:in-package #:cleavir-remove-useless-instructions) (defgeneric instruction-may-be-removed-p (instruction)) (defmethod instruction-may-be-removed-p (instruction) (and (= (length (cleavir-ir:successors instruction)) 1) (loop for output in (cleavir-ir:outputs instruction) always (null (cleavir-ir:using...
Add description to .asd file.
;; ;; Copyright (c) 2010, Peter Seibel. All rights reserved. ;; (defsystem com.gigamonkeys.markup :name "com.gigamonkeys.markup" :components ((:file "packages") (:file "markup" :depends-on ("packages")) (:file "tests" :depends-on ("packages"))) :depends-on (:cl-ppcre :com.gigamonkeys.macro-utilities...
;; ;; Copyright (c) 2010, Peter Seibel. All rights reserved. ;; (defsystem com.gigamonkeys.markup :name "com.gigamonkeys.markup" :description "Library for parsing Markup-formatted text." :components ((:file "packages") (:file "markup" :depends-on ("packages")) (:file "tests" :depends-on ("packages"))) ...
Refactor extract-wide-char to avoid using plists
(in-package :de.anvi.croatoan) (defun extract-wide-char (window &key y x) "Extract and return a wide character (code > 255) from the window. If the destination coordinates y and x are given, first move the cursor." (when (and y x) (move window y x)) ;; we absolutely need cchar_t here, cchar crashes sbcl. (wit...
(in-package :de.anvi.croatoan) (defun extract-wide-char (window &key y x) "Extract and return a single (complex) character from the window. This includes wide characters (code > 255), and requires the ncursesw library. If the destination coordinates y and x are given, move the cursor first." (when (and y x) (mov...
Use FiveAM's new random testing for the parse-float test
;;;; -*- lisp -*- (in-package :it.bese.arnesi) (def-suite :it.bese.arnesi.numbers :in :it.bese.arnesi) (in-suite :it.bese.arnesi.numbers) (test mulf (let ((a 0)) (is (= 0 (mulf a 10))) (is (= 0 a))) (let ((a 1)) (is (= 4 (mulf a 4))) (is (= 1 (mulf a (/ 4)))) (is (= 1 a)))) (test minf (l...
;;;; -*- lisp -*- (in-package :it.bese.arnesi) (def-suite :it.bese.arnesi.numbers :in :it.bese.arnesi) (in-suite :it.bese.arnesi.numbers) (test mulf (let ((a 0)) (is (= 0 (mulf a 10))) (is (= 0 a))) (let ((a 1)) (is (= 4 (mulf a 4))) (is (= 1 (mulf a (/ 4)))) (is (= 1 a)))) (test minf (l...
Allow flags -r and -f.
;;;; TRE environment ;;;; Copyright (c) 2008 Sven Klose <pixel@copei.de> ;;;; ;;;; UN*X shell commands (defun unix-sh-rm (file) (exec "/bin/rm" (list file))) (defun unix-sh-mv (from to) (exec "/bin/mv" (list from to))) (defun unix-sh-cp (from to &key (recursively? nil)) (exec "/bin/cp" (append (when recursivel...
;;;; TRE environment ;;;; Copyright (c) 2008 Sven Klose <pixel@copei.de> ;;;; ;;;; UN*X shell commands (defun unix-sh-rm (file &key (recursively? nil) (force? nil)) (exec "/bin/rm" (append (when recursively? (list "-r")) (when force? (list "-f")) (list file)))) (defun unix-sh-mv ...
Use default values for keyword arguments.
;;;;; TRE to ECMAScript transpiler ;;;;; Copyright (c) 2009 Sven Klose <pixel@copei.de> (defun hash-table? (x) (and (objectp x) (undefined? x.__class))) (defun hash-assoc (x) (let lst nil (maphash #'((k v) (push! (cons k v) lst)) x) (reverse lst))) ;; XXX test is ignored. (defun a...
;;;;; TRE to ECMAScript transpiler ;;;;; Copyright (c) 2009-2010 Sven Klose <pixel@copei.de> (defun hash-table? (x) (and (objectp x) (undefined? x.__class))) (defun hash-assoc (x) (let lst nil (maphash #'((k v) (push! (cons k v) lst)) x) (reverse lst))) ;; XXX test is ignored. (de...
Fix access to form data array.
;;;;; Copyright (c) 2012–2014 Sven Michael Klose <pixel@copei.de> (defvar *contact-to*) (defvar *contact-subject*) (defun contact-mail-header () (alet (@ (form-data) 'email) (+ "From: " ! *terpri* "Reply-To: " ! *terpri*))) (defun send-contact-mail () (mail *contact-to* *contact-subject* (@ (f...
; Copyright (c) 2012–2014,2016 Sven Michael Klose <pixel@copei.de> (defvar *contact-to*) (defvar *contact-subject*) (defun contact-mail-header () (alet (href (form-data) 'email) (+ "From: " ! *terpri* "Reply-To: " ! *terpri*))) (defun send-contact-mail () (mail *contact-to* *contact-subject* (...
Use option :SERIAL T for test system.
(cl:in-package #:asdf-user) (defsystem :sicl-format-test :depends-on (:lisp-unit :sicl-format) :components ((:file "format-test" :depends-on ())))
(cl:in-package #:asdf-user) (defsystem :sicl-format-test :depends-on (:lisp-unit :sicl-format) :serial t :components ((:file "format-test")))
Call function LEAVE when moving up the tree.
(cl:in-package #:clump-binary-tree) (defgeneric iterative-traversal (tree enter)) (defmethod iterative-traversal ((tree node-with-parent) enter leave) (let ((current-node tree)) (loop do (if (or (not (funcall enter current-node)) (and (null (left current-node)) (null (right current-node)))) (loop...
(cl:in-package #:clump-binary-tree) (defgeneric iterative-traversal (tree enter)) (defmethod iterative-traversal ((tree node-with-parent) enter leave) (let ((current-node tree)) (loop do (if (or (not (funcall enter current-node)) (and (null (left current-node)) (null (right current-node)))) (loop...
Revert "Add the system CFFI-LIBFFI to ASDF dependencies."
(asdf:defsystem cl-libevent2 :author "Andrew Danger Lyon <orthecreedence@gmail.com>" :license "MIT" :version "0.1.5" :description "Low-level libevent2 bindings for Common Lisp." :depends-on (#:cffi #:cffi-libffi) :components ((:file "libevent2") (:file "wrapper" :depends-on ("libevent2")) ...
(asdf:defsystem cl-libevent2 :author "Andrew Danger Lyon <orthecreedence@gmail.com>" :license "MIT" :version "0.1.5" :description "Low-level libevent2 bindings for Common Lisp." :depends-on (#:cffi) :components ((:file "libevent2") (:file "wrapper" :depends-on ("libevent2")) (:...
Use proper argument order for IS.
(cl:defpackage #:cartesian-product-switch_tests (:use #:cl #:parachute) (:import-from #:cartesian-product-switch #:cartesian-product-switch)) (cl:in-package #:cartesian-product-switch_tests) (define-test "featured-example" (flet ((test (manner direction expected) (flet ((invoke () ...
(cl:defpackage #:cartesian-product-switch_tests (:use #:cl #:parachute) (:import-from #:cartesian-product-switch #:cartesian-product-switch)) (cl:in-package #:cartesian-product-switch_tests) (define-test "featured-example" (flet ((test (manner direction expected) (flet ((invoke () ...
Define method on COMPILE-AST specialized to DEBUG-AST.
(cl:in-package #:cleavir-ast-to-hir) (defmethod compile-ast ((ast cleavir-ast:speed-ast) context) (compile-ast (cleavir-ast:child-ast ast) (clone-context context :speed-value (cleavir-ast:value ast))))
(cl:in-package #:cleavir-ast-to-hir) (defmethod compile-ast ((ast cleavir-ast:speed-ast) context) (compile-ast (cleavir-ast:child-ast ast) (clone-context context :speed-value (cleavir-ast:value ast)))) (defmethod compile-ast ((ast cleavir-ast:debug-ast) context) (compile-ast (cleavir-ast:child-as...
Add a slot to the VALUE-DESIGNATOR class for unique number.
(cl:in-package #:cleavir-simple-value-numbering) ;;; We attribute a unique number to each value designator. That way, ;;; we can keep the value designators in a partition sorted by the ;;; unique number which makes operations on partitions faster. ;;; ;;; This variable should be bound to some small integer at the ;;;...
(cl:in-package #:cleavir-simple-value-numbering) ;;; We attribute a unique number to each value designator. That way, ;;; we can keep the value designators in a partition sorted by the ;;; unique number which makes operations on partitions faster. ;;; ;;; This variable should be bound to some small integer at the ;;;...
Set the margin of Graphviz graphs to zero.
;;;; © 2016-2019 Marco Heisig - license: GNU AGPLv3 -*- coding: utf-8 -*- (in-package #:petalisp.graphviz) (defparameter *graphviz-default-viewer* (flet ((program-in-path-p (program) (multiple-value-bind (out err exit-code) (uiop:run-program (list "which" program) ...
;;;; © 2016-2019 Marco Heisig - license: GNU AGPLv3 -*- coding: utf-8 -*- (in-package #:petalisp.graphviz) (defparameter *graphviz-default-viewer* (flet ((program-in-path-p (program) (multiple-value-bind (out err exit-code) (uiop:run-program (list "which" program) ...
Use OR to guard instead of IF.
(in-package :coleslaw) (defclass post (content) ((title :initform nil :initarg :title :accessor post-title) (author :initform nil :initarg :author :accessor post-author) (format :initform nil :initarg :format :accessor post-format))) (defmethod initialize-instance :after ((object post) &key) (with-accessors...
(in-package :coleslaw) (defclass post (content) ((title :initform nil :initarg :title :accessor post-title) (author :initform nil :initarg :author :accessor post-author) (format :initform nil :initarg :format :accessor post-format))) (defmethod initialize-instance :after ((object post) &key) (with-accessors...
Define ASDF system in package ASDF-USER.
;;;; Copyright (c) 2008 - 2013 ;;;; ;;;; Robert Strandh (robert.strandh@gmail.com) ;;;; ;;;; all rights reserved. ;;;; ;;;; Permission is hereby granted to use this software for any ;;;; purpose, including using, modifying, and redistributing it. ;;;; ;;;; The software is provided "as-is" with no warranty. The u...
;;;; Copyright (c) 2008 - 2013 ;;;; ;;;; Robert Strandh (robert.strandh@gmail.com) ;;;; ;;;; all rights reserved. ;;;; ;;;; Permission is hereby granted to use this software for any ;;;; purpose, including using, modifying, and redistributing it. ;;;; ;;;; The software is provided "as-is" with no warranty. The u...
Load conditional macros into target environment.
(cl:in-package #:sicl-extrinsic-hir-compiler) (defun rp (filename) (asdf:system-relative-pathname :sicl-extrinsic-hir-compiler filename)) (load (rp "../../Evaluation-and-compilation/lambda.lisp")) (load (rp "../../Environment/multiple-value-bind.lisp")) (load (rp "../../Data-and-control-flow/setf.lisp")) (load (rp ...
(cl:in-package #:sicl-extrinsic-hir-compiler) (defun rp (filename) (asdf:system-relative-pathname :sicl-extrinsic-hir-compiler filename)) (load (rp "../../Evaluation-and-compilation/lambda.lisp")) (load (rp "../../Environment/multiple-value-bind.lisp")) (load (rp "../../Data-and-control-flow/setf.lisp")) (load (rp ...
Use NCONC instead of %NCONC.
;;;;; tré – Copyright (c) 2008–2013 Sven Michael Klose <pixel@copei.de> (dont-obfuscate *lexicals* *lexical-id* function_exists call_user_func_array) (defun apply (&rest lst) (with (fun lst. l (last .lst) args (%nconc (butlast .lst) l.) closure? (is...
; tré – Copyright (c) 2008–2013,2015 Sven Michael Klose <pixel@copei.de> (dont-obfuscate *lexicals* *lexical-id* function_exists call_user_func_array) (defun apply (&rest lst) (with (fun lst. l (last .lst) args (nconc (butlast .lst) l.) closure? (is...
Use explicit package marker with IN-PACKAGE.
(in-package #:sicl-global-environment) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Constant NIL. (eval-when (:compile-toplevel :load-toplevel :execute) (push (make-constant-variable-entry nil nil) (constant-variables *global-environment*))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;...
(cl:in-package #:sicl-global-environment) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Constant NIL. (eval-when (:compile-toplevel :load-toplevel :execute) (push (make-constant-variable-entry nil nil) (constant-variables *global-environment*))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;...
Add locally defined environment query functions as component.
(cl:in-package #:common-lisp-user) (asdf:defsystem :cleavir-generate-ast :depends-on (:cleavir-ast :cleavir-primop :cleavir-code-utilities :cleavir-environment) :serial t :components ((:file "packages") (:file "conditions") (:file "check-special-form-syntax") (:file "minimal-co...
(cl:in-package #:common-lisp-user) (asdf:defsystem :cleavir-generate-ast :depends-on (:cleavir-ast :cleavir-primop :cleavir-code-utilities :cleavir-environment) :serial t :components ((:file "packages") (:file "conditions") (:file "check-special-form-syntax") (:file "environmen...
Use new environment function to find function name in trace.
(cl:in-package #:sicl-extrinsic-environment) (defparameter *trace-funcall* nil) (defparameter *depth* 0) (defun traced-funcall (environment function &rest arguments) (if *trace-funcall* (let* ((entries (sicl-simple-environment::function-entries environment)) (entry (block nil (maphash ...
(cl:in-package #:sicl-extrinsic-environment) (defparameter *trace-funcall* nil) (defparameter *depth* 0) (defun traced-funcall (environment function &rest arguments) (if *trace-funcall* (let ((name (or (car (sicl-genv:function-names function environment)) "???")) (result nil)) (loop repeat *dep...
Add ASDF guard to the .asd file
;;; -*- Lisp -*- (defsystem :split-sequence :author "Arthur Lemmens <alemmens@xs4all.nl>" :maintainer "Sharp Lispers <sharplispers@googlegroups.com>" :description "Splits a sequence into a list of subsequences delimited by objects satisfying a test." :license "MIT" :version (:read-file-form "version.sexp")...
;;; -*- Lisp -*- #.(unless (or #+asdf3.1 (version<= "3.1" (asdf-version))) (error "You need ASDF >= 3.1 to load this system correctly.")) (defsystem :split-sequence :author "Arthur Lemmens <alemmens@xs4all.nl>" :maintainer "Sharp Lispers <sharplispers@googlegroups.com>" :description "Splits a sequence into ...
Use option :SERIAL T to simplify system.
(cl:in-package #:asdf-user) (defsystem :cleavir-def-use-chains-test :depends-on (:cleavir-def-use-chains :cleavir-test-utilities) :components ((:file "test-packages") (:file "test-def-use-chains" :depends-on ("test-packages"))))
(cl:in-package #:asdf-user) (defsystem :cleavir-def-use-chains-test :depends-on (:cleavir-def-use-chains :cleavir-test-utilities) :serial t :components ((:file "test-packages") (:file "test-def-use-chains")))
Add English documentation for function (SETF LEFT).
(cl:in-package #:clump-binary-tree) (setf (documentation 'left 'function) (format nil "Given a binary tree, return the left child of that tree.~@ If an object other than a binary tree is given,~@ then an error of type INVALID-BINARY-TREE is signaled.")) (setf (documentation...
(cl:in-package #:clump-binary-tree) (setf (documentation 'left 'function) (format nil "Given a binary tree, return the left child of that tree.~@ If an object other than a binary tree is given,~@ then an error of type INVALID-BINARY-TREE is signaled.")) (setf (documentation...
Define system in package ASDF-USER.
(cl:in-package #:common-lisp-user) (asdf:defsystem :cleavir-register-allocation :depends-on (:cleavir-liveness :cleavir-ir :cleavir-hir :cleavir-mir) :components ((:file "packages") (:file "compute-conflicts") (:file "graph-coloring")))
(cl:in-package #:asdf-user) (defsystem :cleavir-register-allocation :depends-on (:cleavir-liveness :cleavir-ir :cleavir-hir :cleavir-mir) :components ((:file "packages") (:file "compute-conflicts") (:file "graph-coloring")))
Define system in package ASDF-USER.
(cl:in-package #:common-lisp-user) (asdf:defsystem :cleavir-hir-interpreter :depends-on (:cleavir-hir :cleavir-hir-transformations :cleavir-basic-blocks) :serial t :components ((:file "packages") (:file "translate")))
(cl:in-package #:asdf-user) (defsystem :cleavir-hir-interpreter :depends-on (:cleavir-hir :cleavir-hir-transformations :cleavir-basic-blocks) :serial t :components ((:file "packages") (:file "translate")))
Add copyright dates and license statement.
(cl:in-package #:sicl-clos) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; Class SIMPLE-METHOD-COMBINATION. (defclass simple-method-combination (method-combination) ((%operation :initarg :operation :reader operation)))
;;;; Copyright (c) 2010 - 2015 ;;;; ;;;; Robert Strandh (robert.strandh@gmail.com) ;;;; ;;;; All rights reserved. ;;;; ;;;; Redistribution and use in source and binary forms, with or ;;;; without modification, are permitted provided that the following ;;;; conditions are met: ;;;; ;;;; 1. Redistributions of source ...
Package setup and misc fixes for running on CLISP.
(defpackage #:clim-mop (:use #:clos)) (eval-when (:compile-toplevel :load-toplevel :execute) (loop for sym being the symbols of :clim-mop do (export sym :clim-mop))) ;; CLIM expects INPUT-STREAM-P to be a generic function. (unless (typep #'input-stream-p 'generic-function) (setf (fdefinition 'gray::origina...
Add a couple of failign tests for codegen
(import extra/test ()) (import extra/assert ()) (import tests/compiler/codegen/codegen-helpers ()) (describe "The codegen will generate syntactically valid Lua for" (section "symbols that are" (it "empty" (affirm-codegen ~((define ,(string->symbol "") 2)) "_e = 2")) (pending "numbers" ...
Add skeleton for the connection module
(in-package :cqlcl) (defclass connection () ((streams :accessor streams) (version :accessor vsn))) (defclass cql-stream () ((id :accessor id :initarg id)))
Add some skelton of test suite
(cl:defpackage :csv-filter-test (:use :cl :csv-filter :rt) (:import-from :rt #:*expected-failures*) ) (rt:rem-all-tests)
Copy "Surprise" from The Roots of Lisp
(defun eval. (e a) (cond ((atom e) (assoc. e a)) ((atom (car e)) (cond ((eq (car e) 'quote) (cadr e)) ((eq (car e) 'atom) (atom (eval. (cadr e) a))) ((eq (car e) 'eq) (eq (eval. (cadr e) a) (eval. (caddr e) a))) ((eq (car e) 'car) ...
Add an initial implementation of a naive TYPE-DEFINED-P (SBCL)
;; common-impl-type.lisp - Implementation Support for Type Sys. Reflection, SBCL ;;------------------------------------------------------------------------------ ;; ;; Copyright (c) 2014-2019 Sean Champ and others. All rights reserved. ;; ;; This program and the accompanying materials are made available under the ;; te...
Add solution for Problem009 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (defun pythagorean (a b c) (= (+ (* a a) (* b b)) (* c c))) (defun solution() (loop for a from 1 to 998 do (loop for b from a to 998 do (loop for c from b to 998 when (and (= 1000 (+ a b c)) (pythagorean a b c)) ...
Create system definition file for streamlets tests.
;;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*- ;;;; Copyright (C) 2014 Varoun. P ;;;; This program is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU Affero General Public License as ;;;; published by the Free Software Foundation, eith...
Add solution for Problem006 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (defun square (x) (* x x)) ;; (1 2 3) => 1² + 2² + 3² => 14 (defun square-sum (list) (reduce #'+ (mapcar #'square list))) ;; (1 2 3) => (1 + 2 + 3)² => 6² => 36 (defun sum-square (list) (square (reduce #'+ list))) (defun solution(n) (let ((numbers...
Add solution for Problem063 written in Common Lisp
(defun range (n) (loop for x from 1 to n collect x)) (defun ilength (n) (length (write-to-string n))) (defun solution() (loop for a in (range 9) for tries = (loop for n in (range 21) for x = (expt a n) when (= (ilength x) n) ...
Add class and method for sockets
;; Some parts of tls require an implementation to perform ;; http, ldap, or other kind of network-based communication. ;; Defined here are classes and methods to be specialized to ;; provide such service (in-package :cl-tls) (defclass address () ((host :initarg :host :accessor host) (port :initarg :port :acce...
Add a simple test suite in lisp
#!./interpreter.py (set! testsFailed 0) (set! testsSuccess 0) (set! should (lambda (assertion msg) (if assertion (set! testsSuccess (+ testsSuccess 1)) (begin (display (+ "Test failed : " msg)) (set! testsFailed (+ testsFailed 1)) ) ) ) ) (set! shouldEqual (lam...
Add inital code about text game engine on cap5
;; Common Lisp Script ;; Manoel Vilela (defparameter *nodes* '((living-room (you are in the living-room. a wizard is snoring loudly on the couch.)) (garden (you are in a beatiful garden. there is a well in front of you.)) ...
Add indexing example (doesn't work yet).
;; $Id: example-1.lisp,v 1.1 2006-08-11 12:52:53 alemmens Exp $ (in-package :test-rucksack) ;; NOTE: This example doesn't run at the moment, because indexing doesn't ;; work correctly yet. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Indexing, class redefinitions ;;;;;;;;;;;;;;...
Set 1, Challenge 1 in Lisp
(ql:quickload '(:arrow-macros :s-base64)) (use-package :arrow-macros) (defvar *s1c1-hex* "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d") (defvar *s1c1-base64* "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t") (defun bytes->string (bytes) "Takes a...
Add tests as a PoC. Do not for merge.
(stefil:define-test-package :twitter-summary-card-tests (:use :cl :coleslaw :cl-ppcre)) (in-package :twitter-summary-card-tests) ;;;; ;; To run tests first eval the plugin code inside this package and then execute ;; (twitter-summary-card-test:run-package-tests) ;;; (defvar *short-post* (make-ins...
Implement hex string to bytes
;;;; strings.lisp (in-package #:cryptopals) (defconstant +ascii-hex+ '((#\0 . #x0) (#\1 . #x1) (#\2 . #x2) (#\3 . #x3) (#\4 . #x4) (#\5 . #x5) (#\6 . #x6) (#\7 . #x7) (#\8 . #x8) (#\9 . #x9) (#\a . #xa) (#\b . #xb) (#\c . #xc) (#\...
Add prototype from 15 November 2017 - [SYCAMOPE] wkspace
(defmacro eval-when-test ((&rest specifers) &body body &enviroment environment) ) ;; TBD: ;; - Test Specifiers - Syntax and Application Behaviors ;; - Test Naming ;; - Test Grouping ;; - Test Evaluation Constraints ;; - Code Evaluation Phase (onto ANSI CL vis....
Add solution for Problem002 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (defun fib (n) (labels ((tail-fib (n a b) (if (= n 0) a (tail-fib (1- n) b (+ a b))))) (tail-fib n 0 1))) (defun solution () (format t "~a~%" (loop for x from 0 ...
Add solution for Problem004 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (defun reverse-digits (n) (labels ((next (n v) (if (zerop n) v (multiple-value-bind (q r) (truncate n 10) (next q (+ (* v 10) r)))))) (next n 0))) (defun palindromep (n) (= n (reverse-...
Add sample for jagged structs
(declare (jagged (struct (a integer) (b byte))) (takes-jagged (function byte jagged)) (requires-right-alignment (function integer integer)) (main (function byte))) (define takes-jagged (jagged) (declare) (block)) (define requires-right-alignment (a) (declare) (block (return a))) (define m...
Add a simple LambdaMan program that moves 10 squares
(defun function1 (state environment) (if (>= state 40) (cons 0 0) (cons (+ 1 state) (/ state 10)))) (cons 0 function1)
Add unit tests for three board functions
;;;; unit-tests.lisp ;;;; Author: Elliot Penson (in-package :knight-owl) (ql:quickload "fiveam") (use-package :fiveam) (def-suite knight-owl-suite) (in-suite knight-owl-suite) (test file->index (is (= (file->index #\a) 0)) (is (= (file->index #\b) 1)) (is (= (file->index #\c) 2)) (is (= (file->index #\d) 3)...
Add some tests for ring class.
(defpackage :next.tests (:use :common-lisp :next :prove)) (in-package :next.tests) (plan nil) (defvar test-ring1 (make-instance 'next::ring)) (loop for i from 1 to 1000 do (next::ring-insert test-ring1 (make-string i :initial-element #/a))) (subtest "Add 1000 items, test head-index, item-count, ...
Add :Lisp command (lisp equivalent of :python)
(in-package :cl-user) (ql:quickload :arrow-macros) (defpackage #:lisp-interface (:use #:cl #:cl-neovim #:arrow-macros) (:shadowing-import-from #:cl #:defun #:eval)) (in-package :lisp-interface) (nvim:defcommand/s lisp (&rest form) (declare (opts nargs)) (let ((output (with-output-to-string (*standard-output*)...
Include basic board representation and interaction
;;;; chess.lisp ;;;; Author: Elliot Penson (in-package :knight-owl) (defconstant +number-of-files+ 8) (defconstant +number-of-ranks+ 8) (defconstant +initial-board+ #2A((b-r b-n b-b b-q b-k b-b b-n b-r) (b-p b-p b-p b-p b-p b-p b-p b-p) (nil nil nil nil nil nil nil nil) (nil nil nil nil nil nil ...
Add an ASDF system definition!
(in-package :asdf) (defsystem "lispos" :description "Lisp operating system." :version "0" :author "Henry Harrington <henry.harrington@gmail.com>" :licence "None" :components ((:file "build-unicode") (:file "lap") (:file "lap-x86" :depends-on ("lap")) (:file "genes...
Add a broken lisp quicksort
(defun qsort (l) (print l) (cond ((null l) nil) ((= (length l) 1) l) (T (setq l1 (qsort (remove-if-not (lambda (x) (> (first l) x)) (rest l)))) (setq l2 (qsort (remove-if (lambda (x) (> (first l) x)) (rest l)...
Add material about lambda expressions
;; Common Lisp Script ;; Manoel Vilela ;; higher-order function sigma-sum ;; func must be a lambda(x) expression (defun sigma-sum (func a b) (if (> a b) 0 (+ (funcall func a) (sigma-sum func (1+ a) b)))) (defun square (x) (* x x)) (sigma-sum #'(lambda(x) (/ 1 x)) 1 10) (sigma-sum #'(lambda(...
Add solution for Problem097 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (format t "~a~%" (mod (+ 1 (* 28433 (expt 2 7830457))) (expt 10 10)))
Add solution for Problem003 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (defun factors (n) "Return a list of '(prime factor) for n (factors 100) => ((2 2) (5 2)) " (loop for x from 2 while (> n 1) when (= 0 (mod n x)) collect (loop for c from 0 while (= 0 (mod n x)) do...
Add rudimentary gaussina integer support
(in-package :cl-user) (defpackage :gaussian-integers (:use :cl)) (in-package :gaussian-integers) (defun print-g-int (g-int) (format nil "(~A+~A)i" (car g-int) (cadr g-int))) (defun add-g-ints (&rest g-ints) (funcall #'apply-g-int-operation #'+ g-ints)) (defun subtract-g-ints (&rest g-ints) (funcall #'apply-...
Add list comprehensions to the standard library
(import base (clock)) (import string (#s sub)) (defmacro do (&statements) (letrec [(name (gensym)) (unfold (lambda (stmt) (let* [(hd (car stmt)) (stmt (cdr stmt))] (cond [(eq? hd 'for) (let* [(var (nt...
Add a regression test script
#!./interpreter.py (require "unittest.lisp") ; Some simple sanity tests (shouldEqual 4 (+ 1 3) "Adding two numbers") (shouldEqual 4 (car (list 4 3 2)) "Taking the head of a list") (shouldEqual (list 3 2) (cdr (list 4 3 2)) "Taking the tail of a list") ; Some lambda test (set! increment (lambda (x) (+ x 1))) (shouldEq...
Add a cool troll code about multiple namespaces
;; Common Lisp Script ;; Manoel Vilela (flet ((foo (when funcall) (when (< 3 when) (funcall funcall)) when)) (loop :named funcall :for funcall :from 1 :collect (foo funcall (lambda () (loop-finish)))))
Add Common Lisp solution for Problem001
;; Common Lisp version ;; Manoel Vilela (defun div (x d) (= (mod x d) 0)) (defun special-sum (n) (reduce '+ (loop for x from 1 to n when (or (div x 5) (div x 3)) collect x))) (format t "~d" (special-sum 1000))
Add solution for Problem056 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (defun sum-digits (number &optional (base 10)) (loop for n = number then q for (q r) = (multiple-value-list (truncate n base)) sum r until (zerop q))) (defun solution () (loop for a from 1 to 100 maximize (loop for b from 1 to 100 ...
Add solution for Problem010 written in Common Lisp
;; Common Lisp Script ;; Manoel Vilela (defun primep (n) (let ((divisors (loop for x from 2 to (floor (1+ (sqrt n))) collect x))) (loop for d in divisors never (and (= (mod n d) 0) (not (= n d)))))) (defun solution (limit) (loop for x from 2 for ...
Add a lisp script that runs the tests
;After setting up quicklisp, run this file in clisp to run the test suite. (load "~/.clisprc.lisp") (ql:quickload "magician") (ql:quickload "magician-test")
Add heuristic square-root algorithm in Common Lisp
;; Common Lisp Script ;; Manoel Vilela #| A heuristic method to calculate the square root of a number x based on the Hero of Alexandria's alogrithm. |# (defparameter *error-limit* 0.001) (defparameter *tests* '((square-root 2) (square-root 12) (square-root 2...
Add CommonLisp solution based at 16 solution
;; Common Lisp Script ;; Manoel Vilela (defun integer-to-list (x) (if (< x 10) (cons x nil) (cons (mod x 10) (integer-to-list (floor (/ x 10)))))) (defun sum (the-list) (reduce '+ the-list)) (defun fat (x) (if (<= x 2) x (* x (fat (1- x))))) (defun solution () (sum (int...
Add a small plugin to fold defmethod/defdefaults
(import compiler/pass ()) (import compiler/nodes ()) (import lua/basic (set-idx!)) (defun get-lookup (lookup key) :hidden (with (len (n lookup)) (loop [(i 2)] [(> i len) (with (sub (list (fix-symbol `struct-literal))) (push-cdr! lookup key) (push-cdr! lookup sub) sub)] ...
Add path IK lisp demo
(require :amino) (in-package :robray) (sb-posix:setenv "ROS_PACKAGE_PATH" "/opt/ros/indigo/share/" 1) (setq *scene-graph* (load-scene-file "package://baxter_description/urdf/baxter.urdf")) (defparameter *sub-scene-graph* (scene-graph-chain *scene-graph* nil "right_w2")) (win-set-scene-graph *scene-graph*) (win-ru...
Add new lisp example problem file. Save updates to cashflow and make-cscope.sh
; Using only operators introduced in this chapter define a function ; that takes a list as an argument and returns true if one of its ; elements is a list (defun has_list_recursive (lst) (if (null lst) nil (if (listp (car lst)) t (has_list_recursive (cdr lst)))) ) (has_list_recursive '(a b c...
Add link to issue tracker
= The Molly Project = http://mollyproject.org/ The Molly Project is a Django-based Python application which provides a framework for creating a mobile web portal for higher education institutions. Please do Fork our code! We're looking for more contributors to the project. == Get Started == The 'quickinstall' scri...
= The Molly Project = http://mollyproject.org/ The Molly Project is a Django-based Python application which provides a framework for creating a mobile web portal for higher education institutions. Please do Fork our code! We're looking for more contributors to the project. == Get Started == The 'quickinstall' scri...
Use a template to add CKEditor support
--- title: Adding a Rich Text Editor parent_title: Recipes previous_title: previous_link: next_title: Custom Actions next_link: /recipes/custom-actions/ --- = Adding a Rich Text Editor Download **CKEditor** and uncompress it under the {{{public/javascripts}}} folder. {{{ $ cd public/javascripts $ curl -O http:...
--- title: Adding a Rich Text Editor parent_title: Recipes previous_title: previous_link: next_title: Custom Actions next_link: /recipes/custom-actions/ --- = Adding a Rich Text Editor You can add a **Rich Text Editor**, ([[http://ckeditor.com/|CKEditor]]), to your application by running the following task into ...
Add default lang to layout
class MainLayout include LuckyWeb::Page include LuckyWeb::Layout @page : BasePage render do html_doctype html do head do utf8_charset title @page.page_title css_link asset("css/app.css") js_link asset("js/app.js") end body do @page.render_inn...
class MainLayout include LuckyWeb::Page include LuckyWeb::Layout @page : BasePage render do html_doctype html lang: "en" do head do utf8_charset title @page.page_title css_link asset("css/app.css") js_link asset("js/app.js") end body do @page...
Add a mapping for gateway packets
require "json" module Discordcr module REST # A response to the Get Gateway REST API call. struct GatewayResponse JSON.mapping( url: String ) end end end
require "json" module Discordcr module REST # A response to the Get Gateway REST API call. struct GatewayResponse JSON.mapping( url: String ) end end struct GatewayPacket JSON.mapping( op: UInt8, d: Nil, s: UInt32 | Nil, t: String | Nil ) end
Set the Authorization header to the token
require "http/client" require "openssl/ssl/context" require "./mappings" module Discordcr module REST SSL_CONTEXT = OpenSSL::SSL::Context::Client.new def request(endpoint_key : Symbol, method : String, url : String | URI, headers : HTTP::Headers, body : String | Nil) HTTP::Client.exec(method: method,...
require "http/client" require "openssl/ssl/context" require "./mappings" module Discordcr module REST SSL_CONTEXT = OpenSSL::SSL::Context::Client.new def request(endpoint_key : Symbol, method : String, url : String | URI, headers : HTTP::Headers, body : String | Nil) headers["Authorization"] = @token...
Validate independent parts instead of the whole output
require "./../spec_helper" describe M3U8::Playlist do describe "when creating a playlist" do let(playlist) { M3U8::Playlist.new } it "inserts the base header" do output = \ "#EXTM3U\n" \ "\n" expect(playlist.to_s).to eq(output) end describe "media playlist" do ...
require "./../spec_helper" describe M3U8::Playlist do describe "when creating a playlist" do let(playlist) { M3U8::Playlist.new } it "inserts the header" do expect(playlist.to_s).to match(/#EXTM3U\n/) end describe "media playlist" do it "accepts new segments" do playlist.add_seg...
Add safety constraints to Pointer
struct Pointer(T) def +(other : Int) self + other.to_i64 end def []=(offset, value) (self + offset).value = value end end
struct Pointer(T) def +(other : Int) self + other.to_i64 end def []=(offset : Int, value : T) (self + offset).value = value end end
Add extensions for implicit loading
require "./tree.cr" module Crustache abstract class FileSystem abstract def load(value : String) : Tree::Template? def load!(value : String) : Tree::Template if tmpl = self.load value return tmpl else raise "#{value} is not found" end end end class HashFileSystem <...
require "./tree.cr" module Crustache abstract class FileSystem abstract def load(value : String) : Tree::Template? def load!(value : String) : Tree::Template if tmpl = self.load value return tmpl else raise "#{value} is not found" end end end class HashFileSystem <...
Add a basic MockRequest for mocking a HTTP::Request
class MockRequest < HTTP::Request def initialize end end
class MockRequest def initialize end def get(path : String, headers = Hash.new : Hash(String, String | Array(String))) http_headers = HTTP::Headers.new headers.each do |key, value| http_headers.add(key, value) end HTTP::Request.new("GET", path, http_headers) end end
Expire session when browser is closed
AMBER_PORT = ENV["PORT"]? || 3008 AMBER_ENV = ENV["AMBER_ENV"]? || "development" require "amber" require "./initializers/*" Amber::Server.instance.config do |app| app_path = __FILE__ app.name = "Crystal [ANN] web application." app.port = AMBER_PORT.to_i app.env = AMBER_ENV.to_s app.log = ::Logger.new(STDOU...
AMBER_PORT = ENV["PORT"]? || 3008 AMBER_ENV = ENV["AMBER_ENV"]? || "development" require "amber" require "./initializers/*" Amber::Server.instance.config do |app| app_path = __FILE__ app.name = "Crystal [ANN] web application." app.port = AMBER_PORT.to_i app.env = AMBER_ENV.to_s app.log = ::Logger.new(STDOU...
Fix a bug that FileSystem can't create instance
require "./crustache/*" module Crustache # :nodoc: OPEN_TAG = "{{".to_slice # :nodoc: CLOSE_TAG = "}}".to_slice def self.parse(string : String, filename = "<inline>", row = 1) : Tree::Template self.parse StringIO.new(string), filename, row end def self.parse(io : IO, filename = "<inline>", row = 1)...
require "./crustache/*" module Crustache # :nodoc: OPEN_TAG = "{{".to_slice # :nodoc: CLOSE_TAG = "}}".to_slice def self.parse(string : String, filename = "<inline>", row = 1) : Tree::Template self.parse StringIO.new(string), filename, row end def self.parse(io : IO, filename = "<inline>", row = 1)...
Add a mapping for the GUILD_EMOJI_UPDATE dispatch payload
require "./converters" require "./user" require "./channel" module Discord module Gateway struct ReadyPayload JSON.mapping( v: UInt8, user: User, private_channels: Array(PrivateChannel), guilds: Array(UnavailableGuild), session_id: String ) end struct ...
require "./converters" require "./user" require "./channel" require "./guild" module Discord module Gateway struct ReadyPayload JSON.mapping( v: UInt8, user: User, private_channels: Array(PrivateChannel), guilds: Array(UnavailableGuild), session_id: String ) ...
Remove the fiber spawn in request
require "http/client" require "openssl/ssl/context" require "./mappings" require "./version" module Discord module REST SSL_CONTEXT = OpenSSL::SSL::Context::Client.new USER_AGENT = "DiscordBot (https://github.com/meew0/discordcr, #{Discord::VERSION})" def request(endpoint_key : Symbol, method : String...
require "http/client" require "openssl/ssl/context" require "./mappings" require "./version" module Discord module REST SSL_CONTEXT = OpenSSL::SSL::Context::Client.new USER_AGENT = "DiscordBot (https://github.com/meew0/discordcr, #{Discord::VERSION})" def request(endpoint_key : Symbol, method : String...
Add scenario with empty line between header and the rest
require "./../spec_helper" describe M3U8::MasterPlaylist do context "when rendering a playlist" do let(streams) { [ M3U8::MasterPlaylist::Stream.new("low.m3u8"), M3U8::MasterPlaylist::Stream.new("medium.m3u8"), M3U8::MasterPlaylist::Stream.new("high.m3u8") ] } let(pl...
require "./../spec_helper" describe M3U8::MasterPlaylist do context "when rendering a playlist" do let(streams) { [ M3U8::MasterPlaylist::Stream.new("low.m3u8"), M3U8::MasterPlaylist::Stream.new("medium.m3u8"), M3U8::MasterPlaylist::Stream.new("high.m3u8") ] } let(pl...
Add a mapping for the GUILD_DELETE payload
require "./converters" require "./user" require "./channel" module Discord module Gateway struct ReadyPayload JSON.mapping( v: UInt8, user: User, private_channels: Array(PrivateChannel), guilds: Array(UnavailableGuild), session_id: String ) end struct ...
require "./converters" require "./user" require "./channel" module Discord module Gateway struct ReadyPayload JSON.mapping( v: UInt8, user: User, private_channels: Array(PrivateChannel), guilds: Array(UnavailableGuild), session_id: String ) end struct ...
Remove colorize from common exception handler
class Kemal::CommonExceptionHandler < HTTP::Handler INSTANCE = new def call(context) begin call_next context rescue ex : Kemal::Exceptions::RouteNotFound context.response.content_type = "text/html" Kemal.config.logger.write("Exception: #{ex.inspect_with_backtrace.colorize(:red)}\n") ...
class Kemal::CommonExceptionHandler < HTTP::Handler INSTANCE = new def call(context) begin call_next context rescue ex : Kemal::Exceptions::RouteNotFound context.response.content_type = "text/html" Kemal.config.logger.write("Exception: #{ex.inspect_with_backtrace}\n") return render_...
Use a local variant of the websocket to avoid the not_nil! checks
require "http/web_socket" require "./rest" module Discordcr class Client include REST def initialize(@token : String, @client_id : UInt64) end def run url = gateway.url url += "?v=6&encoding=json" @websocket = HTTP::WebSocket.new(URI.parse(url)) @websocket.not_nil!.on_messa...
require "http/web_socket" require "./rest" module Discordcr class Client include REST def initialize(@token : String, @client_id : UInt64) end def run url = gateway.url url += "?v=6&encoding=json" @websocket = websocket = HTTP::WebSocket.new(URI.parse(url)) websocket.on_mes...
Add spec for missing else in case statement
require "../spec_helper" describe Crow do it "should convert simple case statements" do crystal = <<-CR value = "foo" case value when "foo" p "yes" when "bar" p "no" else p "hiyaa" end CR flow = <<-JS const value = "foo"; switch (value) { case "foo":...
require "../spec_helper" describe Crow do it "should convert simple case statements" do crystal = <<-CR value = "foo" case value when "foo" p "yes" when "bar" p "no" else p "hiyaa" end CR flow = <<-JS const value = "foo"; switch (value) { case "foo":...
Fix a bug in Indexable(T) This fixes a bug where calling `Indexable(T).[]?` wouldn't compile.
module Indexable(T) abstract def size abstract def unsafe_at(index : Int) def at(index : Int) index = check_index_out_of_bounds index do return yield end unsafe_at index end @[AlwaysInline] def at(index : Int) at(index) { panic "Invalid index!" } end @[AlwaysInline] def [](ind...
module Indexable(T) abstract def size abstract def unsafe_at(index : Int) def at(index : Int) index = check_index_out_of_bounds index do return yield end unsafe_at index end @[AlwaysInline] def at(index : Int) at(index) { panic "Invalid index!" } end @[AlwaysInline] def [](ind...
Add class method to simplify boot
require "./hooks_dsl" require "./config_dsl" module Soil class App extend HooksDSL extend RoutingDSL extend ConfigDSL @@namespace = "" @@before_hooks = [] of Http::Request, Http::Response -> @@after_hooks = [] of Http::Request, Http::Response -> @@router = Router.new @@config = Confi...
require "./hooks_dsl" require "./config_dsl" module Soil class App extend HooksDSL extend RoutingDSL extend ConfigDSL @@namespace = "" @@before_hooks = [] of Http::Request, Http::Response -> @@after_hooks = [] of Http::Request, Http::Response -> @@router = Router.new @@config = Confi...
Use render method instead of block in app skeleton
abstract class MainLayout include LuckyWeb::HTMLPage include Shared::FieldErrorsComponent include Shared::FlashComponent # You can put things here that all pages need # # Example: # needs current_user : User needs flash : LuckyWeb::Flash::Store abstract def inner render do html_doctype ...
abstract class MainLayout include LuckyWeb::HTMLPage include Shared::FieldErrorsComponent include Shared::FlashComponent # You can put things here that all pages need # # Example: # needs current_user : User needs flash : LuckyWeb::Flash::Store abstract def inner def render html_doctype ...
Make exposures work with latest LuckyWeb
abstract class BaseAction < LuckyWeb::Action include LuckyWeb::Exposeable macro inherited # If something should always be exposed to your pages, expose them here. # # Example: # # macro inherited # expose :current_user # end # # def current_user # find_the_user... ...
abstract class BaseAction < LuckyWeb::Action # If something should always be exposed to your pages, expose them here. # # Example: # # expose current_user # # def current_user # find_the_user... # end # # Then add an assign for it in your BasePage end
Fix a syntax error in the request parameters
require "http/client" module Discordcr module REST def request(endpoint_key : Symbol, method : String, url: String | URI, headers : HTTP::Headers | Nil, body : String | Nil) HTTP::Client.exec(method: method, url: url, headers: headers, body: body, tls: true) end end end
require "http/client" module Discordcr module REST def request(endpoint_key : Symbol, method : String, url : String | URI, headers : HTTP::Headers | Nil, body : String | Nil) HTTP::Client.exec(method: method, url: url, headers: headers, body: body, tls: true) end end end
Remove an unnecessary not_nil! from SnowflakeConverter
require "json" require "time/format" module Discord module SnowflakeConverter def self.from_json(parser : JSON::PullParser) : UInt64 str = parser.read_string_or_null str.not_nil!.to_u64 end def self.to_json(value : UInt64, io : IO) io.puts(value.to_s) end end # Converts a valu...
require "json" require "time/format" module Discord module SnowflakeConverter def self.from_json(parser : JSON::PullParser) : UInt64 parser.read_string.to_u64 end def self.to_json(value : UInt64, io : IO) io.puts(value.to_s) end end # Converts a value that may be a snowflake, but mi...