From 1537923a12a48997c91bdffafe4b946d0c231432 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 May 2023 17:23:28 +0300 Subject: Update content for html --- .../2022-05-27-perl-is-still-a-great-choice.html | 2 +- ...-03-16-the-pragmatic-programmer-book-notes.html | 1 + ...4-01-never-split-the-difference-book-notes.html | 1 + ...iling-guprecords:-uptime-records-with-raku.html | 4 +- ...3-05-06-the-obstacle-is-the-way-book-notes.html | 111 +++++++ gemfeed/atom.xml | 336 +++++++-------------- gemfeed/index.html | 1 + 7 files changed, 230 insertions(+), 226 deletions(-) create mode 100644 gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html (limited to 'gemfeed') diff --git a/gemfeed/2022-05-27-perl-is-still-a-great-choice.html b/gemfeed/2022-05-27-perl-is-still-a-great-choice.html index 471f47fc..c1da2f43 100644 --- a/gemfeed/2022-05-27-perl-is-still-a-great-choice.html +++ b/gemfeed/2022-05-27-perl-is-still-a-great-choice.html @@ -151,7 +151,7 @@
Other related posts are:

-2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku
+2023-05-01 Unveiling Guprecords: Global Uptime Records with Raku
2022-05-27 Perl is still a great choice (You are currently reading this)
2011-05-07 Perl Daemon (Service Framework)
2008-06-26 Perl Poetry
diff --git a/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html b/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html index 3b753fd9..1b41348e 100644 --- a/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html +++ b/gemfeed/2023-03-16-the-pragmatic-programmer-book-notes.html @@ -93,6 +93,7 @@
Other book notes of mine are:

+2023-05-06 "The Obstacle is the Way" book notes
2023-04-01 "Never split the difference" book notes
2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)

diff --git a/gemfeed/2023-04-01-never-split-the-difference-book-notes.html b/gemfeed/2023-04-01-never-split-the-difference-book-notes.html index 2d221891..e80e4390 100644 --- a/gemfeed/2023-04-01-never-split-the-difference-book-notes.html +++ b/gemfeed/2023-04-01-never-split-the-difference-book-notes.html @@ -140,6 +140,7 @@
Other book notes of mine are:

+2023-05-06 "The Obstacle is the Way" book notes
2023-04-01 "Never split the difference" book notes (You are currently reading this)
2023-03-16 "The Pragmatic Programmer" book notes

diff --git a/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html b/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html index 18ccb977..782631b6 100644 --- a/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html +++ b/gemfeed/2023-05-01-unveiling-guprecords:-uptime-records-with-raku.html @@ -162,11 +162,11 @@ no1 in 455 days, 18:52:44 | at Sun Jul 21 07:37:51 2024
Other related posts are:

-2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku (You are currently reading this)
+2023-05-01 Unveiling Guprecords: Global Uptime Records with Raku (You are currently reading this)
2022-06-15 Sweating the small stuff - Tiny projects of mine
2022-05-27 Perl is still a great choice
2011-05-07 Perl Daemon (Service Framework)
diff --git a/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html b/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html new file mode 100644 index 00000000..72c2b4bb --- /dev/null +++ b/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html @@ -0,0 +1,111 @@ + + + + +'The Obstacle is the Way' book notes + + + + + +

"The Obstacle is the Way" book notes


+
+Published at 2023-05-06T17:23:16+03:00
+
+These are my personal takeaways after reading "The Obstacle Is the Way" by Ryan Holiday. This is mainly for my own use, but you might find it helpful too.
+
+
+
+         ,..........   ..........,
+     ,..,'          '.'          ',..,
+    ,' ,'            :            ', ',
+   ,' ,'             :             ', ',
+  ,' ,'              :              ', ',
+ ,' ,'............., : ,.............', ',
+,'  '............   '.'   ............'  ',
+ '''''''''''''''''';''';''''''''''''''''''
+                    '''
+
+
+"The obstacle is the way" is a powerful statement that encapsulates the wisdom of turning challenges into opportunities for growth and success. We will explore using obstacles as fuel, transforming weaknesses into strengths, and adopting a mindset that allows us to be creative and persistent in the face of adversity.
+
+

Reframe your perspective


+
+The obstacle in your path can become your path to success. Instead of being paralyzed by challenges, see them as opportunities to learn and grow. Remember, the things that hurt us often instruct us.
+
+We spend a lot of time trying to get things perfect and look at the rules, but what matters is that it works; it doesn't need to be after the book. Focus on results rather than on beautiful methods. In Jujitsu, it does matter that you bring your opponent down, but not how. There are many ways from point A to point B; it doesn't need to be a straight line. So many try to find the best solution but need to catch up on what is in Infront of them. Think progress and not perfection.
+
+Don't always try to use the front door; a backdoor could open. It's nonsense. Don't fight the judo master with judo. Non-action can be action, exposing the weaknesses of others.
+
+
+

Embrace rationality


+
+It is a superpower to see things rationally when others are fearful. Focus on the reality of the situation without letting emotions, such as anger, cloud your judgment. This ability will enable you to make better decisions in adversity. Ability to see things what they really are. E.g. wine is old fermented grapes, or other people behaving like animals while having sex. Show the middle finger if someone persists on the stupid rules occasionally.
+
+

Control your response


+
+You can choose how you respond to obstacles. Focus on what you can control, and don't let yourself feel harmed by external circumstances. Remember, you decide how things affect you; nobody else does. Choose to feel good in response to any situation. Embrace the challenges and obstacles that come your way, as they are opportunities for growth and learning.
+
+

Practice emotional and physical resilience


+
+Martial artists know the importance of developing physical and emotional strength. Cultivate the art of not panicking; it will help you avoid making mistakes during high-pressure situations.
+
+Focus on what you can control. Don't choose to feel harmed, and then you won't be harmed. I decide things that affect me; nobody else does. E.g., in prison, your mind stays your own. Don't ignore fear but explain it away, have a different view.
+
+

Persistence and patience


+
+Practice persistence and patience in your pursuits. Focus on the process rather than the prize and take one step at a time. Remember, the journey is about finishing tasks, projects, or workouts to the best of your ability. Never be in a hurry and never be desperate. There is no reason to be rushed; there are all in the long haul. Follow the process and not the price. Take it one step at a time. The process is about finishing (workout, task, project, etc.).
+
+

Embrace failure


+
+Failure is a natural part of life and can make us stronger. Treat defeat as a stepping stone to success and education. What is defeat? The first step to education. Failure makes you stronger. If we do our best, we can be proud of it, regardless of the result. Do your job, but do it right. Only an asshole thinks he is too good at the things he does. Also, asking for forgiveness is easier than asking for permission.
+
+

Be adaptable


+
+There are many ways to achieve your goals; sometimes, unconventional methods are necessary. Feel free to break the rules or go off the beaten path if it will lead to better results. Transform weaknesses into strengths. We have a choice of how to respond to things. It's not about being positive but to be creative. Aim high, but stuff will happen; E.g., surprises will always happen.
+
+

Embrace non-action


+
+We constantly push to the next thing. Sometimes the best course of action is standing still or even going backwards. Obstacles might resolve by themselves. Or going sideways. Sometimes, the best action is to stand still, go sideways, or even go backwards. Obstacles may resolve themselves or present new opportunities if you're patient and observant. People always want your input before you have all the facts. They want you to play after their rules. The question is, do you let them? The English call it the cool head. Being in control of Stress; requires practice. Appear, the absence of fear (Greek). When all others do it one way, it does not mean it is the correct or best practice.
+
+

Leverage crisis


+
+In times of crisis, seize the chance to do things never done before. Great people use negative situations to their advantage and become the most effective in challenging circumstances.
+
+The art of not panicking; otherwise, you will make mistakes. When overs are shocked, you know which way to take due to your thinking of the problem at Hand. A crisis gives you a chance to do things which never done before. Ordinary people shy from negative situations; great people use these for their benefit and are the most effective. The obstacle is not just turned upside down but used as a catapult.
+
+Be prepared for nothing to work. Problems are an opportunity to do your best, not to do miracles. Always manage your expectations. It will suck, but it will be ok. Build your inner citadel. In good times strengthen it. In bad times rely on it. We should always prepare for things to get tough. Your house burns down: no worries, we eliminated much rubbish. Imagine what can go wrong before things go wrong. We are prepared for adversity; it's other people who aren't. Phil Jackson's hip problem example. To receive unexpected benefits, you must first accept the unexpected obstacles. Meditate on death. It's a universal obstacle. Use it as a reminder to do your best.
+
+Be prepared to begin from the beginning. Be cheerful and eagerly work on the next obstacle. Each time you become better. Life is not a sprint but a marathon. After each obstacle lies another obstacle, there won't be anything without obstacles. Passing one means you are ready for the next.
+
+

Build your inner citadel


