Wanna make ChatGPT cycle forever? With Clarion you can :)

Just tell it to make code in Clarion to convert hex to bin string.

It just starts throwing some includes and repeats itself :slight_smile: poor thing

Well, it takes a human to do programming in Clarion, I guess :slight_smile:

1 Like

It actually created a usable function when I asked for hex to binary. However, when I asked for binary to hex, it went insane…

I am continiously using ChatGPT without many issues - like converting from one language to another (including Clarion) - or asking general and complex Clarion stuff too - thing I noticed is sometimes it messes stuff up - like I asked for a conversion from C++ typedef to Clarion and it used ^ instead of * for references

2 Likes

I find ChatGPT to be pretty dang useful, but oftentimes it doesn’t know its limitations, which can end up costing a lot more time than it would have taken to do it myself in the first place.

It seems to get ahead of its skis, presenting false information with the same matter-of-factness that you would get when telling a known truth. This was most evident when I asked for a list of prime numbers up to 1000 (decimal) but listed in octal notation.

I guess, sometimes, proofreading the ChatGPT output is easier than doing the writing itself (or staring at an empty page) :slight_smile: But if you take its output verbatim, you’re probably going to have a bad time.

1 Like

Totally agree. I found it giving false info quite often, even sounding so “sure of itself” that I definitely wouldn’t rely on it without an easy recheck. If verifying info would be too time consuming, I avoid chatgpt.

It’s one of those things where we just have to figure out which things to ask so we can properly exploit this technology for whatever benefit we’re trying to achieve. And our experiences are only of the current rendition of this technology. Who knows what it will be like in 6 months. So our pre-conceived notions about ChatGPT will need re-conceiving every now and then.

This is a pretty decent assessment. There is a slight amount of profanity, so may be NSFW for some.

The human mind is, at its core, not “reasonable”.
Although it is consistent in that one can predict that it will generally behave in a manner to protect itself and to be in sync with what its “gut” assumes at the moment to be its self-interest.

The human mind also considers itself intelligent.

So why should it expect “artificial” intelligence to behave any more “reasonably” than does the human mind itself?

– Ms Anthropy

1 Like

OMG clarion and AI , just trow some coding and give me few errors but overall great… had no idea , Im so excited for.years I struggle understaending basic coding and now is heaven I can go from C++ to.Clarion To Arduino … my wife is going to divorce me She saying Im having in affair with ChatGPT and I spent way too.much time with her . Nonsense but shes pretty darn exciting . :smile:

1 Like

OMG - Never accidentally delete a post.
It creates a living hell. LOL

Here’s what I wrote:
“We really need an emoji for ROFL or something similar.”

What living hell did it give? Just curious as I’ve not heard of problems before?

I accidentally deleted the original message.
Then, when I attempted to resend it, it said that the message was too similar to one I just sent.

Next I tried to undo the deletion, but apparently you can’t do that.

The ultimate answer was to change the message.
I choose t add something.

Didn’t mean to be offensive about my comment, but it seemed over the top considering the message was deleted.

Hi Dave

I wasn’t taking offence, I was just curious as to what your experience was. Thanks for letting me know.

Mark :slight_smile:

Im sure the engineers here are following these Interesting articles and developments.

Lots of languages now supporting bindings to their RT API’s.

I find it usefull to provide context when I submit my problem to ChatGPT for the first time.
E.g. When I as about MSSQL,I type MSSQL: ant then the question.
Also when I know that the answer is wrong, I wil let it know, and I provide errorcodes with it…
Most of the times the program will come up with an alternative answer, more fitting to the question.
It also helps to increase the difficulty of the questions one step at the time.
Patience is a virtue here. Not really my thing but I know it helps.

Anthropic just released their competitor to ChatGPT, Claude 2. I asked it to create the binary to hex function and it did it like ChatGPT did; however, when I asked it for the hex to binary, it created a function. It didn’t work out of the box; but, it was recognizable and didn’t include a crap ton of useless code. I suspect it will get better with time…

What it created:

FUNCTION BinaryToHex (STRING binary) RETURNS STRING

  CODE 
   
  STRING hex, nibble
  LONG i
  hex = ''

  LOOP i = 1 TO LEN(binary) BY 4
    nibble = SUB(binary, i, 4)
    
    CASE nibble
    
      '0000': hex = hex & '0'
      '0001': hex = hex & '1'
      '0010': hex = hex & '2'  
      '0011': hex = hex & '3'
      '0100': hex = hex & '4'
      '0101': hex = hex & '5'
      '0110': hex = hex & '6'
      '0111': hex = hex & '7'
      '1000': hex = hex & '8'
      '1001': hex = hex & '9'
      '1010': hex = hex & 'A'
      '1011': hex = hex & 'B'
      '1100': hex = hex & 'C'
      '1101': hex = hex & 'D'
      '1110': hex = hex & 'E'
      '1111': hex = hex & 'F'
      
    END

  END

  RETURN hex
  
