- Callout: Use
python
directive to call Python statements. Enclose the Python statement in square brackets[]
. Example:python[print('hello world')]
will call the Python statementprint('hello world')
.
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Study Name,Year,Number of Developers,Coding Assistant(s),Method,Productivity Improvement,Key Findings,Link | |
GitHub Copilot Survey,2022,"2,000+",GitHub Copilot,Survey,55% reported increased productivity,"- 88% felt more productive overall | |
- 74% could focus on more satisfying work | |
- 77% spent less time searching for information or examples",https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/ | |
McKinsey Developer Productivity Survey,2022,"1,000+",Various AI-powered tools,Survey,Up to 45% increase,"- AI tools could automate up to 30% of daily tasks | |
- Productivity gains most significant for entry-level developers",https://www.mckinsey.com/capabilities/mckinsey-digital/our-insights/unleashing-developer-productivity-with-generative-ai | |
GitHub Copilot Survey,2023,500,Various AI Coding Tools,Survey,57% of developers found AI tools beneficial for skill development and productivity,"- 92% of developers use AI tools | |
- 81% expect AI to enhance collabo |
PromptScript is a pseudolanguage designed to structure and clarify interactions with AI models like GPT-4. It allows users to express complex tasks, rules, and heuristics, helping the AI understand the tasks more accurately.
-
Directives: These set the context for an instruction. Begin a directive with
#
. The following directives can be used:#story
,#technical
,#informal
,#formal
. Use#heuristic
when defining heuristics. Example:#technical explain {quantum physics}
-
Action Words: Standard English verbs that define the task for the AI. These include but are not limited to
describe
,explain
,list
,summarize
. Example:describe {the Eiffel Tower}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (h *Heap) rearrange(i int) { | |
... | |
if left < size && h.elements[left-1] > h.elements[largest] { | |
largest = left | |
} | |
... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func FuzzHeap(f *testing.F) { | |
var h *Heap = &Heap{} | |
h.elements = []int{452, 23, 6515, 55, 313, 6} | |
h.Build() | |
testCases := []int{51, 634, 9, 8941, 354} | |
for _, tc := range testCases { | |
f.Add(tc) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestHeap(t *testing.T) { | |
var h *Heap = &Heap{} | |
h.elements = []int{452, 23, 6515, 55, 313, 6} | |
h.Build() | |
testCases := []int{51, 634, 9, 8941, 354} | |
for _, tc := range testCases { | |
h.Push(tc) | |
// make a copy of the elements in the slice and sort it in descending order | |
elements := make([]int, len(h.elements)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Heap struct { | |
elements []int | |
} | |
func (h *Heap) Push(ele int) { | |
h.elements = append(h.elements, ele) | |
i := len(h.elements) - 1 | |
for ; h.elements[i] > h.elements[parent(i)]; i = parent(i) { | |
h.swap(i, parent(i)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestTSetInt(t *testing.T) { | |
set := NewTSet[int]() | |
set.Add(100) | |
set.Add(200) | |
set.Add(300) | |
set.Add(400) | |
if !set.Has(400) { | |
t.Error("set doesn't have 400") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestTSet(t *testing.T) { | |
set := NewTSet[string]() | |
set.Add("the") | |
set.Add("quick") | |
set.Add("brown") | |
set.Add("fox") | |
set.Add("the") | |
if !set.Has("quick") { | |
t.Error("set doesn't have quick") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type TSet[K comparable, V int] struct { | |
items map[K]V | |
} | |
func NewTSet[K comparable, V int]() TSet[K, V] { | |
return TSet[K, V]{items: make(map[K]V)} | |
} | |
func (s *TSet[K, V]) Add(item K) { | |
s.items[item] = 1 |
NewerOlder