+
+Develop your inner strength during good times so you can rely on it in bad times. Always prepare for adversity and face it with calmness and resilience. Maybe reconsider what you really desire. Be humble enough that things which happen will happen.
+
+

Love everything that happens


+
+Turn an obstacle the other way around for your benefit. Use it at fuel. It's simple but challenging. Most are paralyzed instead. The obstacle in the path becomes the path. Obstacles are neither good nor bad. The things which hurt, instruct.
+
+Should I hate people who hate me? That's their problem and not mine. Be always calm and relaxed during the fight. The story of the battle is the story of the smile. Cheerfulness in all situations, especially the bad ones. Love for everything that happens; if it happens, it was meant to happen. We can choose how we react to things, so why not choose to feel good? I love everything that happens. You must never lower yourself to the person you don't like.
+
+

Conclusion


+
+Life is a marathon, not a sprint. Each obstacle we overcome prepares us for the next one. Remember, the obstacle is not just a barrier to be turned upside down; it can also be used as a catapult to propel us forward. By embracing challenges and using them as opportunities for growth, we become stronger, more adaptable, and, ultimately, more successful.
+
+Other book notes of mine are:
+
+2023-05-06 "The Obstacle is the Way" book notes (You are currently reading this)
+2023-04-01 "Never split the difference" book notes
+2023-03-16 "The Pragmatic Programmer" book notes
+
+E-Mail your comments to hi@paul.cyou :-)
+
+More books and other resources I found useful.
+Back to the main site
+ + + diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 7218ceb1..67e3ffb4 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,11 +1,118 @@ - 2023-04-30T16:46:50+03:00 + 2023-05-06T17:23:16+03:00 foo.zone feed To be in the .zone! https://foo.zone/ + + 'The Obstacle is the Way' book notes + + https://foo.zone/gemfeed/2023-05-06-the-obstacle-is-the-way-book-notes.html + 2023-05-06T17:23:16+03:00 + + Paul Buetow + hi@paul.cyou + + These are my personal takeaways after reading 'The Obstacle Is the Way' by Ryan Holiday. This is mainly for my own use, but you might find it helpful too. + +
+

"The Obstacle is the Way" book notes


+
+These are my personal takeaways after reading "The Obstacle Is the Way" by Ryan Holiday. This is mainly for my own use, but you might find it helpful too.
+
+
+
+         ,..........   ..........,
+     ,..,'          '.'          ',..,
+    ,' ,'            :            ', ',
+   ,' ,'             :             ', ',
+  ,' ,'              :              ', ',
+ ,' ,'............., : ,.............', ',
+,'  '............   '.'   ............'  ',
+ '''''''''''''''''';''';''''''''''''''''''
+                    '''
+
+
+"The obstacle is the way" is a powerful statement that encapsulates the wisdom of turning challenges into opportunities for growth and success. We will explore using obstacles as fuel, transforming weaknesses into strengths, and adopting a mindset that allows us to be creative and persistent in the face of adversity.
+
+

Reframe your perspective


+
+The obstacle in your path can become your path to success. Instead of being paralyzed by challenges, see them as opportunities to learn and grow. Remember, the things that hurt us often instruct us.
+
+We spend a lot of time trying to get things perfect and look at the rules, but what matters is that it works; it doesn't need to be after the book. Focus on results rather than on beautiful methods. In Jujitsu, it does matter that you bring your opponent down, but not how. There are many ways from point A to point B; it doesn't need to be a straight line. So many try to find the best solution but need to catch up on what is in Infront of them. Think progress and not perfection.
+
+Don't always try to use the front door; a backdoor could open. It's nonsense. Don't fight the judo master with judo. Non-action can be action, exposing the weaknesses of others.
+
+
+

Embrace rationality


+
+It is a superpower to see things rationally when others are fearful. Focus on the reality of the situation without letting emotions, such as anger, cloud your judgment. This ability will enable you to make better decisions in adversity. Ability to see things what they really are. E.g. wine is old fermented grapes, or other people behaving like animals while having sex. Show the middle finger if someone persists on the stupid rules occasionally.
+
+

Control your response


+
+You can choose how you respond to obstacles. Focus on what you can control, and don't let yourself feel harmed by external circumstances. Remember, you decide how things affect you; nobody else does. Choose to feel good in response to any situation. Embrace the challenges and obstacles that come your way, as they are opportunities for growth and learning.
+
+

Practice emotional and physical resilience


