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

Messages - fdb

#61
Thanks a lot bairui and Luts! Hadn't used curry before.



Another question i just encountered is how to change all items in a list in one go, for example:



(set-ref-all "2" '(("1" "2" "3") ("4")) (int $it))
(("1" 2 "3") ("4"))


Works but i want to change all the strings to integers in one go but couldn't find an expression which matches

all the strings, see below some examples i tried but didn't work

> (set-ref-all '((*)) '(("1" "2" "3") ("4")) (int $it))
nil
> (set-ref-all '(?) '(("1" "2" "3") ("4")) (int $it))
nil
> (set-ref-all '(*) '(("1" "2" "3") ("4")) (int $it))
nil
> (set-ref-all '(+) '(("1" "2" "3") ("4")) (int $it))
nil
> (set-ref-all ? '(("1" "2" "3") ("4")) (int $it))
nil
> (set-ref-all * '(("1" "2" "3") ("4")) (int $it))
nil

#62

> (map (apply +) '((0 1 2) (3 4 5)))
((0 1 2) (3 4 5))
> (map (fn(x) (apply + x)) '((0 1 2) (3 4 5)))
(3 12)


Why doesn't the first example work?
#63
Hi , i've added the ability to delete rows and columns in a table in a build i made in 10.5.4

I have added the following methods to Dispatcher.java:

methods.put("table-remove-row", "tableRemoveRow"); //deleting of a row
methods.put("table-set-column-name", "tableSetColumnIdentifiers");//add/delete/update
methods.put("table-set-rows", "tableSetRowCount"); //adding /deleting rows

and implemented them in TableWidget.java.



Then i've coded the new functions in newlisp in guiserver.lsp.

After compiling the java stuff and make /make build, everything seems to work!



I was surprised how easy this was and am very impressed by the documentation and the clean code, everything 'just works' ;-)



Be aware that i'm not a professional programmer so who knows what errors I made but if Lutz is interested i'll be more then happy to share my code to include this in future versions.
#64
Great! Are you also planning to add the ability to delete rows and columns? At the moment i dispose  the frame and then recalc and recreate the frame , which doesn't matter too much because i have to recalc  all the tables (6) anyway but it does of course means flickering.
#65
Thx for the reply, i'll dispose the frame and rebuilt it after i've recalculated the UI.



I also saw there seemed to be  no option to have a table without column headers, but you can actually achieve this with an empty string "" as the column header so
(gs:table 'row-table 'gs:no-action "" "") will give you a table with two columns but you don't see the column header.
#66
How can i delete rows and/or columns in a gs:table? there seems to be only the option to add them..or am i missing something?  Furthermore i cannot delete a gs:table when i try to do so with gs:dispose i get the message

dispose cannot be applied to MAIN:row-table
#67
newLISP in the real world / Re: Thousand's separator
November 09, 2013, 01:34:53 PM
Quote from: "rickyboy"
Quote from: "steloflute"One-liner:

(define (format1000 n)
(append (sgn n "-" "" "") (reverse (join (explode (reverse (string (abs n))) 3) ","))))
(format1000 123456789)
(format1000 -123456789)

Excellent!


I'm new to new lisp (love it!) but this doesn't work for numbers with a decimal part.

My try:

(define (format1000 n)

 (let (t (parse (string n) "."))

 (append (reverse (join (explode (reverse (first t)) 3) ","))

         (if (empty? (rest t))

          ""

          (append "." (last t))))))





> (format1000 12131)

"12,131"

> (format1000 12131.23)

"12,131.23"