Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - denis

#1
Hi folks, have you seen rosalind.info, the website with bioinformatics problems and drills? I think those problems are a good food for newLISP. Look at statistics in top100 or by countries: which languages people use. Lisp is a rare bird there :-(
#2
Hi again, folks!



Tried to find the info in documentation and other forum topics but couldn't.



The question is about load function.



Say I have three files: main.lsp, lib/a.lsp, lib/b.lsp



How do I load file b.lsp into a.lsp if i load a.lsp into main.lsp?



This doesn't work:



; main.lsp:
(load "lib/a.lsp")

; a.lsp:
(load "b.lsp")


because current directory is defined by the directory where main.lsp resides, not the file being loaded.

I don't want to write absolute path as all files il lib directory can constitute a single library, and the lib directory can take arbitrary location in the local filesystem.



Is there some way to load b to a, however?
#3
Some strange behavior:



(set 'lst '("23" "hello" "3.14"))
(float (lst 1))
; -> "3.14" instead of nil


Why so?
#4
Good european morning, folks!



Could anyone advice me how to make colored output in REPL (in Linux)?



Also I thought it would be good to have something like:

> (help curry)
Syntax: (curry func exp)

Transforms func from a function f(x, y) that takes two arguments into a function fx(y) that takes a single argument.  curry can be used on all functions taking two arguments.

Examples:
(set 'f (curry + 10))  → (lambda () (+ 10 (args 0)))
(map (curry list 'x) (sequence 1 5)) →  ((x 1) (x 2) (x 3) (x 4) (x 5))


for more comfortable learning of the language in the interactive mode. Plus it could be not only built-in functions, but also user-defined functions with help information somewhere around:



(define (my-func)

"...help information..."

....



or

# formatted help information

(define (my-func)

...
#5
newLISP in the real world / "double symbol"
March 13, 2012, 04:32:36 AM
Hi! Maybe a simple question, but why double symbol is not detected as symbol?



(symbol? ''a) ; -> nil
; but
(symbol? (eval ''a)) ; -> true


What type of object is ''a (or e.g. '''''''''''''''''''''a) then?
#6
I wonder if someone worked on some newlisp library that operates .jpg, .png, and .gif formats. I need to read width and height of an image. It would be great to have uniform interface, that will automatically detect a format of the image file (given as parameter) and read data common for all these formats.
#7
Dragonfly / newLispization of server/client code
June 14, 2011, 10:44:07 AM
Hi!



Seems, I succeeded to rewrite my Java-made site using newlisp and Dragonfly framework.



It's here: http://pechenga.xpolaris.net">http://pechenga.xpolaris.net



It's in Russian, so short description: this is a site (clone, official website here: http://pechenga-gazeta.ru">http://pechenga-gazeta.ru) of local newspaper with articles and comments to them, sorted by issue, topic, authors and places (some data model implemented through mysql tables). Dragonfly works well with the current amount of data - more than 4000 articles for the last 4 years. I am not sure about speed in the case of multiple requests to the site, but still..



It's a front-end. In jsp I implemented back-end as well, and newlisp implementation is to come. But nowadays I would prefer new approach, using ajax and edit windows over shadowed page, not separate interface. Here with my laziness I meet one small barrier - that I have to write code using html, css, javascript in addition to newlisp (which I like more and more). I all the time forget the syntax of javascript and names of tags and their attributes! :-) So I have idea if to substitute all this extra syntax to the plain Lisp? That is everything - html, css styling, javascript and its frameworks (I choose dojo) can be facaded by lisp code? On the server side at request, newlisp will generate css files, js files, ajax (I would call them "listeners"), attach them to generated html file (I would call it a "loader" as it loads client code to the browser) and send them in response back to user.



If some persistent API to appear, it will be convenient to turn on different javascript frameworks, provide flexible css styling (like handling paddings and backgrounds for many blocks at once), something like input fileds-relational db mapping etc.



Maybe this idea already been implemented somewhere by someone?
#8
Dragonfly / JSON transformation
June 03, 2011, 08:17:26 AM
Hello, it's me again about Dragonfly!



While using plugin artfulcode/json.lsp version 2.0 I tried to build a string in json format (lisp->json function). It turned out that I can not pass variables in the expression (or I don't know how to do it).



Example:

(setq var1 "some value")
(Json:lisp->json '(("var1" var1) ("a" 2) ("var2" '(("b" 3) ("c" (+ 2 2))))))
;; will result in -> { "var1": "var1", "a": 2, "var2": { "b": 3, "c": ["+", 2, 2] } }


So I had to change a bit the file json.lsp (wrapping eval around second element of the pair), for it were able to output correct result:



;; -> { "var1": "some value", "a": 2, "var2": { "b": 3, "c": 4 } }


Is it ok, or I again, as newbie to newlisp, missed something trivial?
#9
Good night everyone!



I am trying to port my website and cms from tomcat/java to dragonfly/newlisp. The site is in Russian (cyrillic), so the problem: when I retrieve data from mysql database and print it through dragonfly's view I get this: "208148208183195166209131208180208182209139209133209138195166209131" instead of "Дзæуджыхъæу" (as an example).



I use mysql.lsp module of newlisp. The default encoding of mysql database is utf8, encoding of page in browser is also utf8. The same result (two-byte code in numbers, but not symbols themeselves) I have got when I used postgresql database with postgres.lsp.



My question is: did I miss something very trivial, or I will have to change mysql.lsp in some way?



If you can give me some hint? Thank you in advance!



Denis