END

What it needed to be:

FUNCTION BinaryToHex (STRING binnum), STRING
hex                 STRING(128)
nibble              STRING(4)
i                   LONG
  CODE                                                     ! Begin processed code
    hex = ''
    LOOP i = 1 TO LEN(binnum) BY 4      
        nibble = SUB(binnum, i, 4)
        CASE nibble
        OF '0000'
            hex = CLIP(hex) & '0'
        OF '0001'
            hex = CLIP(hex) & '1'
        OF '0010'
            hex = CLIP(hex) & '2'  
        OF '0011'
            hex = CLIP(hex) & '3'
        OF '0100'
            hex = CLIP(hex) & '4'
        OF '0101'
            hex = CLIP(hex) & '5'
        OF '0110'
            hex = CLIP(hex) & '6'
        OF '0111'
            hex = CLIP(hex) & '7'
        OF '1000'
            hex = CLIP(hex) & '8'
        OF '1001'
            hex = CLIP(hex) & '9'
        OF '1010'
            hex = CLIP(hex) & 'A'
        OF '1011'
            hex = CLIP(hex) & 'B'
        OF '1100'
            hex = CLIP(hex) & 'C'
        OF '1101'
            hex = CLIP(hex) & 'D'
        OF '1110'
            hex = CLIP(hex) & 'E'
        OF '1111' 
            hex = CLIP(hex) & 'F'
        END

    END
    RETURN(hex)

Perhaps you oughta loop backwards, in case your bit count doesn’t jibe. or use EVALUATE(MyBits & ‘b’).

If you have more than 32 bits, then your way is better than EVALUATE(if you loop backwards).

Not thoroughly tested, but you get the idea.

  PROGRAM
  
    MAP
      EvalBits(STRING pBitString),ULONG
    END
    
Bits STRING('011011010101011111101')

  CODE
  
  MESSAGE(EvalBits(Bits))
  
EvalBits  PROCEDURE(STRING pBitString)!,ULONG  
HasSign BYTE

  CODE
  
  HasSign = CHOOSE(LOWER(SUB(pBitString,-1,1)) = 'b')
  
  IF LEN(pBitString) - HasSign > 32
     !Throw an error as you see fit
  END
  
  RETURN EVALUATE(pBitString & CHOOSE(NOT HasSign,'b',''))

In Australia I get: “Unfortunately, Claude.ai is only available in the US and UK. We’re working hard to expand to other regions soon.”

It will be interesting to see how all these AI services develop over the next few years.

pBitString should be CLIP() in that code. If a STRING Variable was passed (like below) the trailing spaces would be included and the SUB(,-1,1) would not work without CLIP. I often am not sure about the trailing spaces and recheck to be sure, as I did here.

Bits STRING(33)
    CODE
    Bits = '111'   
    B = EvalBits( Bits )  !This passes '111' and 30 trailing spaces 

I wrote the below code using P Strings so I can CLIP() once on assignment.

EvalBitsCB  PROCEDURE(STRING inBitString)!,ULONG  
BitsPString PSTRING(33) !Limit to 32 bits max
TrailingBee PSTRING(2)  !'b' or ''
  CODE
  BitsPString = CLIP(LEFT(inBitString))
  IF ~BitsPString THEN BitsPString='0b'.    !Blank Evals('b') = Error 1011
  TrailingBee = CHOOSE(LOWER(SUB(BitsPString,-1,1))='b','','b') 
  IF 0 THEN     !Change to IF 1 to see debug 
      Message('EvalBitsCB  ' & |
             '|inBitString="' & inBitString &'"'& |
             '|BitsPString="' & BitsPString &'"'& |
             '|LEN=' & LEN(BitsPString) & |
             '|SUB(-1)="' & SUB(BitsPString,-1,1) &'"'& |
             '|TrailingBee="' & TrailingBee  &'"', 'Debug EvalBitsCB') 
  END
  RETURN EVALUATE(BitsPString & TrailingBee)

It worked passing a STRING(33):

EvalBits_TEST   PROCEDURE()
Bits STRING(33)
    CODE
    Bits = '011011010101011111101'
!    Bits = '011011010101011111101b'
!    Bits = ''
!    MESSAGE(Bits &'||EvalBitsJS()=' & EvalBitsJS(Bits),'EvalBits_TEST')
    MESSAGE(Bits &'||EvalBitsCB()=' & EvalBitsCB(Bits) &'||Error: '& ErrorCode() &' '& Error(),'EvalBits_TEST')
  
1 Like