+
+Martial artists know the importance of developing physical and emotional strength. Cultivate the art of not panicking; it will help you avoid making mistakes during high-pressure situations.
+
+Focus on what you can control. Don't choose to feel harmed, and then you won't be harmed. I decide things that affect me; nobody else does. E.g., in prison, your mind stays your own. Don't ignore fear but explain it away, have a different view.
+
+

Persistence and patience


+
+Practice persistence and patience in your pursuits. Focus on the process rather than the prize and take one step at a time. Remember, the journey is about finishing tasks, projects, or workouts to the best of your ability. Never be in a hurry and never be desperate. There is no reason to be rushed; there are all in the long haul. Follow the process and not the price. Take it one step at a time. The process is about finishing (workout, task, project, etc.).
+
+

Embrace failure


+
+Failure is a natural part of life and can make us stronger. Treat defeat as a stepping stone to success and education. What is defeat? The first step to education. Failure makes you stronger. If we do our best, we can be proud of it, regardless of the result. Do your job, but do it right. Only an asshole thinks he is too good at the things he does. Also, asking for forgiveness is easier than asking for permission.
+
+

Be adaptable


+
+There are many ways to achieve your goals; sometimes, unconventional methods are necessary. Feel free to break the rules or go off the beaten path if it will lead to better results. Transform weaknesses into strengths. We have a choice of how to respond to things. It's not about being positive but to be creative. Aim high, but stuff will happen; E.g., surprises will always happen.
+
+

Embrace non-action


+
+We constantly push to the next thing. Sometimes the best course of action is standing still or even going backwards. Obstacles might resolve by themselves. Or going sideways. Sometimes, the best action is to stand still, go sideways, or even go backwards. Obstacles may resolve themselves or present new opportunities if you're patient and observant. People always want your input before you have all the facts. They want you to play after their rules. The question is, do you let them? The English call it the cool head. Being in control of Stress; requires practice. Appear, the absence of fear (Greek). When all others do it one way, it does not mean it is the correct or best practice.
+
+

Leverage crisis


+
+In times of crisis, seize the chance to do things never done before. Great people use negative situations to their advantage and become the most effective in challenging circumstances.
+
+The art of not panicking; otherwise, you will make mistakes. When overs are shocked, you know which way to take due to your thinking of the problem at Hand. A crisis gives you a chance to do things which never done before. Ordinary people shy from negative situations; great people use these for their benefit and are the most effective. The obstacle is not just turned upside down but used as a catapult.
+
+Be prepared for nothing to work. Problems are an opportunity to do your best, not to do miracles. Always manage your expectations. It will suck, but it will be ok. Build your inner citadel. In good times strengthen it. In bad times rely on it. We should always prepare for things to get tough. Your house burns down: no worries, we eliminated much rubbish. Imagine what can go wrong before things go wrong. We are prepared for adversity; it's other people who aren't. Phil Jackson's hip problem example. To receive unexpected benefits, you must first accept the unexpected obstacles. Meditate on death. It's a universal obstacle. Use it as a reminder to do your best.
+
+Be prepared to begin from the beginning. Be cheerful and eagerly work on the next obstacle. Each time you become better. Life is not a sprint but a marathon. After each obstacle lies another obstacle, there won't be anything without obstacles. Passing one means you are ready for the next.
+
+

Build your inner citadel


+
+Develop your inner strength during good times so you can rely on it in bad times. Always prepare for adversity and face it with calmness and resilience. Maybe reconsider what you really desire. Be humble enough that things which happen will happen.
+
+

Love everything that happens


+
+Turn an obstacle the other way around for your benefit. Use it at fuel. It's simple but challenging. Most are paralyzed instead. The obstacle in the path becomes the path. Obstacles are neither good nor bad. The things which hurt, instruct.
+
+Should I hate people who hate me? That's their problem and not mine. Be always calm and relaxed during the fight. The story of the battle is the story of the smile. Cheerfulness in all situations, especially the bad ones. Love for everything that happens; if it happens, it was meant to happen. We can choose how we react to things, so why not choose to feel good? I love everything that happens. You must never lower yourself to the person you don't like.
+
+

Conclusion


+
+Life is a marathon, not a sprint. Each obstacle we overcome prepares us for the next one. Remember, the obstacle is not just a barrier to be turned upside down; it can also be used as a catapult to propel us forward. By embracing challenges and using them as opportunities for growth, we become stronger, more adaptable, and, ultimately, more successful.
+
+Other book notes of mine are:
+
+2023-05-06 "The Obstacle is the Way" book notes (You are currently reading this)
+2023-04-01 "Never split the difference" book notes
+2023-03-16 "The Pragmatic Programmer" book notes
+
+E-Mail your comments to hi@paul.cyou :-)
+
+More books and other resources I found useful.
+Back to the main site
+
+
+
Unveiling `guprecords.raku`: Global Uptime Records with Raku @@ -172,11 +279,11 @@ no1 in 455 days, 18:52:44 | at Sun Jul 21 07:37:51 2024
  • A log file analyzer, for generating anonymized foo.zone visitor stats for both, the Web and Gemini.
  • A social media sharing scheduler a la buffer.com. I am using Buffer at the moment to share posts on Mastadon, Twitter, Telegram and LinkedIn, but it is proprietary and also it's not really reliable.
  • -
  • Rewrite the static photo album generator of irregular.ninja in Raku (from bash)
  • +
  • Rewrite the static photo album generator of irregular.ninja in Raku (from Bash).

Other related posts are:

-2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku (You are currently reading this)
+2023-05-01 Unveiling Guprecords: Global Uptime Records with Raku (You are currently reading this)
2022-06-15 Sweating the small stuff - Tiny projects of mine
2022-05-27 Perl is still a great choice
2011-05-07 Perl Daemon (Service Framework)
@@ -605,6 +712,7 @@ ok codeberg.org/snonux/algorithms/sort Other book notes of mine are:

+2023-05-06 "The Obstacle is the Way" book notes
2023-04-01 "Never split the difference" book notes (You are currently reading this)
2023-03-16 "The Pragmatic Programmer" book notes

@@ -883,6 +991,7 @@ The remaining content of the Gemtext file...
Other book notes of mine are:

+2023-05-06 "The Obstacle is the Way" book notes
2023-04-01 "Never split the difference" book notes
2023-03-16 "The Pragmatic Programmer" book notes (You are currently reading this)

@@ -2906,7 +3015,7 @@ v = 008 [v = p*c*(s != c ? 2 : 1)] Total logical CPUs
Other related posts are:

-2023-05-01 Unveiling guprecords.raku: Global Uptime Records with Raku
+2023-05-01 Unveiling Guprecords: Global Uptime Records with Raku
2022-05-27 Perl is still a great choice (You are currently reading this)
2011-05-07 Perl Daemon (Service Framework)
2008-06-26 Perl Poetry
@@ -8037,223 +8146,4 @@ first 10 nat_pairs_not_null
- - Standard ML and Haskell - - https://foo.zone/gemfeed/2010-04-09-standard-ml-and-haskell.html - 2010-04-09T22:57:36+01:00 - - Paul Buetow - hi@paul.cyou - - I am currently looking into the functional programming language Standard ML (aka SML). The purpose is to refresh my functional programming skills and to learn something new too. Since I already knew a little Haskell, I could not help myself, and I also implemented the same exercises in Haskell. - -
-

Standard ML and Haskell


-
-Published at 2010-04-09T22:57:36+01:00
-
-I am currently looking into the functional programming language Standard ML (aka SML). The purpose is to refresh my functional programming skills and to learn something new too. Since I already knew a little Haskell, I could not help myself, and I also implemented the same exercises in Haskell.
-
-As you will see, SML and Haskell are very similar (at least when it comes to the basics). However, the syntax of Haskell is a bit more "advanced". Haskell utilizes fewer keywords (e.g. no val, end, fun, fn ...). Haskell also allows to write down the function types explicitly. What I have been missing in SML so far is the so-called pattern guards. Although this is a very superficial comparison for now, so far, I like Haskell more than SML. Nevertheless, I thought it would be fun to demonstrate a few simple functions of both languages to show off the similarities.
-
-Haskell is also a "pure functional" programming language, whereas SML also makes explicit use of imperative concepts. I am by far not a specialist in either of these languages, but here are a few functions implemented in both SML and Haskell:
-
-

Defining a multi-data type


-
-Standard ML:
-
- -
datatype ’a multi
-	= EMPTY
-	| ELEM of ’a
-	| UNION of ’a multi * ’a multi
-
-
-Haskell:
-
- -
data (Eq a) => Multi a
-    = Empty
-    | Elem a
-    | Union (Multi a) (Multi a)
-    deriving Show
-
-
-

Processing a multi


