• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
Hexstream Avatar
Name:Jean-Philippe Paradis
Clan:HexstreamSoft
Skills:common lisp
Member Since:Nov 2023
Last Seen:Nov 2023
Profiles:
Following:1
Followers:1
Allies:1
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (19)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • Hexstream
    • commented on "Roman Numerals Decoder" commonlisp solution
    • 2 years ago

    Oh, please!! 🤦😭

  • Custom User Avatar
    • Hexstream
    • commented on "Roman Numerals Decoder" commonlisp solution
    • 2 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • Hexstream
    • commented on "Roman Numerals Decoder" commonlisp solution
    • 2 years ago

    This solution is obsolete, please see my better one here:

    https://www.codewars.com/kata/reviews/634836df8cdfd90001d42728/groups/6556bb195702a80001bc9ef8

  • Custom User Avatar
    • Hexstream
    • commented on "Playing with digits" commonlisp solution
    • 2 years ago

    Yes, although I don't think I would call these "abstractions". :)

  • Custom User Avatar
    • fguerco
    • commented on "Playing with digits" commonlisp solution
    • 2 years ago

    oh thanks for the feedback! you mean to use the code directly in place instead of creating the abstractions? if i understood correctly it's a good point. ty again

  • Custom User Avatar
    • Hexstream
    • commented on "Playing with digits" commonlisp solution
    • 2 years ago

    "value-or-minus1" and "str-n" are unnecessary.

  • Custom User Avatar
    • Hexstream
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    See my solution and comment here:

    https://www.codewars.com/kata/reviews/60355d9211d5420001b6043c/groups/6550256299b1c40001f15e56

  • Custom User Avatar
    • Hexstream
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    This tail-recursive solution is provided for illustrative purposes.
    Note that Tail Call Optimization (TCO) is Common Lisp implementation specific.

    Since the recursive call to itself is the last thing done by function RECURSE,
    there is no actual need to ever return to the stack frame, so it can be deallocated before recursing, or it could simply be reused.

    Effectively, this is an iterative solution expressed in a recursive way.

    It seems SBCL does not perform TCO by default since it can make debugging harder,
    hence the need for (declare (optimize (debug 0))).

    Try (summation 100000000) in your favorite Common Lisp implementation and see if it blows up the stack!

  • Custom User Avatar
    • manoger
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    I understand. In that scenario, I would assume that there is a method or keyword to implement safe stack recursion.

  • Custom User Avatar
    • Hexstream
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • Hexstream
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    I suspected there was a direct mathematical solution, but was not able to figure it out on my own, and I did not want to try finding the solution on the internet, as on CodeWars I want to use my own original solutions only, so I went for the obvious one.

    I saw the direct mathematical solution after submitting my answer, but did not want to resubmit just to copy the better solution, as again on CodeWars I want to use my own original solutions only. I don't want to get into bad habits.

    I hope this is to your satisfaction.

  • Custom User Avatar
    • Hexstream
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    Dividing by 2 would be clearer than multiplying by 0.5...

  • Custom User Avatar
    • hobovsky
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    Both solutions are O(n), what makes them equally bad! Check my better, O(1) solution here! ;)

  • Custom User Avatar
    • Hexstream
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    See my better solution here:

    https://www.codewars.com/kata/reviews/60355d9211d5420001b6043c/groups/654e63ec18d6a70001b98dac

  • Custom User Avatar
    • Hexstream
    • commented on "Grasshopper - Summation" commonlisp solution
    • 2 years ago

    Note that this solution can easily blow up the stack due to excessive recursion if n is large enough.

  • Loading more items...
  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...