This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;;; cl-overload.lisp | |
| (in-package #:cl-overload) | |
| (defgeneric generic-find (item sequence &key test) | |
| (:generic-function-class fast-generic-functions:fast-generic-function)) | |
| (defmethod generic-find (item (list list) &key (test #'eql)) | |
| (and (member item list :test test) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dnl AMD64 mpn_mul_1. | |
| dnl Copyright 2003-2005, 2007, 2008, 2012 Free Software Foundation, Inc. | |
| dnl This file is part of the GNU MP Library. | |
| dnl | |
| dnl The GNU MP Library is free software; you can redistribute it and/or modify | |
| dnl it under the terms of either: | |
| dnl | |
| dnl * the GNU Lesser General Public License as published by the Free |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 30 | |
| 14 | |
| 21 41 85 91 15 13 77 26 90 44 99 23 77 82 | |
| 11 | |
| 7 69 22 96 26 15 18 53 87 90 89 | |
| 39 | |
| 60 31 12 77 47 48 73 21 55 64 20 18 96 55 99 28 21 28 90 27 15 96 43 21 29 41 56 27 41 79 34 59 34 19 54 85 28 36 53 | |
| 14 | |
| 81 46 13 67 48 86 98 51 25 89 19 58 26 5 | |
| 13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun tug-of-war (people) | |
| (declare (optimize (speed 3)) | |
| ((simple-array fixnum (*)) people)) | |
| (setf people (sort people #'>)) | |
| (let ((sum (reduce #'+ people))) | |
| (declare (fixnum sum)) | |
| (if (evenp sum) | |
| (let ((sum (floor sum 2))) | |
| (labels ((recursive-walk (upto currentsum) | |
| (declare (fixnum currentsum)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun diophantine-equation (a b) | |
| (declare (fixnum a) (fixnum b) | |
| (optimize (speed 3))) | |
| (let ((left-side-a 1) (left-side-b 0) | |
| (right-side-a 0) (right-side-b 1)) | |
| (declare (fixnum left-side-a) (fixnum left-side-b) | |
| (fixnum right-side-a) (fixnum right-side-b)) | |
| (loop :until (or (= 0 a) (= 0 b)) | |
| :if (> a b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun consecsum (array) | |
| (loop :with res := (make-array 1 :adjustable t :fill-pointer 0) | |
| :with acc := (aref array 0) | |
| :for i :from 1 :below (length array) | |
| :for j := (- i 1) | |
| :if (= (aref array i) (aref array j)) | |
| :do (incf acc (aref array i)) | |
| :else | |
| :do (vector-push-extend acc res) | |
| (setf acc (aref array i)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <string> | |
| #include <unordered_map> | |
| #include <fstream> | |
| #include <utility> | |
| #include <algorithm> | |
| #include <cassert> | |
| #include <string_view> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun prompt-new-value (prompt) | |
| (format *query-io* prompt) ;; *query-io*: the special stream to make user queries. | |
| (force-output *query-io*) ;; Ensure the user sees what he types. | |
| (list (read *query-io*))) | |
| (defun safe-map (predicate sequence &optional copy) | |
| (let ((backup (make-array 1 :adjustable t :fill-pointer 0))) | |
| (loop :for i :from 0 :below (length sequence) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <vector> | |
| #include <string> | |
| #include <unordered_map> | |
| #include <fstream> | |
| #include <utility> | |
| #include <algorithm> | |
| #include <cassert> | |
| #include <string_view> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defparameter *type-policy* :docs) | |
| (defparameter *doc-info* (make-hash-table :test #'equal)) | |
| (defun validate-ftype (ftype) | |
| (labels ((check-symbols (list) | |
| (every (lambda (token) | |
| (if (atom token) | |
| (symbolp token) | |
| (check-symbols token))) |