Making a colorpicker
cage
cage-dev at twistfold.it
Mon Aug 19 15:24:16 UTC 2019
On Mon, Aug 19, 2019 at 12:00:26AM +0200, Tom wrote:
> Hi,
Hello!
> I did some things, and now it's on Github. Feel free to look:
> https://github.com/Trashtalk217/ltk-colorpicker.
Congratulations! I hope you had fun with CL and LTK! :)
> Thanks for the advice I got. I now use two images for displaying the color
> wheel and the white-to-black gradient. While most of the code is still yanky
> as heck (just look at my installation instructions -_-).
That code looks clean and effective to me i think i can see you have a
good programming background (and, for inesplicable reasons, i thought
you was a lisp newbie but seems i was wrong); I have anyway a couple of
humble considerations that i think are worth noting:
- FWIW the equivalent of '%' operation in C99 is 'cl:rem', not 'cl:mod'
(probably you are aware of that but, if not, this can save a few bug
in the future :-) )
http://clhs.lisp.se/Body/f_mod_r.htm
- likely is better to replace 'cl:merge-pathnames' with an asdf
function 'asdf:system-relative-pathname'
https://common-lisp.net/project/asdf/asdf.html#Miscellaneous-Functions
Maybe (just guessing) this could solve your installation problem
(sorry i did not got your code running for lack of time :( ).
- some lisper suggested (on IRC?) to not to insert empty lines in forms
that are not toplevel so:
(defun foo ()
....
)
(defun bar ()
...
)
is ok but:
(defun baz ()
(form1)
(form2)
(form3))
not, instead:
(defun baz ()
(form1)
(form2)
(form3))
and i followed this rule more or less strictly (but this is just a
stylistic choice, of course)
- sometimes is better to reformat the math expressions for clarity, for example:
https://github.com/Trashtalk217/ltk-colorpicker/blob/master/ltk-colorpicker.lisp#L48
(+ (- (acos (/ x r))) (* 2 pi))
to:
(+ (- (acos (/ x r)))
(* 2 pi))
this way i feel it is more clear the sum's operators but, again, YMMV.
I hope what i wrote do not annoyed you, all of above are just opinions
not law :)
Anyway, again: congratulation!
Bye!
C.
More information about the ltk-user
mailing list