<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>php &middot; Arguable Intelligence</title><link>https://ojmason.net/tags/php/</link><description>Personal musings on computational linguistics, AI, sailing, and generated fiction.</description><language>en-gb</language><managingEditor>Oliver Mason</managingEditor><webMaster>Oliver Mason</webMaster><lastBuildDate>Thu, 04 Nov 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://ojmason.net/tags/php/index.xml" rel="self" type="application/rss+xml"/><item><title>Stockholm Syndrome</title><link>https://ojmason.net/stockholm-syndrome/</link><guid isPermaLink="true">https://ojmason.net/stockholm-syndrome/</guid><pubDate>Thu, 04 Nov 2021 00:00:00 +0000</pubDate><category>programming</category><category>php</category><category>nanogenmo</category><description>I&rsquo;m starting a new temporary project, NaNoGenMo (again). Here I attempt to write a program that generates a 50k word novel during the month of November, because NaNoWriMo (where you just write the novel) would be too easy. As always with any software project that doesn&rsquo;t have any constraints, there is a choice of language in which to implement it. Sensible languages for such a project would be Lisp or Scheme, as it is AI related, and these languages are well-suited to it. (Note: a lot of so-called AI is nowadays done in Python; but that is mainly machine learning, which isn&rsquo;t really AI in the sense that I understand it. Also, I haven&rsquo;t really done any serious Python development, so maybe not this time).</description><content:encoded><![CDATA[<p>I&rsquo;m starting a new temporary project, NaNoGenMo (again). Here I attempt to write a program that generates a 50k word
novel during the month of November, because NaNoWriMo (where you just write the novel) would be too easy. As always with
any software project that doesn&rsquo;t have any constraints, there is a choice of language in which to implement it. Sensible
languages for such a project would be Lisp or Scheme, as it is AI related, and these languages are well-suited to it.
(Note: a lot of so-called AI is nowadays done in Python; but that is mainly machine learning, which isn&rsquo;t really AI in the
sense that I understand it. Also, I haven&rsquo;t really done any serious Python development, so maybe not this time).</p>
<p>However, I have decided to use <a href="https://en.wikipedia.org/wiki/PHP">PHP</a>.</p>
<p>This is a somewhat surprising choice (even surprising to myself), as I don&rsquo;t like PHP. It&rsquo;s a hacky language, which is horrendous.
But recently I have done some work in it for the sailing club, where our results are calculated with it, and I got used to it.
For all its faults, it has a good library, and is fairly flexible. You can even write programs in a kind of functional style.
And it&rsquo;s ubiquitous on the web, so if I ever want to run my system (or parts of it) on the web, I should have no problems doing so.</p>
<p>You can run it pretty easily (just with <code>php YOUR-FILE</code>), so you don&rsquo;t need to worry about build files or class paths or other
complicated stuff. And it&rsquo;s portable.</p>
<p>In a way it&rsquo;s a very simple and straightforward language, so I can pretty much focus on <em>what</em> I want to do, and don&rsquo;t need to worry about
the <em>how</em>. I&rsquo;ll see how it goes, but so far I&rsquo;m quite happy with it. Especially since I realised how to call any function based on its name,
which means I re-invented some kind of object system&hellip; if an object (a plain array) has a key &ldquo;fn_print&rdquo;, then that is used to print itself.
Very easy and nifty. Similarly I can compose function names from some other values, and then call a function. I can even check if it exists,
and fall back to a default if not.</p>
<p>Yes, with other languages you get that kind of thing for free, but sometimes it is easiest to take what&rsquo;s in front of you. I have
railed against PHP in the past, and it&rsquo;s not a good language, but it&rsquo;s there, it&rsquo;s everywhere, and it&rsquo;s easy to use. So let&rsquo;s see how
I get on with a larger project!</p>
]]></content:encoded></item></channel></rss>