AI Personal Learning
and practical guidance

Why LISP Language Prompts Generate SVG Vector Graphics

This article was updated on 2024-11-17 19:05, part of the content is time-sensitive, if it is invalid, please leave a message!

We have released a large number of products based on Claude appliedCard Diagram Cue WordsThe output format is always SVG and stable. Some people may wonder why the prompt does not constrain the output format, but the output format is always SVG and stable.

Firstly, the card diagram cues use the LISP language as "pseudo-code", the reason for using the LISP language is that it can better describe the structural complexity of the cause and effect relationships and patterns.


 

We are based on Card Diagram Cue Words: Generate cue words for various types of science presentation illustrations/PPT visualization cards As an example, this is explained in detail:

  1. Language Differences Description:
  • The input prompts are written in LISP, which is a functional programming language
  • The output is SVG (Scalable Vector Graphics), an XML-based vector graphics markup language.
  • They are two completely different languages serving different purposes.
  1. LISP code roles:
  • The LISP code is actually a "generator" or "template engine" here.
  • It defines a series of functions to process the data and ultimately generate the SVG code.
  • The main functions include:
    (defun Create optimized SVG charts ...)  Core Generation Functions
    (defun Design Background ...)         ; Background Style Generation
    (defun Generate Subtitle ...) ; Text Content Generation       ; Text Content Generation
    
  1. Conversion process:
LISP code ---(processing)---> SVG output
┌───────── ──┐ ┌────────────┐
│ LISP function definition │ → │ │ SVG markup language │
│ (Data Processing Logic) │ → │ │ (Graphic Description) │
└────────── ─┘ └────────────┘
  1. Specific examples:
;; LISP code (input)
(defun Creating optimized SVG charts (theme life stage ...)
(let ((svg-template
""))
...)



...
</svg
  1. Relationship Explanation:
  • The LISP code is the "chef's recipe": it defines the steps of how to process the data and generate the graphs.
  • SVG is the "final dish": the final form of visualization
  • The LISP code contains all the logic and rules needed to generate the SVG.
  • SVG is a product of LISP code execution
  1. Workflow:
  2. LISP code receives input parameters (e.g., subject, data, etc.)
  3. Handling these parameters (e.g., calculating position, selecting colors, etc.)
  4. Inserting processed data into SVG templates
  5. Output complete SVG code
  6. Advantage:
  • This separation allows:
    • LISP handles complex logic and data conversion
    • SVG focuses on visual presentation
    • Easier to maintain and modify
    • Different visualizations can be generated based on different inputs
  1. Examples of real-world applications:
;; Function Definitions in LISP
(defun design context (topic)
(case theme
(cicada '(gradient "E6F3FF" "B3E5FC" land))
...))

Convert to:






</linearGradient
</defs

It's like a translation process: the LISP code defines the "rules" and "logic", and these rules are eventually translated into a concrete graphical description of the SVG. This approach allows us to generate and control visualizations programmatically, rather than writing SVG code manually.

AI Easy Learning

The layman's guide to getting started with AI

Help you learn how to utilize AI tools at a low cost and from a zero base.AI, like office software, is an essential skill for everyone. Mastering AI will give you an edge in your job search and half the effort in your future work and studies.

View Details>
May not be reproduced without permission:Chief AI Sharing Circle " Why LISP Language Prompts Generate SVG Vector Graphics

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish