{"id":21540,"date":"2023-02-16T06:56:21","date_gmt":"2023-02-16T06:56:21","guid":{"rendered":"https:\/\/www.booksofall.com\/cn\/?post_type=product&#038;p=21540"},"modified":"2023-02-16T06:56:52","modified_gmt":"2023-02-16T06:56:52","slug":"casting-spels-in-lisp","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/","title":{"rendered":"Casting Spels in Lisp"},"content":{"rendered":"<p>Every <a href=\"https:\/\/www.educba.com\/types-of-computer-language\/\">computer language<\/a> has code that is made up of syntax and semantics. The <a href=\"https:\/\/woz-u.com\/blog\/what-is-syntax-in-computer-programming\/\">syntax of a programming language<\/a> is the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Skeleton_(computer_programming)\">basic skeleton<\/a> your program has to follow so that the compiler knows what&#8217;s what in your program, so it can tell what&#8217;s a function, a variable, etc. The semantics of a program is the more &#8220;random&#8221; stuff, like the different commands you have available and what variables you&#8217;re allowed to look at at any point in the program. The first thing that is special about Lisp is that it has the simplest syntax of any major programming language.<\/p>\n<p>Basically, the Lisp syntax dictates that any text you give the Lisp compiler has to be arranged into lists, which can be nested into lists of lists or such as needed. The parenthesis mark the beginning and end of each list:<\/p>\n<p>Additionally, the Lisp compiler uses two modes when it reads your code: A <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/code-mode\/lojikgkcpdeolbgbfcapfpfhofkocnge\">Code Mode<\/a> and a Data Mode. When you&#8217;re in Data Mode, you can put anything you want into your lists. However, the compiler first starts off reading your code in <a href=\"https:\/\/codemode.us\/\">Code Mode-<\/a> In Code Mode, your lists need to be a special type of list called a form:<\/p>\n<p>A form is a list where the first symbol in the list has to be a special word that the compiler can understand- Usually the name of a function. In this case, the compiler will send the other items of the list to the function as parameters. When it reads the text for these parameters, it will usually assume that they are also in Code Mode, unless you tell it to flip into data mode.<\/p>\n<p>Defining the Data for our<a href=\"https:\/\/en.wikipedia.org\/wiki\/Game_world\"> Game World<\/a><\/p>\n<p>In order to learn some more about forms, let&#8217;s create a some forms that create the data for our game world. First of all, our game is going to have some objects in it that the player can pick up and use- Let&#8217;s define those objects:<br \/>\n(setf *objects* &#8216;(whiskey-bottle bucket frog chain))<\/p>\n<p>Ok, now let&#8217;s dissect this line an see what it means: Since a Lisp compiler always starts reading things in Code Mode and expects a form, the first symbol, setf, must be a command. In this case, the command sets a variable to a value: The variable is *objects* (Lispers like to put stars around the names for global variables as a convention) and the value we are setting it to is a list of the four objects. Now, since the list is data (i.e. we don&#8217;t want the compiler to try and call a function called whiskey-bottle) we need to &#8220;flip&#8221; the compiler into Data Mode when reading the list.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 700px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/casting-spels-19codu93kk?enforceShowPromotionBar=true&amp;p=1\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":21544,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":""},"product_brand":[],"product_cat":[335],"product_tag":[],"class_list":{"0":"post-21540","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-lisp","8":"first","9":"instock","10":"shipping-taxable","11":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Casting Spels in Lisp - BooksOfAll Simplified Chinese<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Casting Spels in Lisp - BooksOfAll Simplified Chinese\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Simplified Chinese\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-16T06:56:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png\" \/>\n<meta name=\"twitter:label1\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/\",\"name\":\"Casting Spels in Lisp - BooksOfAll Simplified Chinese\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png\",\"datePublished\":\"2023-02-16T06:56:21+00:00\",\"dateModified\":\"2023-02-16T06:56:52+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png\",\"width\":\"497\",\"height\":\"752\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/cn\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Casting Spels in Lisp\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#website\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"name\":\"BooksOfAll Simplified Chinese\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#organization\",\"name\":\"BooksOfAll Simplified Chinese\",\"url\":\"https:\/\/www.booksofall.com\/cn\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Simplified Chinese\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Casting Spels in Lisp - BooksOfAll Simplified Chinese","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/","og_locale":"zh_CN","og_type":"article","og_title":"Casting Spels in Lisp - BooksOfAll Simplified Chinese","og_url":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/","og_site_name":"BooksOfAll Simplified Chinese","article_modified_time":"2023-02-16T06:56:52+00:00","og_image":[{"url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png","twitter_misc":{"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/","url":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/","name":"Casting Spels in Lisp - BooksOfAll Simplified Chinese","isPartOf":{"@id":"https:\/\/www.booksofall.com\/cn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png","datePublished":"2023-02-16T06:56:21+00:00","dateModified":"2023-02-16T06:56:52+00:00","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#primaryimage","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2023\/02\/img_63edd138a216d.png","width":"497","height":"752"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/cn\/casting-spels-in-lisp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/cn\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/cn\/categories\/"},{"@type":"ListItem","position":3,"name":"Casting Spels in Lisp"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/cn\/#website","url":"https:\/\/www.booksofall.com\/cn\/","name":"BooksOfAll Simplified Chinese","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/cn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/cn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/cn\/#organization","name":"BooksOfAll Simplified Chinese","url":"https:\/\/www.booksofall.com\/cn\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/cn\/wp-content\/uploads\/sites\/2\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Simplified Chinese"},"image":{"@id":"https:\/\/www.booksofall.com\/cn\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product\/21540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media\/21544"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/media?parent=21540"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_brand?post=21540"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_cat?post=21540"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/cn\/wp-json\/wp\/v2\/product_tag?post=21540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}