I wonder, could i write a gui or database-query in "shen" language. Anyone ?
[ I know typed-racket and it was worth the effort learning ]
I came across following names : although i don't know what they are good for ,or bad for. Nor how to use them.
-carp
-qi
-coalton
-blisp
-typer
-shen
I wonder, could i write a gui or database-query in "shen" language. Anyone ?
(load "~/quicklisp/setup.lisp")
;(compile-file "./ltk/ltk")
;(load "./ltk/ltk")
(ql:quickload "ltk")
(in-package :ltk)
(declaim (optimize (speed 3) (safety 3)))
(defun main()
(with-ltk ()
(let ((b (make-instance 'button
:master nil
:text "Press Me"
:command (lambda ()
(format t "Hello World!~&")))))
(pack b))))
(sb-ext:save-lisp-and-die "myltk.exe" :toplevel #'main :executable t)
She may not be well pleased by such gender-biased assertionsMy understanding of "God" is that everything would spring fully formed from his thoughts, so why would he write in anything?
(-> addtwo ( integer ) integer )
(defun addtwo (x)
( + 2 x ))
(defun* ( addtwo -> integer ) ((x integer))
( + 2 x ))
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3)))
(ql:quickload :postmodern)
(use-package :postmodern)
(defun myquery ()
(let ( (datetime) (program) (pid) (message)
(fdatetime) (fprogram) (fpid) (fmessage)
(sum));let
(doquery (:order-by (:select 'datetime 'program 'pid 'message :from 'messages_gentoo_20230926) (:desc 'datetime))
( datetime program pid message)
(setf fdatetime (format nil "~12A" datetime ))
(setf fprogram (format nil "~10A" program ))
(setf fpid (format nil "~5A" pid ))
(setf fmessage (subseq (format nil "~60A" message ) 0 40 ))
(setf sum (concatenate 'string fdatetime "|" fprogram "|" fpid "|" fmessage ))
(print sum)
)));defun
(defun main ()
(connect-toplevel "syslogng" "x" "secret" "127.0.0.1" :port 5432 )
(myquery));main
(sb-ext:save-lisp-and-die "h.exe" :toplevel #'main :executable t)
(load "~/quicklisp/setup.lisp")
(declaim (optimize (speed 3) (safety 3)))
(ql:quickload "fiasco")
(ql:quickload "coalton")
(defpackage pack
(:use #:coalton #:coalton-prelude)
(:export main) ) ;defpackage
( in-package :pack)
(named-readtables:in-readtable coalton:coalton)
(coalton-toplevel
(define-type IntList
(MyCons Integer IntList) MyNil) ;define
(declare L IntList)
(define L (MyCons 1 (MyCons 2 (MyCons 3 MyNil)))) ;define
(declare sumlist ( IntList -> Integer))
(define (sumlist x)
(match x
((MyCons y z) (+ y (sumlist z)))
((MyNil) 0 ))) ;define
(declare printInt ( Integer -> Unit ))
(define (printInt s)
(lisp Unit (s)
(cl:princ s)
Unit)
) ;define
(declare main ( Unit -> Unit))
(define (main) (printInt (sumlist L))) ;define
) ;toplevel
(in-package :cl)
(defun main ()
(pack:main coalton:Unit ) ) ;defun
(sb-ext:save-lisp-and-die "test.exe" :toplevel #'main :executable t)
Language features are mostly ok. Problem is the available libraries out-of-the-box.I'm not much into languages that are very obscure and have very small userbases.
I strongly warn against using such languages except for learning new concepts, but there are probably enough more popular languages to stretch your mind.
My usual way to understand a language is to write small test routines and look at the generated machine code. In case of LISP, this seems futile.
(declaim (optimize (speed 3) (safety 0) (debug 0)))
(defun meh (p1 p2)
(declare (fixnum p1 p2))
(the fixnum (+ p1 p2)))
Yes, Master? CL-USER> (disassemble 'meh)
; disassembly for MEH
; Size: 35 bytes. Origin: #x52C8B0FC ; MEH
; 0FC: 498B4510 MOV RAX, [R13+16] ; thread.binding-stack-pointer
; 100: 488945F8 MOV [RBP-8], RAX
; 104: 488D043B LEA RAX, [RBX+RDI]
; 108: 488BD0 MOV RDX, RAX
; 10B: 48D1E2 SHL RDX, 1
; 10E: 700A JO L0
; 110: 488D1400 LEA RDX, [RAX+RAX]
; 114: 488BE5 MOV RSP, RBP
; 117: F8 CLC
; 118: 5D POP RBP
; 119: C3 RET
; 11A: L0: CC4D INT3 77 ; OBJECT-NOT-FIXNUM-ERROR
; 11C: 02 BYTE #X02 ; RAX
; 11D: CC10 INT3 16 ; Invalid argument count trap
NIL
i loved CL in the past, but really, to do this you must be payed by line of codeBelow an example of a postgresql database query :
Code:(load "~/quicklisp/setup.lisp") (declaim (optimize (speed 3) (safety 3))) (ql:quickload :postmodern) (use-package :postmodern) (defun myquery () (let ( (datetime) (program) (pid) (message) (fdatetime) (fprogram) (fpid) (fmessage) (sum));let (doquery (:order-by (:select 'datetime 'program 'pid 'message :from 'messages_gentoo_20230926) (:desc 'datetime)) ( datetime program pid message) (setf fdatetime (format nil "~12A" datetime )) (setf fprogram (format nil "~10A" program )) (setf fpid (format nil "~5A" pid )) (setf fmessage (subseq (format nil "~60A" message ) 0 40 )) (setf sum (concatenate 'string fdatetime "|" fprogram "|" fpid "|" fmessage )) (print sum) )));defun (defun main () (connect-toplevel "syslogng" "x" "secret" "127.0.0.1" :port 5432 ) (myquery));main (sb-ext:save-lisp-and-die "h.exe" :toplevel #'main :executable t)
Below an example of a postgresql database query :
if you paied per line this is for sure a dealCode:(load "~/quicklisp/setup.lisp") (declaim (optimize (speed 3) (safety 3))) (ql:quickload :postmodern) (use-package :postmodern) (defun myquery () (let ( (datetime) (program) (pid) (message) (fdatetime) (fprogram) (fpid) (fmessage) (sum));let (doquery (:order-by (:select 'datetime 'program 'pid 'message :from 'messages_gentoo_20230926) (:desc 'datetime)) ( datetime program pid message) (setf fdatetime (format nil "~12A" datetime )) (setf fprogram (format nil "~10A" program )) (setf fpid (format nil "~5A" pid )) (setf fmessage (subseq (format nil "~60A" message ) 0 40 )) (setf sum (concatenate 'string fdatetime "|" fprogram "|" fpid "|" fmessage )) (print sum) )));defun (defun main () (connect-toplevel "syslogng" "x" "secret" "127.0.0.1" :port 5432 ) (myquery));main (sb-ext:save-lisp-and-die "h.exe" :toplevel #'main :executable t)
![]()
a nice little book was “ansi common lisp”, i highly reccomend if anyone wants to start this beautiful learning experience. Though, if you want to study something really really different and enlighting try Smalltalk ! my first choice CuisSmalltalk.I found this good introductory course online,
View: https://www.youtube.com/watch?v=M-BFgErib4k&list=PLF472FC0985FF6F64&index=2