Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions projects/hello-world/hello-world.asd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(asdf:defsystem :hello-world
:description "A simple Hello World project"
:version "1.0.0"
:author "Your Name"
:license "MIT"
:depends-on (:drakma ; HTTP client
:cl-json ; JSON parsing
:str) ; String utilities
:components ((:file "package")
(:file "hello-world")))
32 changes: 32 additions & 0 deletions projects/hello-world/hello-world.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(in-package :hello-world)

;; Basic hello world
(defun hello ()
(format t "Hello, World!~%"))

;; Function using string library
(defun make-greeting (name)
(str:concat "Hello, " name "!"))

;; Function to demonstrate HTTP library usage
(defun fetch-data ()
(format t "Fetching data from httpbin...~%")
(let ((response (drakma:http-request "http://httpbin.org/get")))
(format t "Received response of ~A bytes~%" (length response))
(format t "First 100 characters: ~A~%"
(subseq (flexi-streams:octets-to-string response)
0 (min 100 (length response))))))

;; Function using JSON library - FIXED VERSION
(defun fetch-json-data ()
(format t "Fetching and parsing JSON data...~%")
(let* ((response-bytes (drakma:http-request "http://httpbin.org/get"))
(response-string (flexi-streams:octets-to-string response-bytes)))
(cl-json:decode-json-from-string response-string)))

;; Main function
(defun main ()
(hello)
(format t "~A~%" (make-greeting "Common Lisp Developer"))
(fetch-data)
(fetch-json-data))
12 changes: 12 additions & 0 deletions projects/hello-world/package.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(defpackage :hello-world
(:use :cl)
(:import-from :drakma :http-request)
(:import-from :cl-json :decode-json-from-string)
(:import-from :str :concat)
(:export :main
:hello
:fetch-data
:fetch-json-data
:make-greeting))

(in-package :hello-world)
9 changes: 0 additions & 9 deletions projects/main/CMakeLists.txt

This file was deleted.

48 changes: 0 additions & 48 deletions projects/main/example.org

This file was deleted.

64 changes: 0 additions & 64 deletions projects/main/main.cpp

This file was deleted.

Loading