简体   繁体   中英

Clojure. Cursive. No debugger?

I'm learning Clojure using "Clojure From the Ground Up" by Kyle Kingsbury.

The VERY FIRST exercise is to write a Clojure routine to test if a given string is a palindrome.

I wrote something recursive:

在此处输入图片说明

==================================================

I put in the various println statements to debug it.

Then I discovered Cursive has a debugger! I tried using it. I can't get the debugger to stop at a breakpoint.

I pull down Run --> Debug... and get the following console output:

==================================================

<>

Connected to the target VM, address: '127.0.0.1:5994', transport: 'socket'
Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended


    Top  1234564321
    Nil?  1234564321
    Equal  1234564321

    Top  (2 3 4 5 6 4 3 2)
    Nil?  (2 3 4 5 6 4 3 2)
    Equal  (2 3 4 5 6 4 3 2)

    Top  (3 4 5 6 4 3)
    Nil?  (3 4 5 6 4 3)
    Equal  (3 4 5 6 4 3)

    Top  (4 5 6 4)
    Nil?  (4 5 6 4)
    Equal  (4 5 6 4)

    Top  (5 6)
    Nil?  (5 6)


Exception in thread "main" Syntax error compiling at (C:\Users\Joe Us-er\OneDrive\Chit\CChit\palin\src\palin\palin.clj:24:1).

<>

Disconnected from the target VM, address: '127.0.0.1:5994', transport: 'socket'

Process finished with exit code 1

==================================================

I don't know which is information and which is just data. For now, WHY didn't my program stop at any breakpoints? Thank you.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

1/1/2020 OK. I took your advice and wrote something simpler. And STILL no breakpoints. Here's a screen shot:

2 行函数,带有许多未命中的断点。

Note that "Top" and "Bottom" both get println'd, but no breakpoints get hit.

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

1/2/2020 Here's 'stupid' again, with no syntax errors, and still not hitting any breakpoints.

在此处输入图片说明

Is there some sort of special namespace I should be referencing for debugging? I seem to remember reading something about that that I didn't understand.

Or is that "64-bit server VM warning" message significant?

Found it! What's missing from my code is an initial namespace declaration. Once I put this line in:

(ns stupid)

and hit the debug button, the 'stupid' program started up and stopped at the first breakpoint! Yay!

Kudos to Daniel O King for his throwaway comment "Every Clojure file starts with a call to the ns operator," at Medium.com https://medium.com/@daniel.oliver.king

I have seen this documented nowhere else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM