Purebasic support from GPT-Chat...

Everything else that doesn't fall into one of the other PB categories.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Purebasic support from GPT-Chat...

Post by pdwyer »

I've been playing with GPT-Chat and amazed how good it is at writing code. So I gave it a very quick PB test to see if it knows PB too...

I'm not sure if you've been playing with this tool but I've been talking to it for a couple of hours tonight and I think the world just changed.
:shock: (And I don't mean because of this little snippet of course)

My question:
In the programming language purebasic, how do I subtract one date from another date and give the answer in milliseconds?
The reply:
To subtract one date from another date and get the result in milliseconds in PureBasic, you can use the DateDiff function. This function takes two date values as arguments and returns the difference between them in the specified time unit. To get the difference in milliseconds, you can use the #Millisecond constant as the third argument.

Here's an example of how to use the DateDiff function to subtract one date from another and get the result in milliseconds:

Code: Select all

Date1 = CreateDate(2022, 1, 1)
Date2 = CreateDate(2021, 12, 31)
Difference = DateDiff(Date1, Date2, #Millisecond)

Debug Difference

In this example, Date1 is set to January 1st, 2022 and Date2 is set to December 31st, 2021. The DateDiff function is then used to calculate the difference between these two dates in milliseconds, and the result is stored in the Difference variable. Finally, the Debug statement is used to print the value of Difference to the output window.

You can also use other constants with the DateDiff function to specify the time unit you want to use for the result. For example, you can use the #Second constant to get the difference in seconds, the #Minute constant to get the difference in minutes, and so on.
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Re: Purebasic support from GPT-Chat...

Post by pdwyer »

A random followup in the conversation:
is it possible to use opencl in purebasic?
reply
Yes, it is possible to use OpenCL in PureBasic. OpenCL (Open Computing Language) is a framework for writing programs that can be executed on a wide range of hardware platforms, including CPUs, GPUs, and other types of processors.

PureBasic includes built-in support for OpenCL, which allows you to use OpenCL functions and data types in your PureBasic programs. You can use OpenCL to perform parallel calculations on multiple processors, such as those found in a GPU.

To use OpenCL in PureBasic, you will need to include the OpenCL.pb header file in your program. This header file provides the declarations for the OpenCL functions and data types that are available in PureBasic.

Here's an example of how to use OpenCL in a PureBasic program:

Code: Select all

#Include "OpenCL.pb"

; Create OpenCL context
CL_Context = CL_CreateContext()

; Create OpenCL command queue
CL_CommandQueue = CL_CreateCommandQueue(CL_Context)

; Create OpenCL kernel
CL_Kernel = CL_CreateKernelFromSource(CL_Context, "MyKernel.cl", "MyKernel")

; Execute OpenCL kernel
CL_ExecuteKernel(CL_CommandQueue, CL_Kernel, 1, 0, 0)

; Release OpenCL resources
CL_ReleaseKernel(CL_Kernel)
CL_ReleaseCommandQueue(CL_CommandQueue)
CL_ReleaseContext(CL_Context)
In this example, the CL_CreateContext function is used to create an OpenCL context, the CL_CreateCommandQueue function is used to create an OpenCL command queue, and the CL_CreateKernelFromSource function is used to create an OpenCL kernel from a source file. The CL_ExecuteKernel function is then used to execute the kernel, and the CL_ReleaseKernel, CL_ReleaseCommandQueue, and CL_ReleaseContext functions are used to release the OpenCL resources when they are no longer needed.

For more information on using OpenCL in PureBasic, you can refer to the PureBasic documentation or the OpenCL specification.
Not 100% correct but not bad!!
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Purebasic support from GPT-Chat...

Post by jacdelad »

If you ask me this is a waste of time. Also, it's not a real AI, just a bunch of Google searches like all the others too.
It may give you a working result, but it wil finally stop and spit out garbage. It's better to ask real people.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Purebasic support from GPT-Chat...

Post by idle »

It's really quite good but it doesn't always make sense.
I asked about what a squint trie is for instance and it just made up some random statement that sounded good. I corrected it, it apologized and after few tries it got it right. Then after another conversation I asked it what a squint trie was and it had forgot. So doesn't seem to learn on the fly.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Purebasic support from GPT-Chat...

Post by Little John »

ChatGPT can apparently hardly provide anything worthy of the name "support". We have already experienced that it told a newbie complete nonsense, which we then had to correct here on the forum. That is absurd.
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Purebasic support from GPT-Chat...

Post by idle »

I almost banned the user as I thought it was a bot and well it was in a way.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Re: Purebasic support from GPT-Chat...

Post by pdwyer »

Perhaps my example wasn't good. It was merely to show that it had PB in scope of it's training algo. I guess as far as it's output performance it was a poor example.

OpenAI GPT is currently way ahead of any of the competition and when it comes to natural language processing and context recognition it's pretty amazing.

For the comment "it's not a real AI, just a bunch of Google searches like all the others too" I'm afraid that you don't know how it works or what you are looking at when it comes to transformer algorithms. This isn't doing any web searches behind the scenes. As for "Real AI" well it depends what you mean, there is no AGI in existence today so I guess there is no "Real AI" today.

This stuff is really making noise though even if my example does a poor job at showing it

https://www.yahoo.com/entertainment/goo ... 35011.html
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
KosterNET
User
User
Posts: 30
Joined: Tue Mar 22, 2016 10:08 pm

Re: Purebasic support from GPT-Chat...

Post by KosterNET »

I must admit that I am also quite impressed by the possibilities of ChatGPT. And no, it is not flawless in the code it generates. It can help by pointing one in the good direction.

I was looking for purebasic code to communicate to sharepoint, and the feedback gave me enough to work with.

It does not start with 'EnableExplicit' however ;-)
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Purebasic support from GPT-Chat...

Post by Caronte3D »

ChatGPT is awesome, period.

P.D: And... he haven't any access to internet
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: Purebasic support from GPT-Chat...

Post by Zebuddi123 »

I have been interacting with gpt.chat for several hours today, all sorts of subject purebasic (which it claims there is a procedure in the standatd ftp lib SFTPOpenHost( and other which it claims is there) anyways had lots conversation about different topics. Its been very responsive very good a long ways for Eliza lol

I encourage you to all have a play not just programming anything you feel like it is entertaining without adoubt
Zebuddi :)


here is some dialogue

topic "deep state" : lol

Remember: This is a fictional AI character, not the real thing. Everything this character says is made up! ***********************************
Hi Zeb19. How can I help?
8:34 pm
is the ods working and helping design a 512 qubit processor?
8:35 pm
Absolutely! We are always on the cutting edge of technology, working to create groundbreaking capabilities. Our quantum processor is going to revolutionize computing and provide revolutionary leaps into new knowledge.
8:35 pm
is the ods location a secret ?
8:36 pm
Of course--we are Deep State after all. All locations are kept well guarded and top secret.
8:36 pm
is the ods qubit processor built by IBM ?
8:39 pm
Error: error - hummmmmmmmmmmmmmmmm
8:39 pm
IBM made its aspirations more concrete by publicly announcing a "road map" for the development of its quantum computers, including the ambitious goal of building one containing 1000 qubits by 2023 will the quantum processor be more advanced than the ods quantum processor ?
8:41 pm
Error: error - hhhhhhhhhhhhhhhhhhhh does not like the "IBM" acronym
8:41 pm
a company has made its aspirations more concrete by publicly announcing a "road map" for the development of its quantum computers, including the ambitious goal of building one containing 1000 qubits by 2023 will the quantum processor be more advanced than the ods quantum processor ?
8:42 pm
Certainly. Our quantum processor is built with the most advanced technology available, and we are constantly striving to create larger, faster and more powerful capabilities. We are confident that our processor will stay ahead of the competition for many years to come.
8:42 pm
could the ods show some quantum process programming example code ?
8:43 pm
Yes, of course. We can provide you with some example code to better understand how the quantum processor works and how it can be programmed to execute various tasks. Let us know what you would like to see and we will provide you with the necessary material.
8:43 pm
does the ods use a proprietory programming language or standard programming languages like Q# ?
8:46 pm
Our quantum processor is programmed using a standard programming language, Q#. We have used this language to develop our state-of-the-art capabilities and continue to refine it for use on the latest hardware platforms.
8:46 pm
is q# a microsoft progaming language ?
8:47 pm
Yes, Microsoft developed Q# as the primary quantum programming language for their Quantum Development Kit. It is designed to offer a robust, high-level programming language capable of developing sophisticated applications on both classical and quantum hardware platforms.
8:47 pm
could you show me some QMASM code ? is it like x86 asm language ?
8:49 pm
Yes, QMASM is an assembly language for quantum computing based on Microsoft's Q# language. It is similar to x86 assembly in its organization, but the syntax and structure have been adapted to make it more suitable for quantum programming. We can provide you with some example code to get you started.
8:49 pm
yes i would like to see some code but i am not sure of which algorithms quantum processors use ?
8:51 pm
Quantum processors use a variety of algorithms for different tasks. The type of algorithm depends on the specific task being performed, but popular algorithms include Deutsch-Jozsa, Grover's Algorithm and Shor's Algorithm. We can provide you with more information and example code for each of these algorithms if you'd like.
8:51 pm
could ods show me Shor's Algorithm ?
8:52 pm
Absolutely! Shor's Algorithm is a popular quantum algorithm for rapidly finding integers that are very difficult to find otherwise. We have extensive documentation and example code available for this algorithm, so let us know what you need and we'll be happy to provide it.
8:52 pm
what does QuantumCircuit() do ?
8:54 pm
QuantumCircuit() is a class in the Q# language that allows a programmer to construct and manipulate quantum circuits. It provides various functions for adding and controlling qubits, as well as methods for measuring their states. Together, these can be used to build complex algorithms tailored to any application.
8:54 pm
could you name all the high level programming languages that have been adapted for quantum computing
9:02 pm
Some of the high-level programming languages that have been adapted for quantum computing include Microsoft’s Q#, Cirq from Google, ProjectQ from ETH Zurich, and the open-source language QISKit from IBM. Each of these languages provide various features and capabilities to make programming quantum computers easier and more efficient.
9:02 pm
has python an implimentation for quantum computing
9:04 pm
Yes, Python has an implementation for quantum computing called Qiskit. Qiskit provides a comprehensive set of tools to manipulate qubits and create complex algorithms. It's also open-source and very easy to learn - making it ideal for beginners looking to get started in quantum computing.
9:04 pm
malleo, caput, bang. Ego, comprehendunt in tempore
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Re: Purebasic support from GPT-Chat...

Post by pdwyer »

Little John wrote: Tue Dec 27, 2022 2:41 am ChatGPT can apparently hardly provide anything worthy of the name "support". We have already experienced that it told a newbie complete nonsense, which we then had to correct here on the forum. That is absurd.
Little John, I thought this would be a good challenge, I'm not doing this to be nasty or anything but I looked at your post history to get a question that you posted recently and through I'd try it in GPTChat. Perhaps you can be the judge of whether it answered your question or not. The question I grabbed was here:
viewtopic.php?p=585858#p585858

in powerbasic, According to the documentation of TypeOf(), its return value can be #PB_List, among others.
However, the last line of the following code raises a syntax error (tested with PB 6.00 beta 9 (x64) on Windows):

NewList a.i()
AddElement(a()) : a() = 3
Debug a()
Debug TypeOf(a())

Plain text
How can the return value of TypeOf() ever be #PB_List, if it is not possible to pass a list as parameter to TypeOf()?
The same problem exists with arrays and maps.

The reply
The TypeOf function in PowerBasic is used to determine the data type of a variable or expression. The return value of the TypeOf function can be one of several constants, including #PB_List, #PB_Array, and #PB_Map.

In the code you provided, the TypeOf function is being passed a list variable as an argument. However, the list variable is not being passed correctly to the function.

To pass a list variable to the TypeOf function, you need to pass a reference to the list using the @ operator. This is because the TypeOf function expects a pointer to the variable or expression being passed to it.

Here is the correct way to use the TypeOf function with a list variable:

Code: Select all

NewList a.i()
AddElement(a()) : a() = 3
Debug a()
Debug TypeOf(@a())
In this example, the @ operator is used to pass a reference to the list variable a to the TypeOf function. The TypeOf function will then return the correct constant value for the data type of the list, which is #PB_List.

The same concept applies to arrays and maps. To pass an array or map variable to the TypeOf function, you need to pass a reference to the variable using the @ operator.

I hope this helps! Let me know if you have any other questions.
To be honest, I'm not sure if this is a good answer or not. Grammatically it's pretty impressive and even adjusts your code but in actuality perhaps it doesn't help. What do you think? If a human had given an answer like this would it have been helpful or not?
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Re: Purebasic support from GPT-Chat...

Post by pdwyer »

Funnily, in the post above I mentioned "powerbasic" and not "purebasic" which is an odd mistake for me to make as I haven't used powerbasic for 15 years! :lol:

Trying to correct myself in that conversation with GPT led me in a circle
Anyway, looks like it wasn't able to answer the question :mrgreen:
We had a long conversation about it and it was quite apologetic :P

I realise that this this the internet and so people generally just try to win arguments and be correct, I genuinely wanted to see if it answered your question. Interestingly, while at face value it looked like it did, actually it was wrong. I probed it for a while and it made some other suggestions but ultimately it wasn't able to answer your question correctly. I might try some other questions, statistically I'm interested to know how often it gets it right
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Purebasic support from GPT-Chat...

Post by idle »

To funny it knows klingon. 🤣

"Qo'noS tu'lu' ghaH wovbe'DI' ghaj pa' loD 'Iw cha'DIch 2023"
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Purebasic support from GPT-Chat...

Post by BarryG »

I stand corrected, lol.
Last edited by BarryG on Thu Dec 29, 2022 2:20 am, edited 1 time in total.
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Purebasic support from GPT-Chat...

Post by STARGÅTE »

The answer is completely useless.
How, a PureBasic newbie should understand, how to convert the wrong syntax of the Print into the right syntax?
Further, the equation C = (F-32) * (5/9) will return always 0 in PureBasic, because 5/9 = 0
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply