<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged other</title>
<link>https://ask.clojure.org/index.php/tag/other</link>
<description></description>
<item>
<title>Complete beginner - questions about formatting, structure etc...</title>
<link>https://ask.clojure.org/index.php/12418/complete-beginner-questions-about-formatting-structure-etc</link>
<description>&lt;p&gt;Hello! I'm sorry if this is the wrong forum to start a thread like this, but I am new to Clojure/lisps in general and thought I would take this year's &lt;a rel=&quot;nofollow&quot; href=&quot;https://adventofcode.com&quot;&gt;Advent of Code (2022)&lt;/a&gt; as an opportunity to challenge myself to learn a bit.&lt;/p&gt;
&lt;p&gt;So I've started Day 1 and solved the problem (in essence, &lt;em&gt;Given a long list of double space separated numbers, find the largest sum amongst them&lt;/em&gt;) but with what looks like the most inelegant thrashing of how one might approach the problem in Clojure.&lt;/p&gt;
&lt;p&gt;For example, the answer for the following would be &lt;code&gt;300&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;10
20

100
200
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;My solution is as follows, and I am wondering primarily:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is this a reasonable approach to the problem, as a beginner, what am I missing out on that would be more elegant.&lt;/li&gt;
&lt;li&gt;How does one even format a line like this?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;(Spoiler below, in case anyone else is interested in the challenge)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require '[clojure.string :as str])

(reduce max (map (fn [x] (reduce + (map #(Integer/parseInt %) (str/split x #&quot;\n&quot;)))) (str/split (slurp &quot;./input-1.txt&quot;) #&quot;\n\n&quot;)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm hoping, time permitting, to be able to continue this journey through the month so hopefully I'm able to as the challenges do become quite complicated even for languages I'm familiar with, but I can already say the REPL is really a wonderful thing.&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12418/complete-beginner-questions-about-formatting-structure-etc</guid>
<pubDate>Thu, 01 Dec 2022 11:51:35 +0000</pubDate>
</item>
</channel>
</rss>