cl-cookbook | The Common Lisp Cookbook | Learning library

 by   LispCookbook JavaScript Version: 2022-09-14 License: Non-SPDX

kandi X-RAY | cl-cookbook Summary

kandi X-RAY | cl-cookbook Summary

cl-cookbook is a JavaScript library typically used in Tutorial, Learning applications. cl-cookbook has no bugs, it has no vulnerabilities and it has medium support. However cl-cookbook has a Non-SPDX License. You can download it from GitHub.

The Common Lisp Cookbook
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              cl-cookbook has a medium active ecosystem.
              It has 824 star(s) with 123 fork(s). There are 43 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 52 open issues and 107 have been closed. On average issues are closed in 397 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of cl-cookbook is 2022-09-14

            kandi-Quality Quality

              cl-cookbook has 0 bugs and 0 code smells.

            kandi-Security Security

              cl-cookbook has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              cl-cookbook code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              cl-cookbook has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              cl-cookbook releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed cl-cookbook and discovered the below as its top functions. This is intended to give you an instant insight into cl-cookbook implemented functionality, and help decide if they suit your requirements.
            • Toggle the TOC
            • set ready event listeners
            • loops through an array and returns the first argument
            • function to filter input
            • Helper function to check if a form is disabled
            • Loops through a b
            • Calculate rta
            • Formats a number
            • function iterates over a and iterate over
            • function used to filter inputs
            Get all kandi verified functions for this library.

            cl-cookbook Key Features

            No Key Features are available at this moment for cl-cookbook.

            cl-cookbook Examples and Code Snippets

            No Code Snippets are available at this moment for cl-cookbook.

            Community Discussions

            QUESTION

            CLisp/FFI is crashing in win32, possibly because of garbage collection
            Asked 2020-Nov-09 at 18:38

            Windows 10, CLISP 2.49, FFI.

            I have used the built-in FFI to start a windows loop and a basic windproc callback. The initial windows message WM_PAINT is fine. In some tests, SetWindowPos or minimizing/maximizing the window, all of which call WM_PAINT, are also fine.

            But when I, the user, grab the window edge to resize the window, it crashes. There is no lisp error. I've attempted to attach to CLISP via Visual Studio, but there is no windows exception either.

            I've added (room) and (ext:gc) to check memory issues. I'm very suspicious that room reports "Bytes available until next GC: 6,510" being pretty low just before the program crashes. Multiple WM_PAINT calls will succeed, but if "bytes available" is low, there's a good (but not 100%) chance of a crash.

            ...

            ANSWER

            Answered 2020-Nov-07 at 20:38

            Are the WM_PAINT messages sent by Windows in the same thread that executes the main message loop?

            • If yes, then it's likely a bug in CLISP. If you can reproduce it also with the current prerelease 2.49.92 (available from https://alpha.gnu.org/gnu/clisp/), it's worth submitting a bug report at https://gitlab.com/gnu-clisp/clisp/-/issues .
            • If no, then there's currently no way to make this work with CLISP; I'd then recommend SBCL instead. The reason is that multithreading in CLISP is not ready for prime-time, while SBCL supports multiple threads well.

            Source https://stackoverflow.com/questions/64728895

            QUESTION

            How to `defun` a function in a package?
            Asked 2020-Aug-18 at 20:06

            I'm sorry, this is a very newbie Common Lisp question.

            I'm learning common-lisp and package system.

            I started with "The Complete Idiot's Guide to Common Lisp Packages" from http://cl-cookbook.sourceforge.net/packages.html

            In Chapter 1, the author defined a function foo in the package :bob

            ...

            ANSWER

            Answered 2020-Aug-18 at 20:04

            You need to tell Lisp which package to use. In standard Common Lisp it is unspecified which packages to use. SBCL uses none. If you want symbols of the package CL to be available, you have to explicitly use that package.

            Package JANE

            Source https://stackoverflow.com/questions/63474681

            QUESTION

            What' the meaning of method-generic-function?
            Asked 2020-Aug-14 at 15:45

            I'm learning common-lisp and CLOS.

            I started with the tutorial from http://cl-cookbook.sourceforge.net/clos-tutorial/

            In Section 4.3, it mentioned that

            A generic function is a lisp function which is associated with a set of methods and dispatches them when it's invoked.

            It also present two functions generic-function-methods and method-generic-function:

            ...

            ANSWER

            Answered 2020-Aug-14 at 15:45
            • Method-generic-function gives you the generic function that the given method is associated with.
            • Method-generic-function is not imported into the cl-user package in SBCL. You will find it in sb-mop (so, sb-mop:method-generic-function). The MOP is not entirely incorporated in the Common Lisp standard.
            • For portable use of the entire MOP, use the library “Closer to MOP” (closer-mop).
            • In the REPL, * refers to the first return value of the last evaluated expression. In your case, that was the list of methods returned by generic-function-methods. So you see that these two are more or less inverse functions in this one-to-many relation.

            Source https://stackoverflow.com/questions/63410598

            QUESTION

            How to use the #M dispatch function in the series package?
            Asked 2020-Apr-19 at 12:13

            I am trying to understand the basics of the series library and am studying the examples in the CL Cookbook

            But if I try to evaluate one of this examples

            ...

            ANSWER

            Answered 2020-Apr-19 at 11:48

            Reader macros for libraries typically need to be enabled explicitly.

            According to the RELEASE-NOTES:

            You can use SERIES::INSTALL for "use-package"ing Series in a way that extended special forms are shadow-import'ed and reader macros are installed.

            I'm not sure why that is not exported.

            I have not yet found a named-readtables definition for series, but I'd guess that someone has done that alredy.

            Source https://stackoverflow.com/questions/61303190

            QUESTION

            Can't set up qtools in common-lisp SBCL
            Asked 2020-Apr-10 at 14:40

            I'm a beginner in lisp and I'm unable to find out how to correctly use defpackage to load qtools (on arch linux). For simplicity if I run this example project in sbcl with loaded quicklisp https://github.com/Shinmera/qtools/tree/master/examples/helloworld this error appears

            ...

            ANSWER

            Answered 2020-Apr-10 at 11:15

            You need to install the qtools system.

            • A system is a way to organize software libraries
            • A package is a namespace

            The two are theoretically unrelated. But often, when you load a system X, it defines a package named X.

            In some cases (like qtools) there are many packages for one system, for example because the system wants to define different levels of API.

            Another way to define multiple packages when loading one system comes from the fact that ASDF version 3.1 supports an extension copied from other build systems named package-inferred-systems, where each source file is implicitly mapped to one system and one package.

            Here is a snippet of what Quicklisp shows when installing qtools:

            Source https://stackoverflow.com/questions/61138120

            QUESTION

            How to access metaobjects/slot-definition slots? Why slot-value can access slots of objects but not slots of metaobjects?
            Asked 2020-Apr-09 at 09:26

            I'm having a problem acessing slots out of slot definitions. I can inspect class objects, see their slots definitions and even get some standard info about the slots definitions. However I can't access user-defined information about the slot definition.

            I've already googled this for quite a while and ended up reading CLOS & MOP specifications, a bit of the Lisp Cookbook, about some MOP concepts, and some related questions on StackOverflow that didn't help much. I even readed a piece of SBCL's implementations, but to no avail.

            From the pieces that I was able to put together, I can access many slots of a SLOT DEFINITION via some functions, e.g. access the NAME slot of the SLOT DEFINITION using CLOSER-MOP:SLOT-DEFINITION-NAME (which is certainly helpful), but I can't do so for slots that don't have one of these functions. For example, I can't access the REFERENCES slot which is provided by the MITO package when defining slots in a DEFCLASS.

            Here's a minimal working example:

            ...

            ANSWER

            Answered 2019-Feb-14 at 21:08

            Slot names are symbols, so the package matters when using SLOT-VALUE / WITH-SLOTS. In this case the references slots appears to be named by an internal symbol in the package MITO.CLASS.COLUMN.

            The inspector doesn't show the package name (because it's rarely needed), but you can see that the slot definition is of type MITO.DAO.COLUMN:DAO-TABLE-COLUMN-CLASS, so you can use CLOSER-MOP:CLASS-SLOTS to find the slot definition:

            Source https://stackoverflow.com/questions/54698509

            QUESTION

            What is the purpose of the socket-close in this Common Lisp example?
            Asked 2020-Mar-22 at 11:16

            I've found this example from the Common Lisp Cookbook which shows how to start a TCP server with usocket.

            The example creates a socket object and establishes a connection, and then writes to the socket. In case of error, the socket write is wrapped in an unwind-protect which will close the socket so it can be reused. I've rewritten the example to cause the error, but when I run this multiple times, I get a USOCKET:ADDRESS-IN-USE-ERROR. The behavior is the same if I remove the socket-close function calls.

            ...

            ANSWER

            Answered 2020-Mar-22 at 11:16

            The reason you get this is because of the nature of the TCP protocol: the connection is in a state called TIME-WAIT in the TCP state machine described by RFC793. A diagram of the state machine is on page 23 of RFC793.

            The interesting bit of the state machine is when one end (who I'll call 'you') wants to close the connection – this is known as an 'active close', and in this case it's what you are initiating by the socket-close calls. I'll call the other end 'them'. The normal sequence of events for an active close is:

            1. you send them a FIN packet;
            2. they ACK your FIN and send in turn a FIN;
            3. you ACK their FIN.

            Now it's important to remember that any of these packets (their ACK and FIN are the same packet usually and I think always) can get lost, and the state machine needs to recover from this.

            There's one particularly interesting packet which is the last ACK: it's particularly interesting because it's the last packet ever sent, which means that you have no way of knowing whether it reached them.

            So consider the situation from both ends

            From their end: they've sent a FIN and are waiting for your ACK for it. Now:

            • either the ACK arrives in due course, in which case they know everything is wound up and they can dismantle everything involved in the connection.
            • or, after waiting for the prescribed time, the ACK doesn't arrive, so they must assume that either their FIN was lost or your ACK to their FIN was lost, and so they must resend the FIN and go back to waiting for the ACK.

            From your end: you've got their FIN and have sent the last ACK. But you have no idea whether that ACK ever got to them. So you wait for a prescribed time in order to give them a chance to realise that the ACK did not get their and resend their FIN. During this wait you can't dismantle the connection, because at any point you may get another FIN.

            This waiting state is known as TIME-WAIT, and during it the endpoint of the connection can't be reused. And this is the problem you are seeing.

            You need to sit in TIME-WAIT for twice the maximum segment lifetime (MSL): the MSL is how long a packet can be expected to sit in the network.

            There are other waiting-states which can occur prior to TIME-WAIT of course, if earlier packets get lost. But TIME-WAIT is the only one which always occurs.

            TIME-WAIT is often called TIME_WAIT due to languages which can't handle hyphens in names.

            Source https://stackoverflow.com/questions/60792252

            QUESTION

            Correct way to do multithreaded computations in SBCL
            Asked 2018-Aug-20 at 23:28
            Context

            I need to do computations using multi-threading. I use SBCL and portability is not a concern. I am aware that bordeaux-threads and lparallel exist but I want to implement something at the relatively low level provided by the specific SBCL threading implementation. I need maximal speed, even at the expense of readability/programming effort.

            Example of computation intensive operation

            We can define a sufficiently computation-intensive function that will benefit from multi-threading.

            ...

            ANSWER

            Answered 2018-Aug-20 at 23:28
            Stylistic issues
            • The splice-arglist helpers are not needed at all (so I'll also skip details in them). Use apply in your thread function instead:

            Source https://stackoverflow.com/questions/51934045

            QUESTION

            Image computation on GPU and value returning
            Asked 2018-Mar-07 at 13:15

            I have a C# project in which I retreive grey-scale images from cameras and do some computation with the image data. The computations are quite time-consuming since I need to loop over the total image several times and I am doing it all on the CPU.

            Now I would like to try to get the evaluation running on the GPU, but I have a lot of struggle achieving that, since I never did any GPU calculations before.

            The software should be able to run on several computers with varying hardware, so CUDA for example is not a solution for me, since the code should also run on laptops which only have onboard graphics. After some research I came accross Cloo (found it on this project), which seems to be a quite resonable choice.

            So far I integrated Cloo in my project and tried to get this hello world example running. I guess it is running, since I don´t get any exception, but I don´t know where I can see the printed output.

            For my computations I need to pass the image to the GPU and I also need the x-y coordinates during the computation. So, in C# the computation looks like this:

            ...

            ANSWER

            Answered 2018-Mar-07 at 13:15

            Let's reverse engineer the problem. Understanding the efficient processing of the "dependency-chain" of image[][], image_height, image_width, a, b

            Ad 4 ) the tandem of identical for-loops has a poor performance

            given the defined code, there could be just a single loop, thus with reduced overhead costs and best with also maximising cache-aligned vectorised code.

            Cache-Naive re-formulation:

            Source https://stackoverflow.com/questions/49066693

            QUESTION

            How to get a file size (and other attributes) in Common Lisp?
            Asked 2017-Oct-20 at 14:42

            How do we get file attributes ? I primarily am looking to get the size, but also its last access time and other attributes.

            I only found (file-length some-file) that gets a stream so is used this way:

            ...

            ANSWER

            Answered 2017-Oct-20 at 14:42

            With Osicat, you call stat on the file and you get a bunch of things in a structure:

            Source https://stackoverflow.com/questions/44592706

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install cl-cookbook

            You can download it from GitHub.

            Support

            Thanks for contributing to the Cookbook. You can start by having a look at the style guide. When adding new content, please ensure it renders properly.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries