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 - tomtoo

#1
thank you I'll have a look.
#2
Hi guys,



I need a little help with creating a database with newlisp. I'd like to use "lookup" to search for various things, but I'm not sure how to create the database with all the needed elements. here's the result of what I have now:

(set 'all-computers '(
  ((atag "444") (person "yyy") (room "") (role nil))))


This does not look right! how can I do something like
(lookup person all-computers)

and determine atag  or "not entered" for room or role?



I'll probably use this for myself, and use it to populate a real database or spreadsheet.



thanks :-)
#3
newLISP in the real world / Giving nil a value
November 06, 2017, 05:02:24 PM
Hi guys,



I would like to replace any and all nils in a list with "none" .  If I can see the nil



(set 'a '(1 2 nil 4))


I can do

(setf (a 2) "none")


but

(dolist (i a)(when (null? i)(setf i "none")))


returns nil. and
(null? (a 2))
returns true.



How might I fix this? I don't know where a nil might pop up.

thank you.
#4
newLISP in the real world / csv to nested list?
October 29, 2017, 06:29:23 AM
Hi guys,



I would like to use lookup and/or assoc  to generate html tables. The source data will come from 4 different csv (maybe tsv) files.



This bit from the manual seems almost perfect:



(set 'persons '(
(id001 (name "Anne") (address (country "USA") (city "New York")))
(id002 (name "Jean") (address (country "France") (city "Paris")))
))


Or this:

(set 'persons '(
    ("John Doe" 35 "M" 12.34)
    ("Mickey Mouse" 65 "N" 12345678)


I'm having trouble working out how to populate my list with elements from the different sources.



Help?



It seems like this is a common enough scenario, but I can't quite get it without things getting really ugly.



Thanks :-)
#5
Something like this?

> (set (sym "foo") "bar")
"bar"
> foo
"bar"
> (set 'a "one :two: three")
"one :two: three"
> a
"one :two: three"
> (replace ":two:" a foo)
"one bar three"
>
#6
it's not web-based, but don't forget about gtk server...



http://www.gtk-server.org/">http://www.gtk-server.org/
#7
newLISP in the real world / Re: (newbie) Listiness
October 27, 2014, 03:23:59 PM
This way also seems to work...

(set 'a (parse (read-file "foo.tmp") "n"))
(dolist (item a)
(unless (or (starts-with item "#")(empty? item))
(push item box -1)))
(dolist (item box)
(set 'z (parse item ":"))
(push (cons (int (first z))(last z)) bag -1))
#8
or use screen and detach the session...
#9
newLISP in the real world / Re: arranging list items
November 04, 2013, 02:53:18 PM
I'm still not sure of the best way to create a new list by combining sub1 sub2 and sub3. Is this a job for "array?" an example would be appreciated...
#10
newLISP in the real world / Re: arranging list items
November 03, 2013, 03:14:50 AM
I didn't include all the elements from the op in the diagram. do you mean make three different combined lists, or did you only include the elements in the diagram?



now, how to do it...
#11
newLISP in the real world / Re: arranging list items
November 02, 2013, 09:43:28 PM
Quote from: "jopython"And how would be the final desired list look like for this example?


I think something like this:



'((0 (1(2))(3(4 5))(6(7 8 9 10)))(11(12(13))(14)(15(16 17)))(18(19(20)))(21))
#12
newLISP in the real world / Re: arranging list items
November 02, 2013, 08:55:56 PM
Quote from: "jopython"Your intentions are not clear in your example.

sorry.



I would like to combine these lists so that



1, 3, and 6 would be nested under 0

2 would be nested under 1

4 and 5 would be nested under 3

7 8 9 and 10 would be nested under 6



here's a terrible diagram

      0
       |
      /
  1   3    6__
  |   |       |
  2   |       |
       |       |
       |       |
      /       |
     4   5     |
                |
                |
              /  
           |  |  |  |
           |  |  |  |
           7  8  9  10


I hope that's a little bit more clear...
#13
newLISP in the real world / arranging list items
November 02, 2013, 02:31:55 PM
hi guys,



I'm making a directory structure and an outline.

I have the index positions of items in lists:

> sub1
(0 11 18)
> sub2
(1 3 6 12 14 15 19 21)
> sub3
(2 4 5 7 8 9 10 13 16 17 20)


elements in sub1 are the top-level directories

sub2 elements are subdirectorys of sub1 elements

sub3 elements are subdirectories of sub2 elements



I'm close, but stuck. any suggestions?
#14
newLISP and the O.S. / newlisp on android build question.
September 05, 2013, 04:48:46 PM
Hi guys,



I followed the instructions on the android page and got a binary that worked fine on the 2012 nexus 7. It does not work on the 2013 nexus 7. I get this when I tried to run it:

cannot link executable: empty/missing DT_Hash in "./newlisp" (built
with --hash-style=gnu?)


as a shot in the dark I tried to make --hash-style=both a configure option, but I don't know what I'm doing and that didn't work. Any ideas?



Does anybody use newlisp on android? I haven't seen a post about it in a while.
#15
newLISP in the real world / is this a bug?
August 03, 2013, 07:01:52 AM

> (set 'a "0821")
"0821"
> (int a)
0


shouldn't this return 0821?



> (integer? 0821)
true