-
-Standard ML:
-
- -
fun number (EMPTY) _ = 0
-	| number (ELEM x) w = if x = w then 1 else 0
-	| number (UNION (x,y)) w = (number x w) + (number y w)
-fun test_number w = number (UNION (EMPTY, \
-    UNION (ELEM 4, UNION (ELEM 6, \
-    UNION (UNION (ELEM 4, ELEM 4), EMPTY))))) w 
-
-
-Haskell:
-
- -
number Empty _ = 0
-number (Elem x) w = if x == w then 1 else 0
-test_number w = number (Union Empty \
-    (Union (Elem 4) (Union (Elem 6) \
-    (Union (Union (Elem 4) (Elem 4)) Empty)))) w
-
-
-

Simplify function


-
-Standard ML:
-
- -
fun simplify (UNION (x,y)) =
-    let fun is_empty (EMPTY) = true | is_empty _ = false
-        val x’ = simplify x
-        val y’ = simplify y
-    in if (is_empty x’) andalso (is_empty y’)
-            then EMPTY
-       else if (is_empty x’)
-            then y’
-       else if (is_empty y’)
-            then x’
-       else UNION (x’, y’)
-    end
-  | simplify x = x
-
-
-Haskell:
-
- -
simplify (Union x y)
-    | (isEmpty x’) && (isEmpty y’) = Empty
-    | isEmpty x’ = y’
-    | isEmpty y’ = x’
-    | otherwise = Union x’ y’
-    where
-        isEmpty Empty = True
-        isEmpty _ = False
-        x’ = simplify x
-        y’ = simplify y
-simplify x = x
-
-
-

Delete all


-
-Standard ML:
-
- -
fun delete_all m w =
-    let fun delete_all’ (ELEM x) = if x = w then EMPTY else ELEM x
-          | delete_all’ (UNION (x,y)) = UNION (delete_all’ x, delete_all’ y)
-          | delete_all’ x = x
-    in simplify (delete_all’ m)
-    end
-
-
-Haskell:
-
- -
delete_all m w = simplify (delete_all’ m)
-    where
-        delete_all’ (Elem x) = if x == w then Empty else Elem x
-        delete_all’ (Union x y) = Union (delete_all’ x) (delete_all’ y)
-        delete_all’ x = x
-
-
-

Delete one


-
-Standard ML:
-
- -
fun delete_one m w =
-    let fun delete_one’ (UNION (x,y)) =
-            let val (x’, deleted) = delete_one’ x
-                in if deleted
-                   then (UNION (x’, y), deleted)
-                   else let val (y’, deleted) = delete_one’ y
-                       in (UNION (x, y’), deleted)
-                   end
-                end
-          | delete_one’ (ELEM x) =
-            if x = w then (EMPTY, true) else (ELEM x, false)
-          | delete_one’ x = (x, false)
-            val (m’, _) = delete_one’ m
-        in simplify m’
-    end
-
-
-Haskell:
-
- -
delete_one m w = do
-    let (m’, _) = delete_one’ m
-    simplify m’
-    where
-        delete_one’ (Union x y) =
-            let (x’, deleted) = delete_one’ x
-            in if deleted
-                then (Union x’ y, deleted)
-                else let (y’, deleted) = delete_one’ y
-                    in (Union x y’, deleted)
-        delete_one’ (Elem x) =
-            if x == w then (Empty, True) else (Elem x, False)
-        delete_one’ x = (x, False)
-
-
-

Higher-order functions


-
-The first line is always the SML code, the second line the Haskell variant:
-
-
-fun make_map_fn f1 = fn (x,y) => f1 x :: y
-make_map_fn f1 = \x y -> f1 x : y
-
-fun make_filter_fn f1 = fn (x,y) => if f1 x then x :: y else y
-make_filter_fn f1 = \x y -> if f1 then x : y else y
-
-fun my_map f l = foldr (make_map_fn f) [] l
-my_map f l = foldr (make_map_fn f) [] l
-
-fun my_filter f l = foldr (make_filter_fn f) [] l
-my_filter f l = foldr (make_filter_fn f) [] l
-
-
-E-Mail your comments to hi@paul.cyou :-)
-
-Back to the main site
-
-
-
diff --git a/gemfeed/index.html b/gemfeed/index.html index 6acc8c7b..eedfaba5 100644 --- a/gemfeed/index.html +++ b/gemfeed/index.html @@ -12,6 +12,7 @@

To be in the .zone!



+2023-05-06 - 'The Obstacle is the Way' book notes
2023-05-01 - Unveiling guprecords.raku: Global Uptime Records with Raku
2023-04-09 - Algorithms and Data Structures in Go - Part 1
2023-04-01 - 'Never split the difference' book notes
-- cgit v1.2.3